On Fri, Jan 20, 2017 at 7:58 AM, Paul Sandoz <[email protected]> wrote:
>
> I was surprised to see below a change in parentheses that seems to change
> the behavior.
>
> final long nextSeed() {
> Thread t; long r; // read and update per-thread seed
> - SEED.set(t = Thread.currentThread(),
> - (r = (long) SEED.get(t)) + GAMMA);
> + U.putLong(t = Thread.currentThread(), SEED,
> + r = U.getLong(t, SEED) + GAMMA);
> return r;
> }
>
>
> The update reverted to the previous code:
>
> http://hg.openjdk.java.net/jdk9/dev/jdk/file/7901a13a051c/src/java.base/
> share/classes/java/util/concurrent/ThreadLocalRandom.java
>
> I added the parentheses to bound the cast.
>
It still looks to me like the parenthesis got added to the wrong place (in
the previous changeset!), changing the behavior, and the current reverted
code is correct.