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

increment/decrement operations must respect the variable type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • 1.8-beta-3
    • None
    • None

    Description

      def list = [10,20,30]
      Iterator it = list.iterator()
      shouldFail (ClassCastException) {
        it++
      }
      

      In this program the it++ should fail, because the iterator returns a number and a number is no Iterator so it is not assignable to the variable named it of type Iterator. But the compiler ignores the type here and fails to implement the assignment correctly

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            blackdrag Jochen Theodorou
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: