|
Groovy example source code file (Groovy1465Bug.groovy)
The Groovy Groovy1465Bug.groovy source codepackage 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: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.