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

Paul King closed GROOVY-9132.
-----------------------------

> Improve type inference for method reference
> -------------------------------------------
>
>                 Key: GROOVY-9132
>                 URL: https://issues.apache.org/jira/browse/GROOVY-9132
>             Project: Groovy
>          Issue Type: Improvement
>          Components: Static Type Checker
>            Reporter: Paul King
>            Assignee: Eric Milles
>            Priority: Major
>             Fix For: 4.0.0-alpha-2, 3.0.8
>
>
> 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 involving bounded parameters. 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
(v8.20.1#820001)

Reply via email to