Avoid repeated superclass introspection in findAnnotation(Method,...)
Issue: SPR-16730
(cherry picked from commit d78e27f)
This commit is contained in:
parent
4cd43dc793
commit
26652a6b83
|
|
@ -555,13 +555,18 @@ public abstract class AnnotationUtils {
|
||||||
if (clazz == null || Object.class == clazz) {
|
if (clazz == null || Object.class == clazz) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
try {
|
Set<Method> annotatedMethods = getAnnotatedMethodsInBaseType(clazz);
|
||||||
Method equivalentMethod = clazz.getDeclaredMethod(method.getName(), method.getParameterTypes());
|
if (!annotatedMethods.isEmpty()) {
|
||||||
Method resolvedEquivalentMethod = BridgeMethodResolver.findBridgedMethod(equivalentMethod);
|
for (Method annotatedMethod : annotatedMethods) {
|
||||||
result = findAnnotation((AnnotatedElement) resolvedEquivalentMethod, annotationType);
|
if (annotatedMethod.getName().equals(method.getName()) &&
|
||||||
|
Arrays.equals(annotatedMethod.getParameterTypes(), method.getParameterTypes())) {
|
||||||
|
Method resolvedSuperMethod = BridgeMethodResolver.findBridgedMethod(annotatedMethod);
|
||||||
|
result = findAnnotation((AnnotatedElement) resolvedSuperMethod, annotationType);
|
||||||
|
if (result != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (NoSuchMethodException ex) {
|
|
||||||
// No equivalent method found
|
|
||||||
}
|
}
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
result = searchOnInterfaces(method, annotationType, clazz.getInterfaces());
|
result = searchOnInterfaces(method, annotationType, clazz.getInterfaces());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue