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

@CompileStatic does not support empty ranges properly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.9, 2.2.1
    • 2.2.2
    • Static compilation
    • None

    Description

      In the following script, the empty range is apparently treated as a slice of size 1:

      testMethod()
      
      @groovy.transform.CompileStatic
      def testMethod() {
          def list = ["1", "2", "3", "4"]
      
          assert list[0..<0] == []
          println list
      }
      

      If you remove the annotation, the assertion passes.

      Attachments

        Issue Links

          Activity

            People

              melix Cédric Champeau
              pledbrook Peter Ledbrook
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: