You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Michael Spahn (Jira)" <ji...@apache.org> on 2021/03/09 18:40:00 UTC

[jira] [Created] (GROOVY-9974) @CompileStatic with Method References

Michael Spahn created GROOVY-9974:
-------------------------------------

             Summary: @CompileStatic with Method References
                 Key: GROOVY-9974
                 URL: https://issues.apache.org/jira/browse/GROOVY-9974
             Project: Groovy
          Issue Type: Bug
          Components: Static compilation
    Affects Versions: 3.0.7, 3.0.6
         Environment: JDK 11
            Reporter: Michael Spahn


The following code worked fine until 3.0.5:
{code:java}
@Test
@CompileStatic
void methodReference() {
    def list = ['']
    list.removeIf(String::isBlank)

    assert list.empty
}
{code}
Using version 3.0.6/3.0.7 this no longer compiles:
{noformat}
Groovyc: [Static type checking] - Cannot call java.util.List <java.lang.String>#removeIf(java.util.function.Predicate <? super java.lang.String>) with arguments [groovy.lang.Closure <java.lang.Boolean>]
{noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)