[jdk17] RFR: 8269096: Add java.util.Objects.newIdentity method

Mandy Chung mchung at openjdk.java.net
Mon Jun 21 22:40:25 UTC 2021


On Mon, 21 Jun 2021 22:25:49 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

> Add java.util.Objects.newIdentity to supply a unique object with identity.
> This is a replacement code can be used today for the traditional new Object() idiom, which will be deprecated under Project Valhalla.
> Refer to [JEP 401: Primitive Objects (Preview)](https://openjdk.java.net/jeps/401) for background.

Looks okay in general.   It'd be useful for the javadoc of `Object()` constructor to suggest using `Objects::newIdentity` instead of the constructor.

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

PR: https://git.openjdk.java.net/jdk17/pull/112


More information about the core-libs-dev mailing list