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 2021/03/20 01:09:00 UTC
[jira] [Updated] (GROOVY-9991) STC: error for closure not matching
functional interface method's parameter count
[ https://issues.apache.org/jira/browse/GROOVY-9991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-9991:
--------------------------------
Description:
Consider the following:
{code:groovy}
import java.util.function.*
@groovy.transform.TypeChecked
void test() {
Consumer c0 = { print it } // error
Consumer c1 = { x -> } // all good
Supplier s0 = { -> "" } // all good
Supplier s1 = { "" } // all good
}
{code}
The implicit parameter closure literal (no arrow) should match for 0 or 1 parameter method targets.
was:
Consider the following:
{code:groovy}
import java.util.function.*
@groovy,transform.TypeChecked
void test() {
Consumer c0 = { print it } // error
Consumer c1 = { x -> } // all good
Supplier s0 = { -> "" } // all good
Supplier s1 = { "" } // all good
}
{code}
The implicit parameter closure literal (no arrow) should match for 0 or 1 parameter method targets.
> STC: error for closure not matching functional interface method's parameter count
> ---------------------------------------------------------------------------------
>
> Key: GROOVY-9991
> URL: https://issues.apache.org/jira/browse/GROOVY-9991
> Project: Groovy
> Issue Type: Bug
> Reporter: Eric Milles
> Assignee: Eric Milles
> Priority: Major
>
> Consider the following:
> {code:groovy}
> import java.util.function.*
> @groovy.transform.TypeChecked
> void test() {
> Consumer c0 = { print it } // error
> Consumer c1 = { x -> } // all good
> Supplier s0 = { -> "" } // all good
> Supplier s1 = { "" } // all good
> }
> {code}
> The implicit parameter closure literal (no arrow) should match for 0 or 1 parameter method targets.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)