I just saw https://openjdk.org/jeps/526
"This API first previewed inJDK 25
<https://openjdk.org/projects/jdk/25/>viaJEP 502: Stable Values
<https://openjdk.org/jeps/502>.
Based on experience and feedback, we here propose to revise and
re-preview the API inJDK 26 <https://openjdk.org/projects/jdk/26/>."
Seems to me we should wait for that to be integrated.
-phil.
On 9/25/25 2:17 PM, Sergey Bylokhov wrote:
On 9/25/25 12:59, Philip Race wrote:
I have no general objection to this.
I would use it where lazy initialization will provide a clear benefit,
but not as a general replacement for final.
I did not even consider using StableValue as the 'super final', only
as a possible way to implement singletons (which we usually do via
double-checked locking, the holder idiom, or sometimes even with
incorrect synchronization).