From 79428cf034d25c57c459f9afb02b0d057754241d Mon Sep 17 00:00:00 2001 From: Ladislav Thon Date: Mon, 29 Nov 2021 10:13:33 +0100 Subject: [PATCH] Allow @Enhancement to not restrict the types based on annotations In case an unannotated type is added through `@Discovery`, such type previously couldn't be transformed during `@Enhancement`. With this commit, it is possible to specify that the set of types considered for `@Enhancement` is not restricted based on annotations in any way. To do that, the `@Enhancement#withAnnotations` member should be set to an empty array. --- .../build/compatible/spi/Enhancement.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/Enhancement.java b/api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/Enhancement.java index d49064e2..47eaaef9 100644 --- a/api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/Enhancement.java +++ b/api/src/main/java/jakarta/enterprise/inject/build/compatible/spi/Enhancement.java @@ -72,20 +72,24 @@ * parameter of any member of the type, or as a meta-annotation on any annotation * that is considered by these rules. *

- * Defaults to the {@linkplain BeanDefiningAnnotations set of bean defining annotations}. + * If empty, the set of expected types is not narrowed down in any way. + * If {@code java.lang.Annotation} is present, the set of expected types + * is narrowed down to types that use any annotation. + * The {@link BeanDefiningAnnotations @BeanDefiningAnnotations} marker type may + * be used to narrow down the set of expected types to types that use + * any bean defining annotation. *

- * If empty, or if {@code java.lang.Annotation} is present, all annotations are used. - * That is, the set of expected types is narrowed down to the set of types - * that use any annotation. + * Defaults to the {@linkplain BeanDefiningAnnotations set of bean defining annotations}. * * @return types of annotations that must be present on the expected types */ Class[] withAnnotations() default BeanDefiningAnnotations.class; /** - * Marker annotation type that represents set of bean defining annotations after - * the {@link Discovery @Discovery} phase is finished. That is, it includes custom - * normal scope annotations as well as custom stereotypes. + * Marker annotation type that, for the purpose of {@link Enhancement#withAnnotations()}, + * represents set of bean defining annotations after the {@link Discovery @Discovery} + * phase is finished. That is, it includes custom normal scope annotations as well as + * custom stereotypes. */ @interface BeanDefiningAnnotations { }