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

Increment operators with @CompileStatic

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.0.5
    • 2.0.6
    • None
    • None
    • Windows 7 64bit

    Description

      Assume we have the script:

      import groovy.transform.CompileStatic
      import groovy.transform.TypeChecked
      
      @CompileStatic
      //@TypeChecked
      int incInt(int n) {
          def result = n
          ++result
          result++
          return result
      }
      assert  incInt(5) == 7,"Must be 7 but we have 5"
      

      Increment operations not execute when @CompileStatic and a local variable is not explicitly typed.

      Attachments

        1. MyGroovyScript.groovy
          0.2 kB
          Valery Shyshkin

        Activity

          People

            melix Cédric Champeau
            vns Valery Shyshkin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: