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

groovyc produces AIOOBE if @TypeChecked used with @CompileStatic in certain circumstances

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.1
    • 2.0.2
    • Static compilation
    • None

    Description

      Simple source code to reproduce the problem

      SampleClass.groovy
      import groovy.transform.CompileStatic
      import groovy.transform.TypeChecked
      
      @TypeChecked
      @CompileStatic
      class SampleClass {
      	def a = "some string"
      	def b = a.toString()
      }
      
      $ groovyc SampleClass.groovy
      

      Produces java.lang.ArrayIndexOutOfBoundsException (attached full trace).

      It's enough to reorder the annotations and all works fine:

      SampleClass.groovy
      import groovy.transform.CompileStatic
      import groovy.transform.TypeChecked
      
      @CompileStatic
      @TypeChecked
      class SampleClass {
      	def a = "some string"
      	def b = a.toString()
      }
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            imi imivai
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: