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

Jochen Theodorou commented on GROOVY-7748:
------------------------------------------

The error message is {code}[Static type checking] - Incompatible generic 
argument types. Cannot assign Function <A, groovy.lang.Closure> to: Function 
<A, B>{code}

> 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
>
> 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.4#6332)

Reply via email to