Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8294312

[lworld] Add java.util.Objects.isIdentityObject

XMLWordPrintable

      A method is needed to identity identity object instances.
      Using `o.getClass().isIdentity` is insufficient in the case of java.lang.Object.
      Object.class is a special case that is neither a identity class or a value class.
      But an instance of java.lang.Object is an identity object.

      Adding a final instance method to Object is convenient but pollutes the method name space of all classes and may be a compatibility issue for some class somewhere.

      A static `Object.isIdentityObject(o)` method would not raise compatibility issues but is not the most natural to supply the result.

      `java.lang.System.isIdentityObject(o)` was also suggested. System.identityHashCode is there too.

            rriggs Roger Riggs
            rriggs Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: