Paul King created GROOVY-9132:
---------------------------------

             Summary: Improve type inference for method reference
                 Key: GROOVY-9132
                 URL: https://issues.apache.org/jira/browse/GROOVY-9132
             Project: Groovy
          Issue Type: Improvement
            Reporter: Paul King


Compiling this code:
{code}
assert 'Hi'.transform(String::length) * 3 == 6 // transform is JDK12
{code}
with type checking gives:
{noformat}
[Static type checking] - Cannot find matching method 
java.lang.Object#multiply(int). Please check if the declared type is correct 
and if the method exists.
{noformat}
We can close as duplicate if this overlaps with an existing issue. It might not 
be anything to do with method references but an existing limitation in the type 
checker around supporting generics. For reference, the definition of 
{{transform}} is:
{code}
public <R> R transform​(Function<? super String,​? extends R> f)
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to