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

IndexOutOfBoundsException for labeled assertion statement

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.7.1
    • 1.8-beta-1
    • Compiler
    • None
    • Mac OS 10.6.2

    Description

      Try to compile the following code (or run it in GroovyConsole):

      mylabel:
      assert true == true
      

      Result:

      java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
      	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
      	at java.util.ArrayList.get(ArrayList.java:322)
      	at org.codehaus.groovy.transform.powerassert.SourceText.getNormalizedColumn(SourceText.java:103)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.record(AsmClassGenerator.java:1661)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBinaryExpression(AsmClassGenerator.java:1625)
      	at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:49)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBooleanExpression(AsmClassGenerator.java:1901)
      	at org.codehaus.groovy.ast.expr.BooleanExpression.visit(BooleanExpression.java:40)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitAssertStatement(AsmClassGenerator.java:978)
      	at org.codehaus.groovy.ast.stmt.AssertStatement.visit(AssertStatement.java:47)
      	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:161)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:707)
      	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:51)
      	at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:35)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:161)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitBlockStatement(AsmClassGenerator.java:707)
      	at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:51)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:97)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:108)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitStdMethod(AsmClassGenerator.java:586)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitConstructorOrMethod(AsmClassGenerator.java:562)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:119)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitMethod(AsmClassGenerator.java:664)
      	at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1044)
      	at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:50)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitClass(AsmClassGenerator.java:275)
      	at org.codehaus.groovy.control.CompilationUnit$11.call(CompilationUnit.java:758)
      	at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:973)
      	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:520)
      	at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:498)
      	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:475)
      	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:292)
      	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:727)
      	at groovy.lang.GroovyShell.run(GroovyShell.java:512)
      	at groovy.lang.GroovyShell.run(GroovyShell.java:170)
      	at groovy.lang.GroovyShell$run$1.call(Unknown Source)
      	at groovy.ui.Console$_runScriptImpl_closure16.doCall(Console.groovy:848)
      	at sun.reflect.GeneratedMethodAccessor423.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:151)
      	at groovy.ui.Console$_runScriptImpl_closure16.doCall(Console.groovy)
      	at sun.reflect.GeneratedMethodAccessor422.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:88)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:272)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:886)
      	at groovy.lang.Closure.call(Closure.java:276)
      	at groovy.lang.Closure.call(Closure.java:271)
      	at groovy.lang.Closure.run(Closure.java:354)
      	at java.lang.Thread.run(Thread.java:637)
      

      Attachments

        Issue Links

          Activity

            People

              pniederw Peter Niederwieser
              pniederw Peter Niederwieser
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: