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

java.util.concurrent.AtomicBoolean.compareAndSet doc conflict

XMLWordPrintable



      Name: vsR10316 Date: 06/07/2004


      Filed By : SPB JCK team (###@###.###)
      JDK :
      JCK : 1.5
      Platform[s] : Solaris
      switch/Mode :
      JCK test owner : http://javaweb.eng/jct/sqe/JCK-tck/usr/owners.jto
      Failing Test [s] : N/A


      Specification excerpt:
      ======================
      --------- J2SE API spec v.1.5 ---------
      ...
      public final boolean compareAndSet(boolean expect,
                                         boolean update)

          Atomically sets the value to the given update value if the current value is equal to the expected value. Any given invocation of this operation may fail (return false) spuriously, but repeated invocation when the current value holds the expected value and no other thread is also attempting to set the value will eventually succeed.


      public boolean weakCompareAndSet(boolean expect,
                                       boolean update)

          Atomically set the value to the given updated value if the current value == the expected value. May fail spuriously.
      ...
      ---------- end-of-excerpt ---------------

      Problem description
      ===================
      The specification for method "compareAndSet" contains sentence that seems to be applicable to "weakComapareAndSet" not to this method:

      "Any given invocation of this operation may fail (return false) spuriously, but repeated invocation when the current value holds the expected value and no other thread is also attempting to set the value will eventually succeed."

      Seems like specifications for these methods should be replaced by each other.

      JCK test source location:
      ==========================
      /java/re/jck/1.5/promoted/latest/JCK-runtime-15/tests
          
      ======================================================================

      Name: acR10002 Date: 06/07/2004

      Descriptions shouldn't be replaced. The ambiguous sentence should be simply removed from "compareAndSet" method description.

      ======================================================================

            martin Martin Buchholz
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: