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

ClassCastException Double->Float with -= += operators and closures

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.8.7
    • 1.8.8, 2.0.2
    • None
    • None
    • Ubuntu 12.04, SunJDK 1.6.0_u33 x64, groovy 1.8.7

    Description

      The ClassCastException is thrown only in combination of a -= (or +=) operator and a closure.

       
      void doesNotWork() {
        float myFloat = 40f
        myFloat -= 20f
        println "doesNotWork() $myFloat" // the exception is thrown here, but because of the combination of the -= and the closure
        (0..1).each { i -> // this can be any closure - doesn't matter
          println "doesNotWork() in the closure: $myFloat"
        }
      }
      

      Did not occure with 1.8.3.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            luukes Lukas Ruetz
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: