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

NPE with ConvertedClosure

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.5
    • Fix Version/s: 2.4.6
    • Component/s: None
    • Labels:
      None

      Description

      interface Y extends GroovyObject {}
      def cl = {println 1} as Y
      assert cl instanceof GroovyObject
      if (cl) println "!cl"
      

      the code above will cause the execution of the method getMetaClass in the boolean part of the "if". It looks like this code path now produces a NPE

      java.lang.NullPointerException
      	at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:919)
      	at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:902)
      	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToBoolean(DefaultTypeTransformation.java:185)
      	at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.booleanUnbox(DefaultTypeTransformation.java:74)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              blackdrag Jochen Theodorou
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: