RFR: 8356255: Add Stable Field Updaters to allow efficient lazy field evaluations [v6]
ExE Boss
duke at openjdk.org
Wed May 7 15:10:19 UTC 2025
On Wed, 7 May 2025 14:58:33 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> This sketch shows how "Stable Updaters" can be used to create stable computations of `@Stable` fields. Only one updater is needed per class, similar to `AtomicIntegerFieldUpdater`.
>
> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>
> Add convenience methods and documentations
src/java.base/share/classes/jdk/internal/lang/stable/StableFieldUpdater.java line 257:
> 255: check(accessor, int.class);
> 256: Objects.requireNonNull(underlying);
> 257: var adaptedUnderlying = checkAndAdapt(underlying, int.class);
Suggestion:
// Implicit null checks:
check(accessor, int.class);
var adaptedUnderlying = checkAndAdapt(underlying, int.class);
src/java.base/share/classes/jdk/internal/lang/stable/StableFieldUpdater.java line 311:
> 309: check(accessor, long.class);
> 310: Objects.requireNonNull(underlying);
> 311: var adaptedUnderlying = checkAndAdapt(underlying, long.class);
Suggestion:
// Implicit null checks:
check(accessor, long.class);
var adaptedUnderlying = checkAndAdapt(underlying, long.class);
src/java.base/share/classes/jdk/internal/lang/stable/StableFieldUpdater.java line 588:
> 586:
> 587: private static MethodHandle checkAndAdapt(MethodHandle underlying, Class<?> returnType) {
> 588: final var underlyingType = underlying.type();
Suggestion:
// Implicit null check
final var underlyingType = underlying.type();
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25040#discussion_r2077860284
PR Review Comment: https://git.openjdk.org/jdk/pull/25040#discussion_r2077860770
PR Review Comment: https://git.openjdk.org/jdk/pull/25040#discussion_r2077861275
More information about the net-dev
mailing list