You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Maxim Medvedev (JIRA)" <ji...@apache.org> on 2016/02/04 09:33:39 UTC

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

Maxim Medvedev created GROOVY-7748:
--------------------------------------

             Summary: SAM & @CompileStatic failure
                 Key: GROOVY-7748
                 URL: https://issues.apache.org/jira/browse/GROOVY-7748
             Project: Groovy
          Issue Type: Bug
            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 B() } //compiles & run ok
}
{code}




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)