Skip to content

Commit 40b2d26

Browse files
committed
Avoid reflection for @repeatable look-ups
Issue: SPR-13188
1 parent 61db8e9 commit 40b2d26

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

spring-core/src/main/java/org/springframework/core/annotation/AnnotationUtils.java

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.springframework.core.annotation;
1818

1919
import java.lang.annotation.Annotation;
20+
import java.lang.annotation.Repeatable;
2021
import java.lang.reflect.AnnotatedElement;
2122
import java.lang.reflect.Array;
2223
import java.lang.reflect.InvocationHandler;
@@ -111,8 +112,6 @@ public abstract class AnnotationUtils {
111112
*/
112113
public static final String VALUE = "value";
113114

114-
private static final String REPEATABLE_CLASS_NAME = "java.lang.annotation.Repeatable";
115-
116115
private static final Map<AnnotationCacheKey, Annotation> findAnnotationCache =
117116
new ConcurrentReferenceHashMap<>(256);
118117

@@ -1703,19 +1702,9 @@ static boolean isAnnotationTypeMethod(Method method) {
17031702
* {@code null}.
17041703
* @since 4.2
17051704
*/
1706-
@SuppressWarnings("unchecked")
17071705
static Class<? extends Annotation> resolveContainerAnnotationType(Class<? extends Annotation> annotationType) {
1708-
try {
1709-
Annotation repeatable = getAnnotation(annotationType, REPEATABLE_CLASS_NAME);
1710-
if (repeatable != null) {
1711-
Object value = getValue(repeatable);
1712-
return (Class<? extends Annotation>) value;
1713-
}
1714-
}
1715-
catch (Exception ex) {
1716-
handleIntrospectionFailure(annotationType, ex);
1717-
}
1718-
return null;
1706+
Repeatable repeatable = getAnnotation(annotationType, Repeatable.class);
1707+
return (repeatable != null ? repeatable.value() : null);
17191708
}
17201709

17211710
/**

0 commit comments

Comments
 (0)