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/10/17 15:46:00 UTC
[jira] [Updated] (GROOVY-8244) SAM trait coercion with default
parameters
[ https://issues.apache.org/jira/browse/GROOVY-8244?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Eric Milles updated GROOVY-8244:
--------------------------------
Labels: trait traits (was: )
> 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
> Priority: Major
> Labels: trait, traits
>
> {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
(v8.3.4#803005)