Specifically ignore annotations in java package for meta-annotations

There's no world in which a java annotation contains one of the
command annotations and may only lead to infinite recursion.
This commit is contained in:
Tim Hagemann
2019-06-11 16:59:00 +02:00
committed by Daniel Ennis
parent 667dfec904
commit 2ba6895e0c
@@ -108,9 +108,11 @@ class Annotations <M extends CommandManager> extends AnnotationLookups {
return object.getAnnotation(annoClass);
} else {
for (Annotation otherAnnotation : object.getDeclaredAnnotations()) {
final Annotation foundAnnotation = getAnnotationRecursive(otherAnnotation.annotationType(), annoClass);
if (foundAnnotation != null) {
return foundAnnotation;
if (!otherAnnotation.annotationType().getPackage().getName().startsWith("java.")) {
final Annotation foundAnnotation = getAnnotationRecursive(otherAnnotation.annotationType(), annoClass);
if (foundAnnotation != null) {
return foundAnnotation;
}
}
}
}