8280594: Refactor annotation invocation handler handling to use Objects.toIdentityString

Reviewed-by: bpb
This commit is contained in:
Joe Darcy 2022-04-20 16:20:36 +00:00
parent b4a85cdae1
commit e6c5f2886c

@ -666,7 +666,7 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
if (!(memberType.isInstance(value) ||
value instanceof ExceptionProxy)) {
value = new AnnotationTypeMismatchExceptionProxy(
objectToString(value))
Objects.toIdentityString(value))
.setMember(annotationType.members().get(name));
}
}
@ -677,15 +677,6 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
UnsafeAccessor.setMemberValues(this, mv);
}
/*
* Create a textual representation of the argument without calling
* any overridable methods of the argument.
*/
private static String objectToString(Object value) {
return value.getClass().getName() + "@" +
Integer.toHexString(System.identityHashCode(value));
}
private static class UnsafeAccessor {
private static final jdk.internal.misc.Unsafe unsafe
= jdk.internal.misc.Unsafe.getUnsafe();