On Fri, 17 Feb 2023 11:39:21 GMT, Viktor Klang <[email protected]> wrote:
>> I noticed when looking at the code that there was no real need to use a CHM
>> to perform the tracking of activation in an ordered fashion on
>> ForEachOrderedTask, but instead a VarHandle can be used, reducing
>> allocations and indirection.
>
> Viktor Klang has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Write the initial value of the next reference without using the VarHandle
src/java.base/share/classes/java/util/stream/ForEachOps.java line 515:
> 513: //
> 514: @SuppressWarnings("unchecked")
> 515: var leftDescendant = (ForEachOrderedTask<S,
> T>)NEXT.getAndSet(this, null);
I don’t think that this needs a `@SuppressWarnings("unchecked")`, as casts of
signature polymorphic return values don’t emit unchecked warnings (unless that
changed recently):
Suggestion:
var leftDescendant = (ForEachOrderedTask<S, T>)
NEXT.getAndSet(this, (ForEachOrderedTask<S, T>) null);
-------------
PR: https://git.openjdk.org/jdk/pull/12320