RFR: 8356080: Address post-integration comments for Stable Values
ExE Boss
duke at openjdk.org
Tue May 6 09:03:34 UTC 2025
On Fri, 2 May 2025 13:56:19 GMT, Shaojin Wen <swen at openjdk.org> wrote:
>> This PR proposes to address comments in the initial PR for Stable Values, which were deferred until after integration.
>>
>> Unfortunately, this PR shows the total commit history for stable values.
>
> src/java.base/share/classes/jdk/internal/lang/stable/StableSupplier.java line 62:
>
>> 60: public String toString() {
>> 61: final Object t = delegate.wrappedContentsAcquire();
>> 62: return t == this ? "(this StableSupplier)" : StableValueImpl.renderWrapped(t);
>
> Suggestion:
>
> return delegate.wrappedContentsAcquire() == this
> ? "(this StableSupplier)"
> : StableValueImpl.renderWrapped(t);
>
> Same as above, simplifying the code by removing local variables that are only used once
The `t` variable is used again in the `else` branch of the ternary operator.
> src/java.base/share/classes/jdk/internal/lang/stable/StableValueImpl.java line 108:
>
>> 106: if (t == null) {
>> 107: throw new NoSuchElementException("No contents set");
>> 108: }
>
> Suggestion:
>
> if (wrappedContentsAcquire() == null) {
> throw new NoSuchElementException("No contents set");
> }
>
> Same as above, simplifying the code by removing local variables that are only used once
`t` is passed to `unwrap` on the next line: <https://github.com/openjdk/jdk/blob/28bfb5c62e30516dcc5cf476ababaf7a3f1f6705/src/java.base/share/classes/jdk/internal/lang/stable/StableValueImpl.java#L104-L110>
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25004#discussion_r2071820465
PR Review Comment: https://git.openjdk.org/jdk/pull/25004#discussion_r2071822154
More information about the core-libs-dev
mailing list