Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8205502: Make exception message from AnnotationInvocationHandler more informative #3317

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class AnnotationInvocationHandler implements InvocationHandler, Serializable {
if (!type.isAnnotation() ||
superInterfaces.length != 1 ||
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.memberValues = memberValues;
}
Expand Down Expand Up @@ -492,7 +493,9 @@ private void validateAnnotationMethods(Method[] memberMethods) {
* 9.6.1. Annotation Type Elements
*/
boolean valid = true;
Method currentMethod = null;
for(Method method : memberMethods) {
currentMethod = method;
int modifiers = method.getModifiers();
// Skip over methods that may be a static initializer or
// similar construct. A static initializer may be used for
Expand Down Expand Up @@ -575,7 +578,8 @@ private void validateAnnotationMethods(Method[] memberMethods) {
if (valid)
return;
else
throw new AnnotationFormatError("Malformed method on an annotation type");
throw new AnnotationFormatError("Malformed method on an annotation type: " +
currentMethod.toString());
}

/**
Expand Down