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

Compiler throws NPE when it can't find an imported class

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-3
    • 1.0-JSR-4
    • class generator
    • None

    Description

      import groovy.util.NotThere

      def a = new NotThere()

      produces the following stack trace during compilation:
      General error during class generation: java.lang.NullPointerException

      java.lang.NullPointerException
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitClassExpression(AsmClassGenerator.java:2407)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorCallExpression(AsmClassGenerator.java:1705)
      at org.codehaus.groovy.ast.expr.ConstructorCallExpression.visit(ConstructorCallExpression.java:76)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:3248)
      at org.codehaus.groovy.classgen.AsmClassGenerator.evaluateEqual(AsmClassGenerator.java:3162)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:1071)
      at org.codehaus.groovy.ast.CodeVisitorSupport.visitDeclarationExpression(CodeVisitorSupport.java:529)
      at org.codehaus.groovy.ast.expr.DeclarationExpression.visit(DeclarationExpression.java:65)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitAndAutoboxBoolean(AsmClassGenerator.java:3248)
      at org.codehaus.groovy.classgen.AsmClassGenerator.evaluateExpression(AsmClassGenerator.java:1039)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitReturnStatement(AsmClassGenerator.java:983)
      at org.codehaus.groovy.ast.stmt.ReturnStatement.visit(ReturnStatement.java:69)
      at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:165)
      at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:79)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:401)
      at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:777)
      at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:300)
      at org.codehaus.groovy.control.CompilationUnit$3.call(CompilationUnit.java:611)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:851)
      at org.codehaus.groovy.control.CompilationUnit.classgen(CompilationUnit.java:557)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:462)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:271)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:234)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:184)
      at groovy.lang.GroovyShell$1.run(GroovyShell.java:266)
      at java.security.AccessController.doPrivileged(Native Method)
      at groovy.lang.GroovyShell.run(GroovyShell.java:264)
      at groovy.lang.GroovyShell.run(GroovyShell.java:208)
      at groovy.ui.GroovyMain.processOnce(GroovyMain.java:450)
      at groovy.ui.GroovyMain.run(GroovyMain.java:276)
      at groovy.ui.GroovyMain.process(GroovyMain.java:262)
      at groovy.ui.GroovyMain.main(GroovyMain.java:138)
      at groovy.lang.GroovyShell.main(GroovyShell.java:121)

      1 Error

      Attachments

        Activity

          People

            jstrachan James Strachan
            tug John Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: