Thodoris Sotiropoulos created GROOVY-10994:
----------------------------------------------

             Summary: 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


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)

Reply via email to