On Thu, 3 Apr 2025 08:39:47 GMT, Per Minborg <[email protected]> wrote:
>> src/java.base/share/classes/java/lang/StableValue.java line 377:
>>
>>> 375: *
>>> 376: * <h2 id="thread-safety">Thread Safety</h2>
>>> 377: * The content of a stable value is guaranteed to be set at most once.
>>> If competing
>>
>> Suggestion:
>>
>> * The contents of a stable value is guaranteed to be set at most once. If
>> competing
>
> I think it should be "content" as only one element can be set?
I'm definitely not an expert here, so I'll defer to someone more knowledgable :)
>> src/java.base/share/classes/java/lang/StableValue.java line 384:
>>
>>> 382: * (e.g. {@linkplain #trySet(Object) trySet()})
>>> 383: * {@linkplain java.util.concurrent##MemoryVisibility
>>> <em>happens-before</em>}
>>> 384: * any subsequent read operation (e.g. {@linkplain #orElseThrow()})
>>> that is successful.
>>
>> Suggestion:
>>
>> * any successful read operation (e.g. {@linkplain #orElseThrow()}).
>
> A read operation that is made well before a write operation does mean the
> write operation happens before the read operation so I wanted to capture that
> using the work "subsequent". Did I miss something here?
I just thought it awkward to establish order (happens-before) by using a word
like "subsequent" (which implies order).
>> src/java.base/share/classes/java/lang/StableValue.java line 567:
>>
>>> 565: * <p>
>>> 566: * The provided {@code original} supplier is guaranteed to be
>>> successfully invoked
>>> 567: * at most once even in a multi-threaded environment. Competing
>>> threads invoking the
>>
>> There's a bit of a mix of "at most once" and "at-most-once". I'm fine with
>> either but I prefer uniformity in spelling :)
>
> If "at most once" is an adjective then it should be spelled with dashes,
> otherwise not.
>
> "The method can be invoked at most once and hence It is an
> invoke-at-most-once method"
That sounds fair! 👍
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2026617309
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2026619405
PR Review Comment: https://git.openjdk.org/jdk/pull/23972#discussion_r2026620361