From 2ba6895e0cfca42ea34f04b5d75ebf3dd61dfe21 Mon Sep 17 00:00:00 2001 From: Tim Hagemann Date: Tue, 11 Jun 2019 16:59:00 +0200 Subject: [PATCH] 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. --- core/src/main/java/co/aikar/commands/Annotations.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/co/aikar/commands/Annotations.java b/core/src/main/java/co/aikar/commands/Annotations.java index 736fd511..48ef4e33 100644 --- a/core/src/main/java/co/aikar/commands/Annotations.java +++ b/core/src/main/java/co/aikar/commands/Annotations.java @@ -108,9 +108,11 @@ class Annotations 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; + } } } }