diff --git a/core/src/main/java/org/jboss/jandex/AnnotationInstance.java b/core/src/main/java/org/jboss/jandex/AnnotationInstance.java index 941ab8e6..7813b7fa 100644 --- a/core/src/main/java/org/jboss/jandex/AnnotationInstance.java +++ b/core/src/main/java/org/jboss/jandex/AnnotationInstance.java @@ -44,7 +44,6 @@ public final class AnnotationInstance { static final NameComparator NAME_COMPARATOR = new NameComparator(); static final AnnotationInstance[] EMPTY_ARRAY = new AnnotationInstance[0]; - static final DotName RETENTION = new DotName(DotName.JAVA_LANG_ANNOTATION_NAME, "Retention", true, false); private final DotName name; private final AnnotationTarget target; @@ -97,8 +96,8 @@ public static AnnotationInstanceBuilder builder(ClassInfo annotationType) { throw new IllegalArgumentException("Annotation type can't be null"); } DotName name = annotationType.name(); - boolean visible = annotationType.hasDeclaredAnnotation(RETENTION) - && annotationType.declaredAnnotation(RETENTION).value().asString().equals("RUNTIME"); + boolean visible = annotationType.hasDeclaredAnnotation(DotName.RETENTION_NAME) + && annotationType.declaredAnnotation(DotName.RETENTION_NAME).value().asString().equals("RUNTIME"); return new AnnotationInstanceBuilder(name, visible); } diff --git a/core/src/main/java/org/jboss/jandex/ClassInfo.java b/core/src/main/java/org/jboss/jandex/ClassInfo.java index dc591a40..61c965d1 100644 --- a/core/src/main/java/org/jboss/jandex/ClassInfo.java +++ b/core/src/main/java/org/jboss/jandex/ClassInfo.java @@ -471,7 +471,7 @@ public final List annotationsWithRepeatable(DotName name, In if (!annotationClass.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annotationClass); } - AnnotationInstance repeatable = annotationClass.declaredAnnotation(Index.REPEATABLE); + AnnotationInstance repeatable = annotationClass.declaredAnnotation(DotName.REPEATABLE_NAME); if (repeatable != null) { Type containingType = repeatable.value().asClass(); for (AnnotationInstance container : annotations(containingType.name())) { @@ -598,7 +598,7 @@ public final List declaredAnnotationsWithRepeatable(DotName if (!annotationClass.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annotationClass); } - AnnotationInstance repeatable = annotationClass.declaredAnnotation(Index.REPEATABLE); + AnnotationInstance repeatable = annotationClass.declaredAnnotation(DotName.REPEATABLE_NAME); if (repeatable != null) { Type containingType = repeatable.value().asClass(); AnnotationInstance container = declaredAnnotation(containingType.name()); diff --git a/core/src/main/java/org/jboss/jandex/DotName.java b/core/src/main/java/org/jboss/jandex/DotName.java index 3a983852..1bc66b8a 100644 --- a/core/src/main/java/org/jboss/jandex/DotName.java +++ b/core/src/main/java/org/jboss/jandex/DotName.java @@ -49,6 +49,8 @@ public final class DotName implements Comparable { public static final DotName ENUM_NAME; public static final DotName RECORD_NAME; public static final DotName STRING_NAME; + public static final DotName REPEATABLE_NAME; + public static final DotName RETENTION_NAME; private final DotName prefix; private final String local; @@ -64,6 +66,8 @@ public final class DotName implements Comparable { ENUM_NAME = new DotName(JAVA_LANG_NAME, "Enum", true, false); RECORD_NAME = new DotName(JAVA_LANG_NAME, "Record", true, false); STRING_NAME = new DotName(JAVA_LANG_NAME, "String", true, false); + REPEATABLE_NAME = new DotName(JAVA_LANG_ANNOTATION_NAME, "Repeatable", true, false); + RETENTION_NAME = new DotName(DotName.JAVA_LANG_ANNOTATION_NAME, "Retention", true, false); } /** diff --git a/core/src/main/java/org/jboss/jandex/FieldInfo.java b/core/src/main/java/org/jboss/jandex/FieldInfo.java index 77fb7162..cdc81a34 100644 --- a/core/src/main/java/org/jboss/jandex/FieldInfo.java +++ b/core/src/main/java/org/jboss/jandex/FieldInfo.java @@ -198,7 +198,7 @@ public final List annotationsWithRepeatable(DotName name, In if (!annotationClass.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annotationClass); } - AnnotationInstance repeatable = annotationClass.declaredAnnotation(Index.REPEATABLE); + AnnotationInstance repeatable = annotationClass.declaredAnnotation(DotName.REPEATABLE_NAME); if (repeatable != null) { Type containingType = repeatable.value().asClass(); for (AnnotationInstance container : annotations(containingType.name())) { @@ -302,7 +302,7 @@ public final List declaredAnnotationsWithRepeatable(DotName if (!annotationClass.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annotationClass); } - AnnotationInstance repeatable = annotationClass.declaredAnnotation(Index.REPEATABLE); + AnnotationInstance repeatable = annotationClass.declaredAnnotation(DotName.REPEATABLE_NAME); if (repeatable != null) { Type containingType = repeatable.value().asClass(); AnnotationInstance container = declaredAnnotation(containingType.name()); diff --git a/core/src/main/java/org/jboss/jandex/Index.java b/core/src/main/java/org/jboss/jandex/Index.java index a35256a5..b76517bb 100644 --- a/core/src/main/java/org/jboss/jandex/Index.java +++ b/core/src/main/java/org/jboss/jandex/Index.java @@ -67,8 +67,6 @@ public final class Index implements IndexView { private static final List EMPTY_ANNOTATION_LIST = Collections.emptyList(); private static final List EMPTY_CLASSINFO_LIST = Collections.emptyList(); - static final DotName REPEATABLE = DotName.createSimple("java.lang.annotation.Repeatable"); - final Map annotations; final Map subclasses; final Map subinterfaces; @@ -331,7 +329,7 @@ public Collection getAnnotationsWithRepeatable(DotName annot if (!annotationClass.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annotationClass); } - AnnotationInstance repeatable = annotationClass.declaredAnnotation(REPEATABLE); + AnnotationInstance repeatable = annotationClass.declaredAnnotation(DotName.REPEATABLE_NAME); if (repeatable == null) { // Not a repeatable annotation return getAnnotations(annotationName); diff --git a/core/src/main/java/org/jboss/jandex/MethodInfo.java b/core/src/main/java/org/jboss/jandex/MethodInfo.java index c0fcf4be..bd94fc1c 100644 --- a/core/src/main/java/org/jboss/jandex/MethodInfo.java +++ b/core/src/main/java/org/jboss/jandex/MethodInfo.java @@ -417,7 +417,7 @@ public final List annotationsWithRepeatable(DotName name, In if (!annotationClass.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annotationClass); } - AnnotationInstance repeatable = annotationClass.declaredAnnotation(Index.REPEATABLE); + AnnotationInstance repeatable = annotationClass.declaredAnnotation(DotName.REPEATABLE_NAME); if (repeatable != null) { Type containingType = repeatable.value().asClass(); for (AnnotationInstance container : annotations(containingType.name())) { @@ -525,7 +525,7 @@ public List declaredAnnotationsWithRepeatable(DotName name, if (!annotationClass.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annotationClass); } - AnnotationInstance repeatable = annotationClass.declaredAnnotation(Index.REPEATABLE); + AnnotationInstance repeatable = annotationClass.declaredAnnotation(DotName.REPEATABLE_NAME); if (repeatable != null) { Type containingType = repeatable.value().asClass(); AnnotationInstance container = declaredAnnotation(containingType.name()); diff --git a/core/src/main/java/org/jboss/jandex/MethodParameterInfo.java b/core/src/main/java/org/jboss/jandex/MethodParameterInfo.java index 2b278939..0e59e117 100644 --- a/core/src/main/java/org/jboss/jandex/MethodParameterInfo.java +++ b/core/src/main/java/org/jboss/jandex/MethodParameterInfo.java @@ -193,7 +193,7 @@ public List annotationsWithRepeatable(DotName name, IndexVie if (!annotationClass.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annotationClass); } - AnnotationInstance repeatable = annotationClass.declaredAnnotation(Index.REPEATABLE); + AnnotationInstance repeatable = annotationClass.declaredAnnotation(DotName.REPEATABLE_NAME); if (repeatable != null) { Type containingType = repeatable.value().asClass(); for (AnnotationInstance container : annotations(containingType.name())) { @@ -296,7 +296,7 @@ public List declaredAnnotationsWithRepeatable(DotName name, if (!annotationClass.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annotationClass); } - AnnotationInstance repeatable = annotationClass.declaredAnnotation(Index.REPEATABLE); + AnnotationInstance repeatable = annotationClass.declaredAnnotation(DotName.REPEATABLE_NAME); if (repeatable != null) { Type containingType = repeatable.value().asClass(); AnnotationInstance container = declaredAnnotation(containingType.name()); diff --git a/core/src/main/java/org/jboss/jandex/RecordComponentInfo.java b/core/src/main/java/org/jboss/jandex/RecordComponentInfo.java index 63beaa05..14ec74e3 100644 --- a/core/src/main/java/org/jboss/jandex/RecordComponentInfo.java +++ b/core/src/main/java/org/jboss/jandex/RecordComponentInfo.java @@ -190,7 +190,7 @@ public final List annotationsWithRepeatable(DotName name, In if (!annotationClass.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annotationClass); } - AnnotationInstance repeatable = annotationClass.declaredAnnotation(Index.REPEATABLE); + AnnotationInstance repeatable = annotationClass.declaredAnnotation(DotName.REPEATABLE_NAME); if (repeatable != null) { Type containingType = repeatable.value().asClass(); for (AnnotationInstance container : annotations(containingType.name())) { @@ -285,7 +285,7 @@ public final List declaredAnnotationsWithRepeatable(DotName if (!annotationClass.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annotationClass); } - AnnotationInstance repeatable = annotationClass.declaredAnnotation(Index.REPEATABLE); + AnnotationInstance repeatable = annotationClass.declaredAnnotation(DotName.REPEATABLE_NAME); if (repeatable != null) { Type containingType = repeatable.value().asClass(); AnnotationInstance container = declaredAnnotation(containingType.name()); diff --git a/core/src/main/java/org/jboss/jandex/Type.java b/core/src/main/java/org/jboss/jandex/Type.java index 81c361b1..3ccb5c3d 100644 --- a/core/src/main/java/org/jboss/jandex/Type.java +++ b/core/src/main/java/org/jboss/jandex/Type.java @@ -468,7 +468,7 @@ public final List annotationsWithRepeatable(DotName name, In if (!annotationClass.isAnnotation()) { throw new IllegalArgumentException("Not an annotation type: " + annotationClass); } - AnnotationInstance repeatable = annotationClass.declaredAnnotation(Index.REPEATABLE); + AnnotationInstance repeatable = annotationClass.declaredAnnotation(DotName.REPEATABLE_NAME); if (repeatable != null) { Type containingType = repeatable.value().asClass(); AnnotationInstance container = annotation(containingType.name());