Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.5.6
    • Fix Version/s: 1.6-rc-1, 1.5.8, 1.7-beta-1
    • Component/s: None
    • Labels:
      None

      Description

      GStrings show surprising behaviour when used as keys in collections or in comparisons. This lead to a lot of issues, e.g. (GROOVY-626, GROOVY-2332, GROOVY-2330, GROOVY-951, GROOVY-2660, GROOVY-1959). The situation is even worse with lazy evaluation of closures in GStrings (see attached script).

      So either

      Document that the user should

      • use GString#toString() instead of putting GString (as a key) into a collection, and
      • use GString#toString() instead of GString in comparisons with a String.

      Or

      Coerce arguments that are instanceof GString to String if the receiving parameter's type is not GString or a type derived from GString.

      I would prefer 1. over 2.

        Activity

        Alexander Veit created issue -
        Jochen Theodorou made changes -
        Field Original Value New Value
        Issue Type Bug [ 1 ] Improvement [ 4 ]
        Priority Critical [ 2 ] Major [ 3 ]
        Jochen Theodorou made changes -
        Fix Version/s 1.7 [ 14014 ]
        Fix Version/s 1.6-rc-1 [ 14009 ]
        Fix Version/s 1.5.8 [ 14630 ]
        Jochen Theodorou made changes -
        Assignee Guillaume Laforge [ guillaume ]
        Guillaume Delcroix made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12732006 ] Default workflow, editable Closed status [ 12743877 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12969956 ] Default workflow, editable Closed status [ 12977717 ]

          People

          • Assignee:
            Guillaume Delcroix
            Reporter:
            Alexander Veit
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development