On Tue, 30 Jun 2026 07:13:11 GMT, Jaikiran Pai <[email protected]> wrote:
>> Updates to java.lang.Object API docs: >> >> - Improve preview-comment in class description that defines value class and >> value object >> - Update spec for the finalize method to make it clear when finalize method >> of a value class is never invoked by the garbage collector >> - Update the implSpec for the clone to specify behavior of Object.clone for >> value objects. Also add paragraph to method description for value objects, >> and add API note to advise using copy constructors or static factory methods >> instead >> - Improve preview-comment in wait/notify methods and drop confusing addition >> to IMSE exception >> >> A sanity test is added, this depends on the fix to finalizer registration in >> pull/2589. >> >> --------- >> - [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 40: > >> 38: * When preview features are enabled, subclasses of {@code >> java.lang.Object} >> 39: * are either {@linkplain Class#isValue value classes} or >> identity classes. >> 40: * A <em>value object</em> is an instance of a non-abstract >> value class. All > > Hello Alan, in several other places in the other JDK, we seem to refer to > such classes as concrete value class. Should we do the same here instead of > saying non-abstract value class? Defining a value object as an instance of non-abstract value classes works here, it's similar to the wording in the changes for the JLS. > src/java.base/share/classes/java/lang/Object.java line 260: > >> 258: * <p> >> 259: * For a value object, this method returns an object that is >> indistinguishable >> 260: * from the original. > > Given that statewise equivalence term is defined in the JLS, should we > instead say "... returns an object that is statewise equivalent to the > original"? Yes, that might be more precise (the JEP uses "indistinguishable" the JLS uses "statewise-equivalent"). ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2588#discussion_r3497066318 PR Review Comment: https://git.openjdk.org/valhalla/pull/2588#discussion_r3497070006
