diff --git a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Beans.java b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Beans.java index 0081f93d67b56..9e26c06a3ead4 100644 --- a/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Beans.java +++ b/independent-projects/arc/processor/src/main/java/io/quarkus/arc/processor/Beans.java @@ -124,7 +124,6 @@ static BeanInfo createProducerMethod(Set beanTypes, MethodInfo producerMet priority = annotation.value().asInt(); continue; } - // This is not supported ATM but should work once we upgrade to Common Annotations 2.1 if ((!isAlternative || priority == null) && annotationName.equals(DotNames.PRIORITY)) { priority = annotation.value().asInt(); continue; @@ -240,7 +239,6 @@ static BeanInfo createProducerField(FieldInfo producerField, BeanInfo declaringB priority = annotation.value().asInt(); continue; } - // This is not supported ATM but should work once we upgrade to Common Annotations 2.1 if ((!isAlternative || priority == null) && annotation.name().equals(DotNames.PRIORITY)) { priority = annotation.value().asInt(); continue; diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/AlternativePriority.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/AlternativePriority.java index 48be16ec02521..5fd701beb4c1b 100644 --- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/AlternativePriority.java +++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/AlternativePriority.java @@ -10,10 +10,10 @@ /** * If a bean is annotated with this annotation, it is considered an enabled alternative with given priority. * Effectively, this is a shortcut for {@code Alternative} plus {@code Priority} annotations. + *

+ * This annotation can be used not only on bean classes, but also method and field producers. * - * This annotation can be used not only on bean classes, but also method and field producers (unlike pure {@code Priority}). - * - * @deprecated Use {@link Alternative} and {@link io.quarkus.arc.Priority}/{@link jakarta.annotation.Priority} instead + * @deprecated Use {@link Alternative} and {@link jakarta.annotation.Priority} instead */ @Retention(RetentionPolicy.RUNTIME) @Target({ ElementType.METHOD, ElementType.TYPE, ElementType.FIELD }) diff --git a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Priority.java b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Priority.java index 8328b9815bea7..6512d5cfa5cdc 100644 --- a/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Priority.java +++ b/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/Priority.java @@ -1,18 +1,25 @@ package io.quarkus.arc; -import static java.lang.annotation.RetentionPolicy.RUNTIME; - import java.lang.annotation.Retention; -import java.lang.annotation.Target; +import java.lang.annotation.RetentionPolicy; /** - * This annotation has the same semantics as {@link jakarta.annotation.Priority} except that the {@link Target} - * meta-annotation is not present. The main motivation is to support method and field declarations, i.e. this annotation - * can be used for producer methods and fields. Note that this problem is fixed in Common Annotations 2.1. + * This annotation has the same semantics as {@link jakarta.annotation.Priority}. + *

+ * Prior to Common Annotations 2.1, the {@code jakarta.annotation.Priority} annotation + * was meta-annotated {@code @Target({TYPE, PARAMETER})} and so was only usable on class + * declarations and method parameters. This annotation was introduced to allow annotating + * producer methods and fields. + *

+ * Since Common Annotations 2.1, the {@code jakarta.annotation.Priority} is no longer + * meta-annotated {@code @Target}, so these two annotations are equivalent. *

* A priority specified by {@link AlternativePriority} and {@link jakarta.annotation.Priority} takes precedence. + * + * @deprecated use {@link jakarta.annotation.Priority} instead */ -@Retention(RUNTIME) +@Retention(RetentionPolicy.RUNTIME) +@Deprecated public @interface Priority { int value();