RFR: 8351565: Implement JEP 502: Stable Values (Preview)
Per-Ake Minborg
per-ake.minborg at oracle.com
Thu Apr 3 11:20:37 UTC 2025
Hi Remi and thank you for the feedback from JChateau (what a wonderful name!).
This is one of the issues we already have on the list for the next round of preview. Now we know more folks are on the same page.
Best, Per
________________________________
From: Remi Forax <forax at univ-mlv.fr>
Sent: Wednesday, April 2, 2025 4:33 PM
To: Per Minborg <pminborg at openjdk.org>
Cc: compiler-dev <compiler-dev at openjdk.org>; core-libs-dev <core-libs-dev at openjdk.org>; hotspot-dev <hotspot-dev at openjdk.org>; security-dev <security-dev at openjdk.org>
Subject: Re: RFR: 8351565: Implement JEP 502: Stable Values (Preview)
Hi Per,
last week, at JChateau, we had a one hour session about stable values, I've build the JDK with this PR so we can discuss about it.
To present the API, i start from the double check locking, rewriting it to use the StableValue API.
The main remark was that methods like orElseSet() or isSet() are hard to used correctly.
In my opinion, the current API is a mix of a high level API and a low-level API but it's too easy to misuse the low-level API.
high level:
- methods supplier(), list() and map()
Those are easy to use
low level:
- methods: of, of(value), orElseSet, setOrThrow(), etc
Those are hard to use properly.
I think, not necessary in this PR, that the current API should be separated into two different classes, one in java.lang with the high level API (the static methods other than Of() and one in java.util.concurrent with the low level API where you have to know what you are doing (like with any classes of java.util.concurrent).
regards,
Rémi
----- Original Message -----
> From: "Per Minborg" <pminborg at openjdk.org>
> To: "compiler-dev" <compiler-dev at openjdk.org>, "core-libs-dev" <core-libs-dev at openjdk.org>, "hotspot-dev"
> <hotspot-dev at openjdk.org>, "security-dev" <security-dev at openjdk.org>
> Sent: Thursday, March 13, 2025 12:20:10 PM
> Subject: RFR: 8351565: Implement JEP 502: Stable Values (Preview)
> Implement JEP 502.
>
> The PR passes tier1-tier3 tests.
>
> -------------
>
> Commit messages:
> - Use acquire semantics for reading rather than volatile semantics
> - Add missing null check
> - Simplify handling of sentinel, wrap, and unwrap
> - Fix JavaDoc issues
> - Fix members in StableEnumFunction
> - Address some comments in the PR
> - Merge branch 'master' into implement-jep502
> - Revert change
> - Fix copyright issues
> - Update JEP number
> - ... and 231 more: https://git.openjdk.org/jdk/compare/4cf63160...09ca44e6
>
> Changes: https://git.openjdk.org/jdk/pull/23972/files
> Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23972&range=00
> Issue: https://bugs.openjdk.org/browse/JDK-8351565
> Stats: 3980 lines in 30 files changed: 3949 ins; 18 del; 13 mod
> Patch: https://git.openjdk.org/jdk/pull/23972.diff
> Fetch: git fetch https://git.openjdk.org/jdk.git pull/23972/head:pull/23972
>
> PR: https://git.openjdk.org/jdk/pull/23972
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250403/e71912f4/attachment.htm>
More information about the core-libs-dev
mailing list