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/11 21:20:00 UTC

[jira] [Resolved] (GROOVY-10994) Fail to resolve method reference with generics

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

Eric Milles resolved GROOVY-10994.
----------------------------------
    Resolution: Fixed

https://github.com/apache/groovy/commit/dd929b4fd879e6d3e5cb7c4372134899fd4e61dc

> Fail to resolve method reference with generics
> ----------------------------------------------
>
>                 Key: GROOVY-10994
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10994
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Eric Milles
>            Priority: Major
>
> I have the following program
> {code}
> import java.util.List;
> import java.util.function.Predicate;
> class Main {
>   static final <T> void test() {
>     List<T> x = null;
>     Predicate<? super T> y = x::add;
>   }
> }
> {code}
> h3. Actual behavior
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> Main.groovy: 9: Failed to find method 'add(T)' for the type: java.util.List<T> @ line 9, column 30.
>        Predicate<? super T> y = x::add;
>                                 ^
> 1 error
> {code}
> h3. Expected behavior
> Compile successfully
> Tested against master (commit: a29ce1ce64d565526b70e145ace665dd0617ec9b)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)