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

ArrayIndexOutOfBoundsException with @Nullable change

    XMLWordPrintableJSON

    Details

      Description

      Steps to reproduce:

      $ git clone [https://github.com/gradle/gradle
      $ cd gradle
      $ git checkout c8e7ac4adb2f72390ed681eb8bfdaa41111baa8e
      $ ./gradlew :core:compileTestGroovy
      $ # ^ This version works
      $ git revert --no-commit head
      $ ./gradlew :core:compileTestGroovy
      $ # ^ This will fail
      

      The reverted commit is this:

      https://github.com/gradle/gradle/pull/4682/commits/c8e7ac4adb2f72390ed681eb8bfdaa41111baa8e

      It removes a @Nullable annotation from a constructor parameter. If the annotation is present (i.e. the commit is reverted), ./gradlew :core:compileTestGroovy will produce the following exception:

      java.lang.ArrayIndexOutOfBoundsException: 1
              at org.codehaus.groovy.vmplugin.v5.Java5.makeParameters(Java5.java:451)
              at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:382)
              at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:280)
              at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:1009)
              at org.codehaus.groovy.ast.ClassNode.getUnresolvedSuperClass(ClassNode.java:1004)
              at org.codehaus.groovy.ast.ClassNode.getSuperClass(ClassNode.java:998)
              at org.codehaus.groovy.ast.ClassNode.isDerivedFrom(ClassNode.java:941)
              at org.codehaus.groovy.classgen.asm.InvocationWriter.castToNonPrimitiveIfNecessary(InvocationWriter.java:863)
              at org.codehaus.groovy.classgen.asm.OperandStack.doConvertAndCast(OperandStack.java:345)
              at org.codehaus.groovy.classgen.asm.OperandStack.doGroovyCast(OperandStack.java:282)
              at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateEqual(BinaryExpressionHelper.java:344)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitDeclarationExpression(AsmClassGenerator.java:637)
              at org.codehaus.groovy.ast.expr.DeclarationExpression.visit(DeclarationExpression.java:89)
              at org.codehaus.groovy.classgen.asm.StatementWriter.writeExpressionStatement(StatementWriter.java:613)
              at org.codehaus.groovy.classgen.asm.OptimizingStatementWriter.writeExpressionStatement(OptimizingStatementWriter.java:366)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitExpressionStatement(AsmClassGenerator.java:624)
              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.OptimizingStatementWriter.writeBlockStatement(OptimizingStatementWriter.java:159)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:570)
              at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
              at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
              at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:434)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:387)
              at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:511)
              at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1081)
              at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
              at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:233)
              at org.codehaus.groovy.control.CompilationUnit.call(CompilationUnit.java:825)
              at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1065)
              at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
              at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
              at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
              at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:537)
              at org.gradle.api.internal.tasks.compile.ApiGroovyCompiler.execute(ApiGroovyCompiler.java:175)
      

      The change actually happens in Java code that the Groovy compilation depends on.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jwagenleitner John Wagenleitner
                Reporter:
                lptr Lóránt Pintér
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: