RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

Viktor Klang vklang at openjdk.org
Wed Nov 8 19:34:07 UTC 2023


On Wed, 8 Nov 2023 17:56:09 GMT, Rémi Forax <forax at openjdk.org> wrote:

>> This Pull-Request implements [JEP-461](https://openjdk.org/jeps/461)
>
> src/java.base/share/classes/java/util/stream/GathererOp.java line 448:
> 
>> 446:             private final long targetSize;
>> 447:             private final Hybrid leftPredecessor;
>> 448:             private final AtomicBoolean cancelled;
> 
> It could be a volatile boolean and a comment is needed saying this field is only be accessed if greedy is true. And inside the constructors this should be the last field of the constructor to be initialized

No, unfortunately it can't be a volatile boolean since it is a shared instance amongst a hierarchy.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1387107205


More information about the core-libs-dev mailing list