groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniil Ovchinnikov (JIRA)" <j...@apache.org>
Subject [jira] [Created] (GROOVY-8244) SAM trait coercion with default parameters
Date Fri, 30 Jun 2017 16:19:00 GMT
Daniil Ovchinnikov created GROOVY-8244:
------------------------------------------

             Summary: SAM trait coercion with default parameters
                 Key: GROOVY-8244
                 URL: https://issues.apache.org/jira/browse/GROOVY-8244
             Project: Groovy
          Issue Type: Bug
    Affects Versions: 2.4.10
            Reporter: Daniil Ovchinnikov


{code}
trait T {
    abstract def foo(a, b = 1)
}

T t = { o1, o2 ->
    println o1
    assert o2 == 1
}
t.foo(42) // Caught: groovy.lang.MissingMethodException: No signature of method: abstractMethod$_run_closure1.doCall()
is applicable for argument types: (java.lang.Integer) values: [42]
{code}

Expected result: it should just work or throw GroovyCastException in case of traits are not
SAM candidates



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message