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

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Apr 7 09:49:03 UTC 2025


On Thu, 3 Apr 2025 14:26:15 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

>> I don't think we should promise this even though it might be the case.
>
> What is the benefit of not promising it? Promising helps the supplier to have a well-defined order of execution. Furthermore, even if you do not promise it, it is the only possible implementation now and people will depend on it regardless.

I tend to agree with @merykitty - what that guarantee says is that - e.g. you can't have an exceptional call to the supplier (but this holds also for `orElseSet`) _after_ the stable value has been set. I think we already guarantee this implicitly, because we say that the action in `orElseSet` is never executed if the stable value has been set -- which implies that at least a supplier terminated normally (and that must be the last one -- otherwise it would not have executed at all...)

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

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


More information about the core-libs-dev mailing list