diff --git a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java index 3ef0db89b4..da7d6df6d4 100644 --- a/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java +++ b/spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java @@ -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 findAnnotationCache = new ConcurrentReferenceHashMap<>(256); @@ -1703,19 +1702,9 @@ public abstract class AnnotationUtils { * {@code null}. * @since 4.2 */ - @SuppressWarnings("unchecked") static Class resolveContainerAnnotationType(Class annotationType) { - try { - Annotation repeatable = getAnnotation(annotationType, REPEATABLE_CLASS_NAME); - if (repeatable != null) { - Object value = getValue(repeatable); - return (Class) value; - } - } - catch (Exception ex) { - handleIntrospectionFailure(annotationType, ex); - } - return null; + Repeatable repeatable = getAnnotation(annotationType, Repeatable.class); + return (repeatable != null ? repeatable.value() : null); } /**