Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10528

STC: NPE for raw type instanceof followed by parameterized extension method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 4.0.1
    • 4.0.2
    • Static Type Checker
    • None

    Description

      Consider the following:

      void test(... args) {
          args.each { object ->
              if (object instanceof Iterable) {
                  object.each { test(it) }
              }
          }
      }
      test(1,[2,3])
      

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

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: