RFR: 8366178: Implement JEP 526: Lazy Constants (Second Preview) [v28]
Per Minborg
pminborg at openjdk.org
Mon Nov 17 13:34:30 UTC 2025
On Mon, 17 Nov 2025 12:16:52 GMT, David Beaumont <duke at openjdk.org> wrote:
>> Per Minborg has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix typo
>
> src/java.base/share/classes/java/nio/charset/Charset.java line 1:
>
>> 1: /*
>
> Side note: I'm slightly surprised to see the introduction and the usage happening in the same PR. Is this really being submitting in one go?
I've replaced `StableValue` with `LazyConstant`. So there is no new introduction, but just an adaptation.
> src/java.base/share/classes/java/nio/charset/Charset.java line 619:
>
>> 617:
>> 618: private static final LazyConstant<Charset> defaultCharset = LazyConstant.of(
>> 619: new Supplier<>() { public Charset get() { return defaultCharset0(); }});
>
> Can these not be done with lambdas?
They can, but I wanted to keep it verbatim to the existing code.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27605#discussion_r2534085547
PR Review Comment: https://git.openjdk.org/jdk/pull/27605#discussion_r2534087249
More information about the nio-dev
mailing list