mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8205502: Make exception message from AnnotationInvocationHandler more informative
Reviewed-by: bpb, naoto, iris
This commit is contained in:
parent
5e59d28def
commit
66d9961cbd
1 changed files with 6 additions and 2 deletions
|
@ -52,7 +52,8 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
|
||||||
if (!type.isAnnotation() ||
|
if (!type.isAnnotation() ||
|
||||||
superInterfaces.length != 1 ||
|
superInterfaces.length != 1 ||
|
||||||
superInterfaces[0] != java.lang.annotation.Annotation.class)
|
superInterfaces[0] != java.lang.annotation.Annotation.class)
|
||||||
throw new AnnotationFormatError("Attempt to create proxy for a non-annotation type.");
|
throw new AnnotationFormatError("Attempt to create proxy for a non-annotation type: " +
|
||||||
|
type.getName());
|
||||||
this.type = type;
|
this.type = type;
|
||||||
this.memberValues = memberValues;
|
this.memberValues = memberValues;
|
||||||
}
|
}
|
||||||
|
@ -492,7 +493,9 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
|
||||||
* 9.6.1. Annotation Type Elements
|
* 9.6.1. Annotation Type Elements
|
||||||
*/
|
*/
|
||||||
boolean valid = true;
|
boolean valid = true;
|
||||||
|
Method currentMethod = null;
|
||||||
for(Method method : memberMethods) {
|
for(Method method : memberMethods) {
|
||||||
|
currentMethod = method;
|
||||||
int modifiers = method.getModifiers();
|
int modifiers = method.getModifiers();
|
||||||
// Skip over methods that may be a static initializer or
|
// Skip over methods that may be a static initializer or
|
||||||
// similar construct. A static initializer may be used for
|
// similar construct. A static initializer may be used for
|
||||||
|
@ -575,7 +578,8 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
|
||||||
if (valid)
|
if (valid)
|
||||||
return;
|
return;
|
||||||
else
|
else
|
||||||
throw new AnnotationFormatError("Malformed method on an annotation type");
|
throw new AnnotationFormatError("Malformed method on an annotation type: " +
|
||||||
|
currentMethod.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue