mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8280168: Add Objects.toIdentityString
Reviewed-by: alanb, mchung, rriggs, smarks
This commit is contained in:
parent
f4575e4052
commit
cbe8395ace
3 changed files with 60 additions and 5 deletions
|
@ -292,7 +292,7 @@ public class MethodHandleProxies {
|
|||
private static Object callObjectMethod(Object self, Method m, Object[] args) {
|
||||
assert(isObjectMethod(m)) : m;
|
||||
return switch (m.getName()) {
|
||||
case "toString" -> self.getClass().getName() + "@" + Integer.toHexString(self.hashCode());
|
||||
case "toString" -> java.util.Objects.toIdentityString(self);
|
||||
case "hashCode" -> System.identityHashCode(self);
|
||||
case "equals" -> (self == args[0]);
|
||||
default -> null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue