RFR: 8351565: Implement JEP 502: Stable Values (Preview)
Per Minborg
pminborg at openjdk.org
Thu Mar 13 11:20:14 UTC 2025
On Tue, 11 Mar 2025 00:40:31 GMT, Johannes Graham <duke at openjdk.org> wrote:
>> Indeed, a bit set predicate can be used to check input validity if it is necessary - I think for enums, using a `StableFunction.ofEnum` dedicated API might be better just because `StableValue` can access `Class.getEnumConstantsShared` easily.
>
> What if instead you had a `@Stable` array of Object of the appropriate size, and populated each cell with a StableValue if the corresponding index was in the set, otherwise used a sentinel value. Then on the lookup, if it was the sentinel you throw, else you use the the SV.
>
> Also there is an awful lot of similarity between the enum function and the int function. Could one possibly be implemented using the other?
Thanks for spotting this glitch. I have fixed the issue and added a test for member sets with "holes".
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r1988707099
More information about the core-libs-dev
mailing list