Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
None
-
None
-
None
Description
I have the following program
class A<T extends Number> { T foo() { T x = null; (true) ? new B<>(x).f: new B<>(x).f } } class B<X> { X f; B(X x) { this.f = f; } }
Actual behaviour
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 4: [Static type checking] - Cannot return value of type java.lang.Object on method returning type T @ line 4, column 5. (true) ? ^1 error
Expected Behaviour
Compile successfuly
Tested against master (https://github.com/apache/groovy/commit/2a97313250875d60df82302f31d77dd7f07ae685)
I think this is related to https://issues.apache.org/jira/browse/GROOVY-10226. So I close this.