Thodoris Sotiropoulos created GROOVY-10997:
----------------------------------------------
Summary: Unexpected type mismatch when using super on a bounded
type parameter
Key: GROOVY-10997
URL: https://issues.apache.org/jira/browse/GROOVY-10997
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Reporter: Thodoris Sotiropoulos
I have the following program
{code}
import java.util.stream.*;
import java.util.function.*;
class Main {
static final <Y, I extends Y> void test() {
Stream<I> x = null;
Consumer<Y> y = null;
x.forEach(y);
}
}
{code}
h3. Actual behavior
{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
groovy30.groovy: 9: [Static type checking] - Cannot call
java.util.stream.Stream#forEach(java.util.function.Consumer<? super I>) with
arguments [java.util.function.Consumer<Y>]
@ line 9, column 5.
x.forEach(y);
^
1 error
{code}
h3. Expected behavior
Compile successfully
Tested against master (commit: 72cae725137e3a610b94e6927b18587c439f6f9b)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)