You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Alexey Afanasiev (JIRA)" <ji...@apache.org> on 2018/05/04 10:33:00 UTC

[jira] [Created] (GROOVY-8568) SAM coercion doesn't work with abstract classes in @CompileStatic

Alexey Afanasiev created GROOVY-8568:
----------------------------------------

             Summary: SAM  coercion doesn't work with abstract classes in @CompileStatic
                 Key: GROOVY-8568
                 URL: https://issues.apache.org/jira/browse/GROOVY-8568
             Project: Groovy
          Issue Type: Bug
          Components: Static compilation, Static Type Checker
    Affects Versions: 2.5.0-rc-1, 2.4.13
            Reporter: Alexey Afanasiev


{code:java}
import groovy.transform.CompileStatic

abstract class A1 {
    def abstract foo()
}

@CompileStatic
def m() {
    A1 a = { print this } //Groovyc: [Static type checking] - Cannot assign value of type groovy.lang.Closure <java.lang.Void> to variable of type A1
}
{code}
Looks like it should work as in dynamic mode.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)