Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
I have the following program
import java.util.function.Supplier; class Main { byte x = 1; void foo() { Supplier<Number> y = () -> x; } }
Actual behaviour
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: Main.java: 8: [Static type checking] - Incompatible generic argument types. Cannot assign java.util.function.Supplier<java.lang.Byte> to: java.util.function.Supplier<java.lang.Number> @ line 8, column 31. Supplier<Number> y = () -> x; ^ 1 error
Expected behaviour
Compile successfully
Note that if `x` is a local variabled defined in function `foo`, groovyc compiles the program successfully.
Tested against master