Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
I have the following program
class A { static <T> T foo() { return null; } } class Test<T> { void bar() { T x = A.foo(); } }
Actual Behaviour
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: groovy11.groovy: 9: [Static type checking] - Cannot assign value of type #T to variable of type T @ line 9, column 15. T x = A.foo(); ^1 error
Expected Behaviour
Compile successfully
I don't know however, if this is a limitation of the inference engine of groovyc or a bug. Note that the Java compiler compiles the above program successfully. Also note that if I replace "T x = A.foo()" with "String x = A.foo()", groovyc compiles the updated program.
Attachments
Issue Links
- relates to
-
GROOVY-10342 STC is unable to infer type parameter of parameterized method call
- Closed