RFR: 8356255: Add Stable Field Updaters to allow efficient lazy field evaluations [v10]
David Beaumont
duke at openjdk.org
Thu May 8 15:31:06 UTC 2025
On Thu, 8 May 2025 13:16:25 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 composition of functions and MHs
test/jdk/java/lang/StableValue/StableFieldUpdaterExampleTest.java line 120:
> 118:
> 119: private static final ToIntFunction<LazyFoo> HASH_UPDATER =
> 120: StableFieldUpdater.ofInt(LazyFoo.class, "hash",
Very clean now.
test/jdk/java/lang/StableValue/StableFieldUpdaterExampleTest.java line 183:
> 181: static
> 182:
> 183: public final class MhFoo {
I'm assuming this is explicitly the "behind the scenes" raw version of it in case anyone want's to step off the well-lit path. Hard to comment without seeing any surrounding docs. I don't suppose a link to the docs in which these are given can be added (just to give context for future maintainers)?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25040#discussion_r2079941869
PR Review Comment: https://git.openjdk.org/jdk/pull/25040#discussion_r2079953010
More information about the net-dev
mailing list