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

NPE in InnerClassVisitor for non-static inner class CCE within two AICs

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.0.0-beta-1, 3.0.9
    • Component/s: None
    • Labels:
      None

      Description

      Consider the following:

      class Outer {
          class Inner {
          }
          def obj = new Object() {
              String toString() {
                  new Object() {
                      String toString() {
                          new Inner()
                      }
                  }
              }
          }
      }
      

      https://github.com/groovy/groovy-eclipse/issues/1268

      java.lang.NullPointerException
          at org.codehaus.groovy.classgen.InnerClassVisitor.insertThis0ToSuperCall(InnerClassVisitor.java:306)
          at org.codehaus.groovy.classgen.InnerClassVisitor.passThisReference(InnerClassVisitor.java:286)
          at org.codehaus.groovy.classgen.InnerClassVisitor.visitConstructorCallExpression(InnerClassVisitor.java:147)
          at org.codehaus.groovy.ast.expr.ConstructorCallExpression.visit(ConstructorCallExpression.java:45)
          at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:117)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:200)
          at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:41)
          at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:86)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:164)
          at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:70)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:138)
          at org.codehaus.groovy.classgen.InnerClassVisitor.visitConstructorOrMethod(InnerClassVisitor.java:116)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:106)
          at org.codehaus.groovy.ast.ClassNode.visitMethods(ClassNode.java:1110)
          at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1103)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:52)
          at org.codehaus.groovy.classgen.InnerClassVisitor.visitClass(InnerClassVisitor.java:86)
          at org.codehaus.groovy.control.CompilationUnit.lambda$addPhaseOperations$4(CompilationUnit.java:213)
          at org.codehaus.groovy.control.CompilationUnit$IPrimaryClassNodeOperation.doPhaseOperation(CompilationUnit.java:928)
      

        Attachments

          Activity

            People

            • Assignee:
              emilles Eric Milles
              Reporter:
              emilles Eric Milles
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m