On Thu, 7 May 2026 12:30:27 GMT, Per Minborg <[email protected]> wrote:

>> Implement JEP 531: Lazy Constants (Third Preview)
>> 
>> This PR replaces _draft_ https://github.com/openjdk/jdk/pull/29507
>> 
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Per Minborg has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Improve docs for Set::ofLazy

I was looking into the possibility to reimplement some code in the jdk using 
LazyConstant, and then I found this new addition:
> * If evaluation of the computing function throws an unchecked exception 
> (i.e., a runtime
>  * exception or an error), the lazy constant is not initialized but instead 
> transitions to
>  * an error state whereafter a {@linkplain NoSuchElementException} is thrown 
> with the
>  * unchecked exception as a cause. Subsequent {@linkplain #get() get()} calls 
> throw
>  * {@linkplain NoSuchElementException} (without ever invoking the computing 
> function
>  * again) with no cause and with a message that includes the name of the 
> original
>  * unchecked exception's class.

Seems we will live with DCL forever....

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

PR Comment: https://git.openjdk.org/jdk/pull/30194#issuecomment-4940040385

Reply via email to