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:34:39 UTC
[jira] [Updated] (GROOVY-7748) SAM & @CompileStatic failure
[ https://issues.apache.org/jira/browse/GROOVY-7748?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Maxim Medvedev updated GROOVY-7748:
-----------------------------------
Description:
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 & runs ok
}
{code}
was:
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}
> 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 & runs ok
> }
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)