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

Misleading description of arguments to accumulator function called by LongAccumulator

XMLWordPrintable

      A DESCRIPTION OF THE PROBLEM :
      The documentation says:
      'The function is applied with the current value as its first argument, and the given update as the second argument."
      This is not true, since the function may actually be called with two "update values".
      E.g. if two values, u1 and u2, are added, then according to that description, the result could be f(f(identity, u1), u2) or it could be f(f(identity, u2), u1), given that order of applying values are not guaranteed.
      However, it's been observed that result was calculated as f(identity, f(u1, u2)), which is in contradiction with the statement made in the documentation.


      URL OF FAULTY DOCUMENTATION :
      https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/LongAccumulator.html

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

              Created:
              Updated:
              Resolved: