Last active
August 29, 2015 14:00
-
-
Save mperry/11471693 to your computer and use it in GitHub Desktop.
Generic type checking defect for Groovy 2.3.0-rc-4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// bug with Groovy 2.3.0-rc-4, should type check, but does not | |
// http://jira.codehaus.org/browse/GROOVY-6748 | |
import groovy.transform.TypeChecked | |
//import org.junit.Test | |
@TypeChecked | |
class Class1 { | |
static <A, B> void method1(A a, B b) { | |
method2(a, b) | |
} | |
static <A, B> void method2(A a, B b) { | |
} | |
static <A, B> void method3(List<A> list1, List<B> list2) { | |
method1(list1.get(0), list2.get(0)) | |
} | |
} | |
/* | |
Error is: | |
D:\repositories\functionalgroovy\consume\scripts>groovy genericTypeCheck.groovy | |
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: | |
D:\repositories\functionalgroovy\consume\scripts\genericTypeCheck.groovy: 18: [St | |
atic type checking] - Cannot call <A,B> Class1#method1(A, B) with arguments [E, E | |
] | |
@ line 18, column 9. | |
method1(list1.get(0), list2.get(0)) | |
^ | |
1 error | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment