RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v33]

Per Minborg pminborg at openjdk.org
Thu Apr 3 09:18:05 UTC 2025


On Wed, 2 Apr 2025 15:24:47 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Add info that Map#values and Map#entrySet are stable
>
> src/java.base/share/classes/jdk/internal/lang/stable/StableEnumFunction.java line 115:
> 
>> 113: 
>> 114:         final int size = max - min + 1;
>> 115:         final Class<E> enumType = (Class<E>)inputs.iterator().next().getClass();
> 
> I presume there's some external check to ensure that inputs is non-empty?

Yes. If empty, a normal `StableFunction` is provided even though an empty enum set was given.

> src/java.base/share/classes/jdk/internal/lang/stable/StableValueImpl.java line 93:
> 
>> 91:         if (!trySet(content)) {
>> 92:             throw new IllegalStateException("Cannot set the content to " + content +
>> 93:                     " because the content is already set: " + orElseThrow());
> 
> This might be problematic since it could surface confidential information inside exception messages (or even just produce very large strings).

Good comment. Let's remove the content exposure.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2026554049
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2026555389


More information about the core-libs-dev mailing list