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

Compile Static causes getAt to fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.13, 2.5.0-beta-3, 2.4.14, 3.0.0-alpha-2, 2.4.15
    • 3.0.0-alpha-4, 2.5.3
    • Compiler
    • None
    • Intellij plus various versions of Groovy; the same problem also occurs in Eclipse-Groovy with the same versions
    • Hide
      Error:Groovyc: While compiling gppDemos: BUG! exception in phase 'class generation' in source unit 'D:\IJgroovy\gpp\gppDemos\src\demos\nQueensProblem\QueensClient.groovy' At line 67 column 13
      On receiver: leftDiagonal with message: getAt and arguments: <not implemented yet for class: org.codehaus.groovy.classgen.asm.VariableSlotLoader>
      This method should not have been called. Please try to create a simple example reproducing
      this error and file a bug report at https://issues.apache.org/jira/browse/GROOVY
          at org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter.makeSingleArgumentCall(StaticTypesCallSiteWriter.java:665)
          at org.codehaus.groovy.classgen.asm.InvocationWriter.makeSingleArgumentCall(InvocationWriter.java:643)
          at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateBinaryExpression(BinaryExpressionHelper.java:559)
          at org.codehaus.groovy.classgen.asm.BinaryExpressionMultiTypeDispatcher.evaluateBinaryExpression(BinaryExpressionMultiTypeDispatcher.java:191)
          at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.eval(BinaryExpressionHelper.java:257)
          at org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:682)
          at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:60)
          at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.loadWithSubscript(BinaryExpressionHelper.java:727)
          at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluatePostfixMethod(BinaryExpressionHelper.java:655)
          at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluatePostfixMethod(BinaryExpressionHelper.java:678)
          at org.codehaus.groovy.classgen.AsmClassGenerator.visitPostfixExpression(AsmClassGenerator.java:687)
          at org.codehaus.groovy.ast.expr.PostfixExpression.visit(PostfixExpression.java:45)
          at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:625)
          at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:664)
          at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
          at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:85)
          at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:65)
          at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:610)
          at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
          at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeIteratorBasedForEachLoop(StaticTypesStatementWriter.java:236)
          at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeForInLoop(StaticTypesStatementWriter.java:91)
          at org.codehaus.groovy.classgen.asm.StatementWriter.writeForStatement(StatementWriter.java:97)
          at org.codehaus.groovy.classgen.AsmClassGenerator.visitForLoop(AsmClassGenerator.java:614)
          at org.codehaus.groovy.ast.stmt.ForStatement.visit(ForStatement.java:49)
          at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:85)
          at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:65)
          at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:610)
          at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:110)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:121)
          at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:470)
          at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:423)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:132)
          at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:551)
          at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1095)
          at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:54)
          at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:261)
          at org.codehaus.groovy.control.CompilationUnit$18.call(CompilationUnit.java:848)
          at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1088)
          at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:631)
          at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:609)
          at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:586)
          at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:62)
          at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:115)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:134)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovycInThisProcess(InProcessGroovyc.java:158)
          at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.lambda$runGroovyc$0(InProcessGroovyc.java:88)
          at java.util.concurrent.FutureTask.run(FutureTask.java:266)
          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
          at java.lang.Thread.run(Thread.java:748)
      Show
      Error:Groovyc: While compiling gppDemos: BUG! exception in phase 'class generation' in source unit 'D:\IJgroovy\gpp\gppDemos\src\demos\nQueensProblem\QueensClient.groovy' At line 67 column 13 On receiver: leftDiagonal with message: getAt and arguments: <not implemented yet for class: org.codehaus.groovy.classgen.asm.VariableSlotLoader> This method should not have been called. Please try to create a simple example reproducing this error and file a bug report at https://issues.apache.org/jira/browse/GROOVY     at org.codehaus.groovy.classgen.asm.sc.StaticTypesCallSiteWriter.makeSingleArgumentCall(StaticTypesCallSiteWriter.java:665)     at org.codehaus.groovy.classgen.asm.InvocationWriter.makeSingleArgumentCall(InvocationWriter.java:643)     at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateBinaryExpression(BinaryExpressionHelper.java:559)     at org.codehaus.groovy.classgen.asm.BinaryExpressionMultiTypeDispatcher.evaluateBinaryExpression(BinaryExpressionMultiTypeDispatcher.java:191)     at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.eval(BinaryExpressionHelper.java:257)     at org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:682)     at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:60)     at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.loadWithSubscript(BinaryExpressionHelper.java:727)     at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluatePostfixMethod(BinaryExpressionHelper.java:655)     at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluatePostfixMethod(BinaryExpressionHelper.java:678)     at org.codehaus.groovy.classgen.AsmClassGenerator.visitPostfixExpression(AsmClassGenerator.java:687)     at org.codehaus.groovy.ast.expr.PostfixExpression.visit(PostfixExpression.java:45)     at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:625)     at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:664)     at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)     at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:85)     at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:65)     at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:610)     at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)     at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeIteratorBasedForEachLoop(StaticTypesStatementWriter.java:236)     at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeForInLoop(StaticTypesStatementWriter.java:91)     at org.codehaus.groovy.classgen.asm.StatementWriter.writeForStatement(StatementWriter.java:97)     at org.codehaus.groovy.classgen.AsmClassGenerator.visitForLoop(AsmClassGenerator.java:614)     at org.codehaus.groovy.ast.stmt.ForStatement.visit(ForStatement.java:49)     at org.codehaus.groovy.classgen.asm.StatementWriter.writeBlockStatement(StatementWriter.java:85)     at org.codehaus.groovy.classgen.asm.sc.StaticTypesStatementWriter.writeBlockStatement(StaticTypesStatementWriter.java:65)     at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:610)     at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)     at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:110)     at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:121)     at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:470)     at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:423)     at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:132)     at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:551)     at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1095)     at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:54)     at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:261)     at org.codehaus.groovy.control.CompilationUnit$18.call(CompilationUnit.java:848)     at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1088)     at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:631)     at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:609)     at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:586)     at org.jetbrains.groovy.compiler.rt.GroovyCompilerWrapper.compile(GroovyCompilerWrapper.java:62)     at org.jetbrains.groovy.compiler.rt.DependentGroovycRunner.runGroovyc(DependentGroovycRunner.java:115)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at org.jetbrains.groovy.compiler.rt.GroovycRunner.intMain2(GroovycRunner.java:134)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:498)     at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.runGroovycInThisProcess(InProcessGroovyc.java:158)     at org.jetbrains.jps.incremental.groovy.InProcessGroovyc.lambda$runGroovyc$0(InProcessGroovyc.java:88)     at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)     at java.lang.Thread.run(Thread.java:748)

    Description

      I can reproduce by adding @CompileStatic to the example I tried previously and can confirm that 2.4.13 is where the regression started. Workaround would be to remove @CompileStatic until we can get a fix in place. If you can raise a bug issue in Jira, that would be great.

      the reproducer following is a shortened version created by Paul King:

      import groovy.transform.CompileStatic
       
      @CompileStatic
      def method() {
        def list = [0, 1, 2, 3]
        for (idx in 1..2) {
          list[idx-1]++
        }
        list
      }
       
      assert method() == [1, 2, 2, 3]
      

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              JonKerridge Jon Kerridge
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: