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

comparison with Integer.MIN_VALUE behaves incorrectly

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-beta-5
    • 1.0-beta-6
    • None
    • None
    • Windows XP

    Description

      Comparisons with Integer.MAX_VALUE work correctly; comparisons with Integer.MIN_VALUE do not. Consider:

      println "8 < MAX_VALUE direct: " + (8 < Integer.MAX_VALUE)
      hi = Integer.MAX_VALUE
      println "8 < MAX_VALUE indirect: " + (8 < hi)

      println "8 > MIN_VALUE direct: " + (8 > Integer.MIN_VALUE)
      hi = Integer.MIN_VALUE
      println "8 > MIN_VALUE indirect: " + (8 > hi)

      The output is:

      8 < MAX_VALUE direct: true
      8 < MAX_VALUE indirect: true
      8 > MIN_VALUE direct: false
      8 > MIN_VALUE indirect: false

      (Note: there's nothing special about the value '8'...

      Attachments

        Activity

          People

            goetze Steve Goetze
            gvwilson Greg Wilson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: