mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8277672: Better invocation handler handling
Reviewed-by: skoivu, mchung, rhalade
This commit is contained in:
parent
9ce2d75d0b
commit
ee0743801e
1 changed files with 11 additions and 2 deletions
|
@ -666,8 +666,8 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
|
|||
if (!(memberType.isInstance(value) ||
|
||||
value instanceof ExceptionProxy)) {
|
||||
value = new AnnotationTypeMismatchExceptionProxy(
|
||||
value.getClass() + "[" + value + "]").setMember(
|
||||
annotationType.members().get(name));
|
||||
objectToString(value))
|
||||
.setMember(annotationType.members().get(name));
|
||||
}
|
||||
}
|
||||
mv.put(name, value);
|
||||
|
@ -677,6 +677,15 @@ 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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue