|
Groovy example source code file (Groovy1465Bug.groovy)
The Groovy Groovy1465Bug.groovy source code
package groovy.bugs
import org.codehaus.groovy.control.MultipleCompilationErrorsException
class Groovy1465Bug extends GroovyTestCase {
void compileAndVerifyCyclicInheritenceCompilationError(script) {
try {
new GroovyShell().parse(script)
fail('The compilation should have failed as it is a cyclic reference')
} catch (MultipleCompilationErrorsException e) {
def syntaxError = e.errorCollector.getSyntaxError(0)
assert syntaxError.message.contains('Cyclic inheritance')
}
}
void testInterfaceCyclicInheritenceTC1() {
compileAndVerifyCyclicInheritenceCompilationError """
interface G1465Tt extends G1465Tt { }
def tt = {} as G1465Tt
"""
}
void testInterfaceCyclicInheritenceTC2() {
compileAndVerifyCyclicInheritenceCompilationError """
interface G1465Rr extends G1465Ss { }
interface G1465Ss extends G1465Rr { }
def ss = {} as G1465Ss
"""
}
void testInterfaceCyclicInheritenceTC3() {
compileAndVerifyCyclicInheritenceCompilationError """
interface G1465A extends G1465B { }
interface G1465B extends G1465C { }
interface G1465C extends G1465B { }
"""
}
}
Other Groovy examples (source code examples)Here is a short list of links related to this Groovy Groovy1465Bug.groovy source code file: |
Other websites by Alvin Alexander:
Life/living in Alaska (OneMansAlaska.com)
How I Sold My Business (HowISoldMyBusiness.com)
Copyright 1998-2011 Alvin Alexander, devdaily.com
All Rights Reserved.