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

CopyOnWriteArrayList subList needs more synchronization

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 9
    • None
    • core-libs
    • None

    Description

      Looking at CopyOnWriteArrayList.COWSubList, I see some methods that should have more synchronization:

      remove(Object o)

      void forEach(Consumer<? super E> action)
       array and indices must be read under lock, although elements themselves can be processed outside of lock!

      Spliterator<E> spliterator()
       Similarly.

      Method add(Object) is inherited from AbstractList, but that implementation has an obvious race:
          public boolean add(E e) {
              add(size(), e);

      Attachments

        Activity

          People

            martin Martin Buchholz
            martin Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: