You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (JIRA)" <ji...@apache.org> on 2017/02/01 23:19:02 UTC

[jira] [Closed] (GROOVY-7748) SAM & @CompileStatic failure

     [ https://issues.apache.org/jira/browse/GROOVY-7748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Paul King closed GROOVY-7748.
-----------------------------

> SAM & @CompileStatic failure
> ----------------------------
>
>                 Key: GROOVY-7748
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7748
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Maxim Medvedev
>             Fix For: 2.4.8
>
>
> Groovyc fails to compile SAM coercion used in variable declaration
> {code}
> interface Function<D, I> {
>   I fun(D dom)
> }
> class A{}; class B{}
> @CompileStatic
> void sample() {
>   Function<A, B> f = {A dom -> return new B() } //compilation fails here
> }
> void bar(Function<A, B> fun) {}
> @CompileStatic
> void sample2() {
>   bar {A dom -> return new B() } //compiles & runs ok
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)