RFR: 8351565: Implement JEP 502: Stable Values (Preview)

Per Minborg pminborg at openjdk.org
Thu Mar 13 11:20:13 UTC 2025


On Tue, 11 Mar 2025 01:20:16 GMT, Johannes Graham <duke at openjdk.org> wrote:

>> Implement JEP 502.
>> 
>> The PR passes tier1-tier3 tests.
>
> src/java.base/share/classes/java/util/ImmutableCollections.java line 772:
> 
>> 770: 
>> 771:     @jdk.internal.ValueBased
>> 772:     static final class StableList<E> extends AbstractImmutableList<E> {
> 
> Is there significant reuse gained by putting StableList in ImmutableCollection? The back-and-forth between here and SV through SharedSecrets is a little awkward.

This allows reuse of `AbstractImmutableList` with list iterators, sub lists and more.

> src/java.base/share/classes/java/util/ImmutableCollections.java line 1462:
> 
>> 1460: 
>> 1461:     static final class StableMap<K, V>
>> 1462:             extends AbstractImmutableMap<K, V> {
> 
> Same question about whether StableMap needs to go here. Though there’s more stuff going on for maps than lists here.

Same argument as for `StableList`. This allows reuse of several classes including `AbstractImmutableMap`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r1988605709
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r1988607732


More information about the core-libs-dev mailing list