Polishing

(cherry picked from commit 27c2e8c)
This commit is contained in:
Juergen Hoeller
2015-12-29 21:40:20 +01:00
parent acecda7153
commit 342d760f70
9 changed files with 72 additions and 57 deletions

View File

@@ -60,6 +60,7 @@ class SynthesizedAnnotationInvocationHandler implements InvocationHandler {
this.attributeExtractor = attributeExtractor;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (isEqualsMethod(method)) {
@@ -75,8 +76,8 @@ class SynthesizedAnnotationInvocationHandler implements InvocationHandler {
return annotationType();
}
if (!isAttributeMethod(method)) {
String msg = String.format("Method [%s] is unsupported for synthesized annotation type [%s]", method,
annotationType());
String msg = String.format("Method [%s] is unsupported for synthesized annotation type [%s]",
method, annotationType());
throw new AnnotationConfigurationException(msg);
}
return getAttributeValue(method);
@@ -92,9 +93,9 @@ class SynthesizedAnnotationInvocationHandler implements InvocationHandler {
if (value == null) {
value = this.attributeExtractor.getAttributeValue(attributeMethod);
if (value == null) {
throw new IllegalStateException(String.format(
"%s returned null for attribute name [%s] from attribute source [%s]",
this.attributeExtractor.getClass().getName(), attributeName, this.attributeExtractor.getSource()));
String msg = String.format("%s returned null for attribute name [%s] from attribute source [%s]",
this.attributeExtractor.getClass().getName(), attributeName, this.attributeExtractor.getSource());
throw new IllegalStateException(msg);
}
// Synthesize nested annotations before returning them.
@@ -200,7 +201,6 @@ class SynthesizedAnnotationInvocationHandler implements InvocationHandler {
* in Spring's {@link ObjectUtils} because those hash code generation
* algorithms do not comply with the requirements specified in
* {@link Annotation#hashCode()}.
*
* @param array the array to compute the hash code for
*/
private int hashCodeForArray(Object array) {