Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
I have the following program:
class Foo<T> {} class Main { static final <T extends Foo<String>> T test() { final T x = null; true ? (T) null: x } }
Actual behaviour
groovyc rejects the above program and produces
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 6: [Static type checking] - Cannot return value of type Foo<java.lang.Object> on method returning type T @ line 6, column 5. true ? (T) null: x ^1 error
Expected behaviour
Compile successfully
Note that if I replace the bound of type parameter `T` with a non-parameterized bound (e.g., Number), groovyc compiles the program as expected.
Tested against master