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

inconsistent stack height error combining @CompileStatic and chained spread-based invocations

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.4
    • 2.3.7
    • None
    • None

    Description

      Combining a chain of spread-based calls in a method marked as CompileStatic seems to generate that won't pass verification.

      package bug
      
      import groovy.transform.CompileStatic
      
      class Main2 {
          @CompileStatic
          static void main(String[] args) {
              def List<File> files = []
              def urls = files*.toURI()*.toURL()
              println "OK!"
          }
      }
      
      Main2.main()
      
      

      The code above fails with:

      Caught: java.lang.VerifyError: (class: bug/Main2, method: main signature: ([Ljava/lang/String;)V) Inconsistent stack hei
      ght 3 != 2
      java.lang.VerifyError: (class: bug/Main2, method: main signature: ([Ljava/lang/String;)V) Inconsistent stack height 3 !=
       2
      	at bug.test2.run(test2.groovy:14)
      
      

      Removing the second use of the spread operator, or replacing any of the occurrences with a use of collect works around the issue.

      Attachments

        Activity

          People

            melix Cédric Champeau
            chaves Rafael Chaves
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: