RFR: JDK-8302666: Replace CHM with VarHandle in ForeachOrderedTask [v2]

Viktor Klang duke at openjdk.org
Mon Feb 20 10:51:58 UTC 2023


On Sat, 18 Feb 2023 02:40:01 GMT, ExE Boss <duke at openjdk.org> wrote:

>> 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);

Thanks for having a look at the PR, you're right, the suppression isn't needed.

-------------

PR: https://git.openjdk.org/jdk/pull/12320


More information about the core-libs-dev mailing list