FIX: typeGetAll did not work with repeated annotations on one class

This commit is contained in:
Jonas Pöhler
2021-11-12 17:29:10 +01:00
parent f98292be41
commit 6eb13fda7a
@@ -58,10 +58,8 @@ public class AnnotationUtil {
private static <A extends Annotation> void typeGetAllCollect(Class<?> clazz, Class<A> annotationType, Set<A> result) {
while (clazz != null && clazz != Object.class) {
final A val = clazz.getAnnotation(annotationType);
if (val != null) {
result.add(val);
}
final A[] annotations = clazz.getAnnotationsByType(annotationType);
Collections.addAll(result, annotations);
clazz = clazz.getSuperclass();
}
}