Groovy
  1. Groovy
  2. GROOVY-5180

Enum Comparison results in incorrect map behavior when using add assignment operator

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.8.2
    • Fix Version/s: 1.8.4
    • Component/s: Compiler
    • Labels:
      None
    • Environment:
      java version "1.6.0_23"
      OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10)
      OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

      Groovy Version: 1.8.2 JVM: 1.6.0_23

      Description

      In the attached test case you will see four methods which do the same three things. Each initializes a map, increments a value in the map, and then returns the map. The method called "works()" uses the add assignment operator to do this. The "buggy()" method is the same, but adds an enum comparison.

      There is some interaction between the enum comparison and the += operator. The method "numericComparison()" is just like "buggy()," but performs an integer comparison. The "workaround()" method avoids the += operator. Both of these methods return a Map as expected.

        Activity

        David Clark created issue -
        Paul King made changes -
        Field Original Value New Value
        Affects Version/s 1.8.4 [ 17852 ]
        Paul King made changes -
        Environment java version "1.6.0_23"
        OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10)
        OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

        Groovy Version: 1.8.4 JVM: 1.6.0_23
        java version "1.6.0_23"
        OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10)
        OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

        Groovy Version: 1.8.2 JVM: 1.6.0_23
        Guillaume Delcroix made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Fix Version/s 1.8.4 [ 17852 ]
        Resolution Fixed [ 1 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12734104 ] Default workflow, editable Closed status [ 12745913 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12971631 ] Default workflow, editable Closed status [ 12979466 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            David Clark
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development