You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Lóránt Pintér (JIRA)" <ji...@apache.org> on 2018/03/12 14:35:00 UTC

[jira] [Created] (GROOVY-8505) ArrayIndexOutOfBoundsException with @Nullable change

Lóránt Pintér created GROOVY-8505:
-------------------------------------

             Summary: ArrayIndexOutOfBoundsException with @Nullable change
                 Key: GROOVY-8505
                 URL: https://issues.apache.org/jira/browse/GROOVY-8505
             Project: Groovy
          Issue Type: Bug
          Components: Compiler
    Affects Versions: 2.4.12
         Environment: See [Gradle build scan|https://scans.gradle.com/s/gr3dszv44wkfg/console-log#L476] for execution details.
            Reporter: Lóránt Pintér


*Steps to reproduce:*

{code}
$ 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
{code}

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:

{code}
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)
{code}

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





--
This message was sent by Atlassian JIRA
(v7.6.3#76005)