Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5066785

Spec for ConcurrentModificationException does not admit snapshot iterators

XMLWordPrintable

    • b58
    • generic
    • generic

      The spec for ConcurrentModificationException says:

        "Some Iterator implementations (including those of all the collection
        implementations provided by the JRE) may choose to throw this exception
        if this behavior is detected"

      However, several new collections ((EnumSet, CopyOnWriteArrayList, CopyOnWriteArraySet) have "snapshot iterators" that do not throw ConcurrentModificationException under these circumstances. Thus, we should add some "wiggle words" to the above spec. Suggested change:


        "Some Iterator implementations (including those of all the *general purpose*
        collection implementations provided by the JRE) may choose to throw this
        exception if this behavior is detected"

      (The asterisks denote added prose, not emphasis; they should not be present
      in the documentation.)

            darcy Joe Darcy
            jjb Josh Bloch
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: