On Fri, 10 Jul 2026 17:06:55 GMT, Joe Darcy <[email protected]> wrote:
>> src/java.base/share/classes/java/lang/ref/SoftReference.java line 93: >> >>> 91: * >>> 92: * @param referent object the new soft reference will refer to >>> 93: * @throws IdentityException if the referent is not an >> >> IIRC, there was discussion recently that at least some of the >> `java.lang.ref` classes accept `null` as a valid argument for the referent. >> If so, the "not an identity object" wording should be changed to "not an >> identity object or null" or similar. > > PS The bug in question > [JDK-8386811](https://bugs.openjdk.org/browse/JDK-8386811): "Specify the > behaviour of java.lang.ref.Reference types when constructed with a null > referent". The specification of `Objects#hasIdentity(Object)`, which is being linked here from the throws clause, states: > <p>This method returns {@code false} if and only if the parameter is {@code > null} or ... So I think it implicitly covers the `null` part and this throws clause description maybe OK in its current form. This is similar to what I accepted for a different review here https://git.openjdk.org/jdk/pull/31123#discussion_r3557680258 ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31123#discussion_r3560712723
