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

Tenary operator with @CompileStatic in constructor results in ArrayIndexOutOfBoundsException

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.2
    • 2.3.3, 2.2.3
    • None
    • None

    Description

      Example:

      import groovy.transform.CompileStatic
      
      @CompileStatic
      class GrailsHomeWorkspaceReader {
          GrailsHomeWorkspaceReader(String grailsHome = System.getProperty('grails.home') ?: System.getenv('GRAILS_HOME')) {
          }
      }
      

      Exception:

      java.lang.ArrayIndexOutOfBoundsException: size==0
      	at org.codehaus.groovy.classgen.asm.OperandStack.getTopOperand(OperandStack.java:670)
      	at org.codehaus.groovy.classgen.asm.OperandStack.dup(OperandStack.java:174)
      	at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateElvisOperatorExpression(BinaryExpressionHelper.java:793)
      	at org.codehaus.groovy.classgen.asm.BinaryExpressionHelper.evaluateTernary(BinaryExpressionHelper.java:864)
      	at org.codehaus.groovy.classgen.AsmClassGenerator.visitTernaryExpression(AsmClassGenerator.java:572)
      	at org.codehaus.groovy.ast.CodeVisitorSupport.visitShortTernaryExpression(CodeVisitorSupport.java:154)
      	
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            graemerocher Graeme Rocher
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 20m
                20m