提交 40b2d26b 编写于 作者: S Sam Brannen

Avoid reflection for @Repeatable look-ups

Issue: SPR-13188
上级 61db8e9f
......@@ -17,6 +17,7 @@
package org.springframework.core.annotation;
import java.lang.annotation.Annotation;
import java.lang.annotation.Repeatable;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationHandler;
......@@ -111,8 +112,6 @@ public abstract class AnnotationUtils {
*/
public static final String VALUE = "value";
private static final String REPEATABLE_CLASS_NAME = "java.lang.annotation.Repeatable";
private static final Map<AnnotationCacheKey, Annotation> findAnnotationCache =
new ConcurrentReferenceHashMap<>(256);
......@@ -1703,19 +1702,9 @@ public abstract class AnnotationUtils {
* {@code null}.
* @since 4.2
*/
@SuppressWarnings("unchecked")
static Class<? extends Annotation> resolveContainerAnnotationType(Class<? extends Annotation> annotationType) {
try {
Annotation repeatable = getAnnotation(annotationType, REPEATABLE_CLASS_NAME);
if (repeatable != null) {
Object value = getValue(repeatable);
return (Class<? extends Annotation>) value;
}
}
catch (Exception ex) {
handleIntrospectionFailure(annotationType, ex);
}
return null;
Repeatable repeatable = getAnnotation(annotationType, Repeatable.class);
return (repeatable != null ? repeatable.value() : null);
}
/**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册