[ 
https://issues.apache.org/jira/browse/GROOVY-8243?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16070345#comment-16070345
 ] 

Daniil Ovchinnikov commented on GROOVY-8243:
--------------------------------------------

If traits are not SAM candidates, please  throw GroovyCastException on 
assignment.

> SAM trait middle coercion via middle interface
> ----------------------------------------------
>
>                 Key: GROOVY-8243
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8243
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.4.10
>            Reporter: Daniil Ovchinnikov
>
> {code}
> trait T {
>     abstract def foo(int i)
>     def bar(double j) {
>         println "bar $j"
>     }
> }
> interface F extends T {}
> F t = { println "closure $it" }
> t.foo(42) // `closure 42`
> t.bar(43) // `closure 43.0`; should be `bar 43.0`
> {code}
> Changing variable type to {{T}} works as expected.



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

Reply via email to