Skip to content

Commit

Permalink
ArC: deprecate the io.quarkus.arc.Priority annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ladicek committed Feb 7, 2023
1 parent 60d3378 commit 03a76b3
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ static BeanInfo createProducerMethod(Set<Type> 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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* 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 })
Expand Down
Original file line number Diff line number Diff line change
@@ -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}.
* <p>
* 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.
* <p>
* Since Common Annotations 2.1, the {@code jakarta.annotation.Priority} is no longer
* meta-annotated {@code @Target}, so these two annotations are equivalent.
* <p>
* 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();
Expand Down

0 comments on commit 03a76b3

Please sign in to comment.