Skip to content

Commit 2451594

Browse files
committed
Synthesize annotation arrays within AnnotationUtils
Issue: SPR-11393
1 parent 75fe618 commit 2451594

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ public static <A extends Annotation> A getAnnotation(Method method, Class<A> ann
219219
*/
220220
public static Annotation[] getAnnotations(AnnotatedElement annotatedElement) {
221221
try {
222-
return annotatedElement.getAnnotations();
222+
return synthesizeAnnotationArray(annotatedElement.getAnnotations(), annotatedElement);
223223
}
224224
catch (Exception ex) {
225225
handleIntrospectionFailure(annotatedElement, ex);
@@ -241,7 +241,7 @@ public static Annotation[] getAnnotations(AnnotatedElement annotatedElement) {
241241
*/
242242
public static Annotation[] getAnnotations(Method method) {
243243
try {
244-
return BridgeMethodResolver.findBridgedMethod(method).getAnnotations();
244+
return synthesizeAnnotationArray(BridgeMethodResolver.findBridgedMethod(method).getAnnotations(), method);
245245
}
246246
catch (Exception ex) {
247247
handleIntrospectionFailure(method, ex);
@@ -1811,6 +1811,9 @@ private static class AnnotationCollector<A extends Annotation> {
18111811
this.declaredMode = declaredMode;
18121812
}
18131813

1814+
/**
1815+
* @since 4.2
1816+
*/
18141817
@SuppressWarnings("unchecked")
18151818
static Class<? extends Annotation> resolveContainerAnnotationType(Class<? extends Annotation> annotationType) {
18161819
try {

0 commit comments

Comments
 (0)