Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.7
-
None
Description
I have the following Groovy program
class Bar {} class Foo<T extends Bar> { public T method(T x) { def bar = {x} return bar() } }
Actual Behavior
The compiler raise the following compile-time error
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Main.groovy: 6: [Static type checking] - Cannot return value of type java.lang.Object on method returning type T @ line 6, column 12. return bar() ^1 error
Expected Behavior
Compile successfully. Notably, when I remove the "extends" keyword from the type parameter, the code type checks as expected.