Avoid reflection for @Repeatable look-ups
Issue: SPR-13188
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
package org.springframework.core.annotation;
|
package org.springframework.core.annotation;
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
|
import java.lang.annotation.Repeatable;
|
||||||
import java.lang.reflect.AnnotatedElement;
|
import java.lang.reflect.AnnotatedElement;
|
||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.lang.reflect.InvocationHandler;
|
import java.lang.reflect.InvocationHandler;
|
||||||
@@ -111,8 +112,6 @@ public abstract class AnnotationUtils {
|
|||||||
*/
|
*/
|
||||||
public static final String VALUE = "value";
|
public static final String VALUE = "value";
|
||||||
|
|
||||||
private static final String REPEATABLE_CLASS_NAME = "java.lang.annotation.Repeatable";
|
|
||||||
|
|
||||||
private static final Map<AnnotationCacheKey, Annotation> findAnnotationCache =
|
private static final Map<AnnotationCacheKey, Annotation> findAnnotationCache =
|
||||||
new ConcurrentReferenceHashMap<>(256);
|
new ConcurrentReferenceHashMap<>(256);
|
||||||
|
|
||||||
@@ -1703,19 +1702,9 @@ public abstract class AnnotationUtils {
|
|||||||
* {@code null}.
|
* {@code null}.
|
||||||
* @since 4.2
|
* @since 4.2
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
static Class<? extends Annotation> resolveContainerAnnotationType(Class<? extends Annotation> annotationType) {
|
static Class<? extends Annotation> resolveContainerAnnotationType(Class<? extends Annotation> annotationType) {
|
||||||
try {
|
Repeatable repeatable = getAnnotation(annotationType, Repeatable.class);
|
||||||
Annotation repeatable = getAnnotation(annotationType, REPEATABLE_CLASS_NAME);
|
return (repeatable != null ? repeatable.value() : null);
|
||||||
if (repeatable != null) {
|
|
||||||
Object value = getValue(repeatable);
|
|
||||||
return (Class<? extends Annotation>) value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex) {
|
|
||||||
handleIntrospectionFailure(annotationType, ex);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user