On Fri, 17 Jul 2026 02:41:57 GMT, Dan Smith <[email protected]> wrote:

> Some final polishing to align javadocs with the JEP.
> 
> - Main goal is to remove usage of "statewise equivalent", as noted in the 
> title
> - A little bit of general editing in the Object intro, `equals` method, and 
> `clone` method
> - Corrected "the finalize method of a value ~class~ _object_ will never be 
> invoked"
> 
> ---------
> - [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 203:

> 201:      * Creates and returns a copy of this object.  The precise meaning
> 202:      * of "copy" may depend on the class of the object. The general
> 203:      * intent is that, for any object {@code x}, the expression:

I started here: identity object clones should usually be !=, value object 
clones should usually be ==.

But then I read "It should be rare for new classes to implement the Cloneable 
interface", and I realized that _most_ value classes that implement `Cloneable` 
will do so because they need to clone a nested identity object. In that 
scenario, it will still be the case the `x.clone() != x`.

So I adjusted to _acknowledge_ the possibility of `==` value object clones 
without presenting it as typical.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2651#discussion_r3600045523

Reply via email to