On Fri, 25 Apr 2025 09:11:43 GMT, Per Minborg <pminb...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/StableValue.java line 389: >> >>> 387: * Invocations of {@link #setOrThrow(Object)} form a total order of >>> zero or more >>> 388: * exceptional invocations followed by zero (if the contents were >>> already set) or one >>> 389: * successful invocation. Since stable functions and stable >>> collections are built on top >> >> How can an exceptional invocation of `setOrThrow` be followed by a >> successful invocation? > > `setOrThrow` might be invoked several times. If the first invocation failed > because the supplier threw and then the second invocation (with the same > supplier) succeded (because there was some state that changed), we have this > situation. `orElseSet` is the method taking a supplier, `setOrThrow` doesn't. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2059875280