Honor contract of @Repeatable in AnnotationUtils
This commit introduces a minor bug fix for getRepeatableAnnotations() so that it fully complies with the contract of Java's getAnnotationsByType() method with regard to repeatable annotations declared on multiple superclasses. Issue: SPR-13068
This commit is contained in:
@@ -305,6 +305,13 @@ public abstract class AnnotationUtils {
|
||||
return annotations;
|
||||
}
|
||||
|
||||
if (annotatedElement instanceof Class) {
|
||||
Class<?> superclass = ((Class<?>) annotatedElement).getSuperclass();
|
||||
if ((superclass != null) && (Object.class != superclass)) {
|
||||
return getRepeatableAnnotations(superclass, annotationType, containerAnnotationType);
|
||||
}
|
||||
}
|
||||
|
||||
return getRepeatableAnnotations(annotatedElement, annotationType, containerAnnotationType, false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user