RFR: 8351565: Implement JEP 502: Stable Values (Preview) [v25]
Maurizio Cimadamore
mcimadamore at openjdk.org
Wed Apr 2 08:45:34 UTC 2025
On Tue, 1 Apr 2025 13:27:34 GMT, Per Minborg <pminborg at openjdk.org> wrote:
>> Implement JEP 502.
>>
>> The PR passes tier1-tier3 tests.
>
> Per Minborg has updated the pull request incrementally with two additional commits since the last revision:
>
> - Add lazy toSting for StableMap::values
> - Make toString for reversed and sublist lazy
src/java.base/share/classes/java/lang/StableValue.java line 95:
> 93: * <p>
> 94: * Note that the holder value can only be set at most once.
> 95: * In the example above, the {@code logger} field is declared {@code final} which is
This is not 100% true -- a final non-static field is not treated as a constant by the VM (at least not yet). Again, I suggest to keep this discussion focused on the fact that `logger` is a `final` stable value field. The holder is created eagerly, but the _content_ is initialized lazily (in the `getLogger` method). So, same similar to `final` (can only be set once) -- but more flexible.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2024356190
More information about the core-libs-dev
mailing list