On Tue, 1 Dec 2026 00:58:53 GMT, Dan Smith <[email protected]> wrote:

> The primary enhancement here is a more fleshed-out discussion about value 
> objects, and particularly their interaction with `==`, in the 
> `java.lang.Object` javadoc.
> 
> Then I've done some cleanup of links, directing discussion about "value 
> objects" to `Object##value-objects`, "indistinguishable" to 
> `Object##comparing-objects`. In some situations, it's more appropriate to 
> link "has identity" to `Objects##hasIdentity` and "value class" to 
> `Class#isValue`, but I've reduced reliance on those.
> 
> ---------
> - [X] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

src/java.base/share/classes/java/lang/Object.java line 222:

> 220:      * {@code y}, this method returns {@code true} if and only
> 221:      * if {@code x == y} ({@code x} and {@code y} refer to
> 222:      * {@linkplain ##comparing-objects indistinguishable} objects).

I'd be okay keeping the old text that talked about "the same identity object" 
here, but somewhat prefer to use the "indistinguishable" term for all objects, 
as we defined it earlier.

"Has only a single element" is a controversial thing to say, depending on how 
you define your universe of elements, and I think it's distracting to try to 
dig into that. We already said this is "the most discriminating possible 
equivalence relation on objects", that expresses the same idea without getting 
into a debate about whether two indistinguishable objects are still distinct 
objects.

src/java.base/share/classes/java/lang/Record.java line 75:

> 73:  *          an abstract {@linkplain Class#isValue value class}.
> 74:  *          Subclasses of {@code Record} can be either identity classes
> 75:  *          or value classes.

We just linked to this two lines ago, don't need to do it again.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/34140#discussion_r4747787241
PR Review Comment: https://git.openjdk.org/jdk/pull/34140#discussion_r4747811131

Reply via email to