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 00:55:00 UTC

[jira] [Created] (GROOVY-9991) STC: error for closure not matching functional interface method's parameter count

Eric Milles created GROOVY-9991:
-----------------------------------

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


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)