RFR: 8357797: Use StructuredTaskScopeImpl.ST_NEW for state init [v2]

Aleksey Shipilev shade at openjdk.org
Mon May 26 17:17:30 UTC 2025


On Mon, 26 May 2025 16:46:49 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Aleksey Shipilev has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Move to the end
>
> src/java.base/share/classes/java/util/concurrent/StructuredTaskScopeImpl.java line 70:
> 
>> 68:         this.joiner = joiner;
>> 69:         this.threadFactory = threadFactory;
>> 70:         this.flock = ThreadFlock.open((name != null) ? name : Objects.toIdentityString(this));
> 
> Unnecessary but okay. Do you mind moving it to the end of constructor as the fields are initialized in order declaration order in this constructor.

Yeah, explicit use of `ST_NEW` avoids future accidents, e.g. if we ever introduce a new state that would have to shuffle states around. Moved to the end of constructor now.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25452#discussion_r2107669807


More information about the core-libs-dev mailing list