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 2023/06/07 14:11:00 UTC

[jira] [Created] (GROOVY-11085) STC: closure with untyped parameter(s) as argument for SAM-type method parameter

Eric Milles created GROOVY-11085:
------------------------------------

             Summary: STC: closure with untyped parameter(s) as argument for SAM-type method parameter
                 Key: GROOVY-11085
                 URL: https://issues.apache.org/jira/browse/GROOVY-11085
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 3.0.17
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
void setStrategy(Predicate<Long> tester) {
  assert tester.test(1L)
}
strategy = { n -> n instanceof Long }
{code}

Compiler error: "Incompatible generic argument types. Cannot assign Predicate<Object> to Predicate<Long>"



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