Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
This issue may be related to GROOVY-10343.
I have the following program
class A<Z, P extends Z> { Z f; A(Z f) {} } class B<Z extends Number> { Z f; void test() { f = new A<>((Z) null).f; } }
Actual behaviour
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 10: [Static type checking] - Cannot assign value of type java.lang.Object to variable of type Z @ line 10, column 9. f = new A<>((Z) null).f; ^ 1 error
Expected behaviour
Compile successfully
NOTE: Replacing `Z extends Number` with `Z` leads to a successful compilation.
Tested against master (https://github.com/apache/groovy/commit/cf2f77fb033a10d36c4db3a7ff07a2b04631afcf)