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

non-atomic "bulk" ops note in class javadoc for ConcurrentLinkedQueue, ConcurrentLinkedDeque, & LinkedTransferQueue shouldn't include equals

    XMLWordPrintable

Details

    Description

      FULL PRODUCT VERSION :
      java version "1.8.0_92"
      Java(TM) SE Runtime Environment (build 1.8.0_92-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.92-b14, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      Darwin Ians-iMac.local 15.5.0 Darwin Kernel Version 15.5.0: Tue Apr 19 18:36:36 PDT 2016; root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      For https://bugs.openjdk.java.net/browse/JDK-7038885, the following note was added to the class-level javadoc of ConcurrentLinkedDeque, ConcurrentLinkedQueue, ConcurrentSkipListMap, ConcurrentSkipListSet, and LinkedTransferQueue:

      of elements requires a traversal of the elements, and so may report
      inaccurate results if this collection is modified during traversal.
      Additionally, the bulk operations <tt>addAll</tt>,
      <tt>removeAll</tt>, <tt>retainAll</tt>, <tt>containsAll</tt>,
      <tt>equals</tt>, and <tt>toArray</tt> are <em>not</em> guaranteed
      to be performed atomically. For example, an iterator operating
      concurrently with an <tt>addAll</tt> operation might view only some
      of the added elements.

      However, for ConcurrentLinkedQueue, ConcurrentLinkedDeque, and LinkedTransferQueue, "equals" should not be included in the list of bulk operations, because these three classes do not even override equals (as is the case for all jdk Queue impls that do not also implement List). These three classes inherit Object#equals, which the element traversal note does not apply to (since Object#equals does no traversal). Including "equals" in the list of bulk operations is confusing, because it suggests that these three classes do override equals.


      REGRESSION. Last worked in version 7u76

      ADDITIONAL REGRESSION INFORMATION:
      Java doc in question was introduced in JDK7 b142 (see https://bugs.openjdk.java.net/browse/JDK-7038885).



      REPRODUCIBILITY :
      This bug can be reproduced always.

      Attachments

        Issue Links

          Activity

            People

              martin Martin Buchholz
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: