AnnotationUtils.getAnnotation non-null check for synthesizeAnnotation

Issue: SPR-16708

(cherry picked from commit da80502)
This commit is contained in:
Juergen Hoeller
2018-04-11 12:50:27 +02:00
parent ffa4f03fd4
commit 433877e5cb

View File

@@ -126,6 +126,7 @@ public abstract class AnnotationUtils {
private static final Map<Class<?>, Set<Method>> annotatedBaseTypeCache =
new ConcurrentReferenceHashMap<>(256);
@SuppressWarnings("unused")
@Deprecated // just here for older tool versions trying to reflectively clear the cache
private static final Map<Class<?>, ?> annotatedInterfaceCache = annotatedBaseTypeCache;
@@ -165,7 +166,8 @@ public abstract class AnnotationUtils {
}
Class<? extends Annotation> annotatedElement = annotation.annotationType();
try {
return synthesizeAnnotation(annotatedElement.getAnnotation(annotationType), annotatedElement);
A metaAnn = annotatedElement.getAnnotation(annotationType);
return (metaAnn != null ? synthesizeAnnotation(metaAnn, annotatedElement) : null);
}
catch (Throwable ex) {
handleIntrospectionFailure(annotatedElement, ex);