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

[jira] [Created] (GROOVY-10528) STC: NPE for raw type instanceof followed by parameterized extension method

Eric Milles created GROOVY-10528:
------------------------------------

             Summary: STC: NPE for raw type instanceof followed by parameterized extension method
                 Key: GROOVY-10528
                 URL: https://issues.apache.org/jira/browse/GROOVY-10528
             Project: Groovy
          Issue Type: Bug
          Components: Static Type Checker
    Affects Versions: 4.0.1
            Reporter: Eric Milles
            Assignee: Eric Milles


Consider the following:
{code:groovy}
void test(... args) {
    args.each { object ->
        if (object instanceof Iterable) {
            object.each { test(it) }
        }
    }
}
test(1,[2,3])
{code}

The inferred type of "it" is causing NullPointerException at StaticTypeCheckingSupport.isAssignableTo(StaticTypeCheckingSupport.java:489)



--
This message was sent by Atlassian Jira
(v8.20.1#820001)