You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2023/04/15 15:52:00 UTC

[jira] [Updated] (GROOVY-10997) Unexpected type mismatch when using super on a bounded type parameter

     [ https://issues.apache.org/jira/browse/GROOVY-10997?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-10997:
---------------------------------
    Priority: Minor  (was: Major)

> 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
>            Priority: Minor
>
> 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)