Details
-
Bug
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Possible regression? Groovyc 4.0.10 compiles the program
I have the following program
import java.util.function.Supplier; import java.util.function.BinaryOperator; import java.util.stream.Stream; class Main { static final <X extends Number> void test() { Supplier<Stream<X>> x = null; X y = null; BinaryOperator<X> z = null; X result = x.get().reduce(y, z); } }
Actual behavior
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: test.groovy: 11: [Static type checking] - Cannot call java.util.stream.Stream#reduce(X, java.util.function.BinaryOperator<X extends java.lang.Number>) with arguments [X, java.util.function.BinaryOperator<X>] @ line 11, column 16. X result = x.get().reduce(y, z); ^ 1 error
Expected behavior
Compile successfully
Notes: The type parameter X should have an upper bound in order to trigger the error.
Tested against master (commit: a29ce1ce64d565526b70e145ace665dd0617ec9b)