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

NPE compiling Memoized method

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.7
    • 2.5.0-alpha-1
    • None
    • None

    Description

      Reproducable Example groovy code that fails to compile
      class A {    
      }
      
      new A() {
        @groovy.transform.Memoized()
        String a() {
          return "a"
        }
      }
      
      Exception I get when compiling the groovy script
      groovy.lang.GroovyRuntimeException: NPE while processing Script71.groovy
           at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:258)
           at org.codehaus.groovy.control.CompilationUnit$16.call(CompilationUnit.java:813)
           at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1053)
           at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
           at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
           at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
           at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
           at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
           at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
           at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
           at groovy.lang.GroovyShell.evaluate(GroovyShell.java:584)
           at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
           at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
           ...
      Caused by: java.lang.NullPointerException
           at org.codehaus.groovy.classgen.asm.ClosureWriter.createClosureClass(ClosureWriter.java:190)
           at org.codehaus.groovy.classgen.asm.ClosureWriter.getOrAddClosureClass(ClosureWriter.java:156)
           at org.codehaus.groovy.classgen.asm.ClosureWriter.writeClosure(ClosureWriter.java:87)
           at org.codehaus.groovy.classgen.AsmClassGenerator.visitClosureExpression(AsmClassGenerator.java:657)
           at org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:45)
           at org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:235)
           at org.codehaus.groovy.classgen.asm.CallSiteWriter.prepareSiteAndReceiver(CallSiteWriter.java:224)
           at org.codehaus.groovy.classgen.asm.CallSiteWriter.makeCallSite(CallSiteWriter.java:272)
           at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCachedCall(InvocationWriter.java:307)
           at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:392)
           at org.codehaus.groovy.classgen.asm.InvocationWriter.makeCall(InvocationWriter.java:104)
           at org.codehaus.groovy.classgen.asm.InvocationWriter.makeInvokeMethodCall(InvocationWriter.java:88)
           at org.codehaus.groovy.classgen.asm.InvocationWriter.writeInvokeMethod(InvocationWriter.java:459)
           at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethodCallExpression(AsmClassGenerator.java:767)
           at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:66)
           at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateEqual(BinaryExpressionHelper.java:316)
           at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.eval(BinaryExpressionHelper.java:84)
           at org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:638)
           at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
           at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:612)
           at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeExpressionStatement(OptimizingStatementWriter.java:357)
      

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              idooley Isaac Dooley
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: