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

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

https://github.com/apache/groovy/commit/75520486ccd7f12b4f4c1e93cba6e738eedd0aa7

A method reference produces a {{MethodClosure}} under plain STC, which supports 
reference to {{void}} method adapted to value-bearing SAM (no runtime error; 
returns {{null}}).  For that reason, I put the error check in the SC path.

> STC permits incorrect void method reference
> -------------------------------------------
>
>                 Key: GROOVY-10742
>                 URL: https://issues.apache.org/jira/browse/GROOVY-10742
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>    Affects Versions: 4.0.4
>            Reporter: Christopher Smith
>            Assignee: Eric Milles
>            Priority: Minor
>
> In a functional pipeline, I mistakenly used {{map(service::voidMethod)}} 
> (where the map operation expects {{Function}}). This should have produced a 
> compile-time error but instead produced a runtime error out of the 
> LambdaMetafactory.



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

Reply via email to