Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
This may be a recent regression.
I have the following program
class Foo<T extends Number> { T f Foo(T f) { this.f = f } T foo() { Closure<T> clos = { -> f} clos() } }
Actual behaviour
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 10: [Static type checking] - Cannot return value of type java.lang.Object on method returning type T @ line 10, column 5. clos() ^1 error
Expected behaviour
Compile successfully
Comment
The code works as expected if I remove the bound from the type parameter of class `Foo`.
Tested against https://github.com/apache/groovy/commit/f3d030afaaae44eca567ead74e68efb932831b08