On Tue, 1 Dec 2026 01:03:37 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.
>> 
>> Browsable docs build here: 
>> https://cr.openjdk.org/~dlsmith/8389875/8389875-20261130/api/index.html
>> 
>> (Timeline note: this is a doc-only fix, I'm not worried about getting it 
>> integrated before the Dec 3 rampdown deadline.)
>> 
>> ---------
>> - [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.

Maybe not here, but somewhere in the Java SE doc updates for JEP 401 I think it 
would be helpful to explicitly state "With preview enabled, there is a basic 
change to the long-standing object model. The association of `new` with 
distinct memory being allocated no longer holds for value classes, etc."

I think it is preferable to have this flavor of information in the docs 
themselves as well as whatever discussion of such topics occurs in the JEP.

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

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

Reply via email to