RFR: 8360884: Better scoped values [v4]
ExE Boss
duke at openjdk.org
Wed Jul 2 06:35:41 UTC 2025
On Tue, 1 Jul 2025 15:41:45 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Andrew Haley has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - 8360884: Better scoped values
>> - 8360884: Better scoped values
>
> src/java.base/share/classes/java/lang/ScopedValue.java line 534:
>
>> 532:
>> 533: private ScopedValue() {
>> 534: this.hash = hashGenerator != null ? hashGenerator.getAsInt() : generateKey();
>
> The updated version looks much better. It might just a bit clearer to read hashGenerator once here (it doesn't matter of course but stable fields tend to attract a lot of questions).
Something like this?
Suggestion:
final IntSupplier hashGen = hashGenerator;
this.hash = hashGen != null ? hashGen.getAsInt() : generateKey();
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26019#discussion_r2179229055
More information about the core-libs-dev
mailing list