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

@Immutable collection members are apparently mutable (sometimes?)

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.6, 2.0.5
    • Fix Version/s: 2.2.2
    • Component/s: xforms
    • Labels:
      None
    • Environment:
      Ubuntu Precise
      Groovy Version: 1.8.6 JVM: 1.6.0_27 Vendor: Sun Microsystems Inc. OS: Linux
      Groovy Version: 2.0.5 JVM: 1.7.0_25 Vendor: Oracle Corporation OS: Linux

      Description

      Given these classes:

      @Immutable class X

      { Collection c = [] }

      @Immutable class Y

      { Collection c = []; int foo = 1 }

      I get this behaviour:

      x = new X(null); x.c << 1; // UnsupportedOperationException
      y= new Y(null); y.c << 1; // Success !?
      println y; // Y([1], 0)

      See also the discussion with the same subject on the mailing list.

        Attachments

          Activity

            People

            • Assignee:
              paulk Paul King
              Reporter:
              wu-lee Nick Stokoe
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: