RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v27]
Per Minborg
pminborg at openjdk.org
Wed Apr 2 12:05:08 UTC 2025
On Wed, 2 Apr 2025 11:42:03 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/StableValue.java line 209:
>>
>>> 207: * private SqrtUtil(){}
>>> 208: *
>>> 209: * private static final Set<Integer> CACHED_KEYS = Set.of(1, 2, 4, 8, 16, 32);
>>
>> This is not the same as before, is it? E.g. in the previous example, we had cached results for `0 <= input < CACHED_SIZE`. But here we hand-pick some values for which we know the square root is also an int. I think the two example should be the same, so as to attract attention on how stable int function vs. stable function works...
>
> The same discrepancy is present in the list vs. map examples
There are two fundamental variants. One with `CACHED_SIZE` (for list and int function) and one with `CACHED_KEYS` (for map and function).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2024679612
More information about the core-libs-dev
mailing list