Skip to content

Commit

Permalink
Merge pull request quarkusio#38096 from geoand/arc-builditems-checkre…
Browse files Browse the repository at this point in the history
…turnvalue

Introduce @CheckReturnValue into common Arc build items
  • Loading branch information
gsmet authored Jun 7, 2024
2 parents 909b079 + 9699fb8 commit eeaca37
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.jboss.jandex.DotName;

import io.quarkus.builder.item.MultiBuildItem;
import io.smallrye.common.annotation.CheckReturnValue;

/**
* This build item is used to specify one or more additional bean classes to be analyzed during bean discovery.
Expand Down Expand Up @@ -39,6 +40,7 @@ public static Builder builder() {
* @param beanClass
* @return a new build item
*/
@CheckReturnValue
public static AdditionalBeanBuildItem unremovableOf(Class<?> beanClass) {
return new AdditionalBeanBuildItem(Collections.singletonList(beanClass.getName()), false, null);
}
Expand All @@ -49,6 +51,7 @@ public static AdditionalBeanBuildItem unremovableOf(Class<?> beanClass) {
* @param beanClass
* @return a new build item
*/
@CheckReturnValue
public static AdditionalBeanBuildItem unremovableOf(String beanClass) {
return new AdditionalBeanBuildItem(Collections.singletonList(beanClass), false, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import io.quarkus.arc.processor.Annotations;
import io.quarkus.arc.processor.BeanInfo;
import io.quarkus.builder.item.MultiBuildItem;
import io.smallrye.common.annotation.CheckReturnValue;

/**
* This build item is used to exclude beans that would be normally removed if the config property
Expand Down Expand Up @@ -88,6 +89,7 @@ public Set<String> getClassNames() {
* @param classNames
* @return a new build item
*/
@CheckReturnValue
public static UnremovableBeanBuildItem beanClassNames(String... classNames) {
Set<String> names = new HashSet<>();
Collections.addAll(names, classNames);
Expand All @@ -100,6 +102,7 @@ public static UnremovableBeanBuildItem beanClassNames(String... classNames) {
* @param classNames
* @return a new build item
*/
@CheckReturnValue
public static UnremovableBeanBuildItem beanClassNames(Set<String> classNames) {
return new UnremovableBeanBuildItem(new BeanClassNamesExclusion(classNames));
}
Expand All @@ -110,6 +113,7 @@ public static UnremovableBeanBuildItem beanClassNames(Set<String> classNames) {
* @param typeNames
* @return a new build item
*/
@CheckReturnValue
public static UnremovableBeanBuildItem beanTypes(DotName... typeNames) {
Set<DotName> names = new HashSet<>();
Collections.addAll(names, typeNames);
Expand All @@ -122,6 +126,7 @@ public static UnremovableBeanBuildItem beanTypes(DotName... typeNames) {
* @param typeNames
* @return a new build item
*/
@CheckReturnValue
public static UnremovableBeanBuildItem beanTypes(Class<?>... types) {
return new UnremovableBeanBuildItem(new BeanTypesExclusion(
Arrays.stream(types).map(Class::getName).map(DotName::createSimple).collect(Collectors.toSet())));
Expand All @@ -133,6 +138,7 @@ public static UnremovableBeanBuildItem beanTypes(Class<?>... types) {
* @param typeNames
* @return a new build item
*/
@CheckReturnValue
public static UnremovableBeanBuildItem beanTypes(Set<DotName> typeNames) {
return new UnremovableBeanBuildItem(new BeanTypesExclusion(typeNames));
}
Expand All @@ -145,6 +151,7 @@ public static UnremovableBeanBuildItem beanTypes(Set<DotName> typeNames) {
* @param annotationName
* @return a new build item
*/
@CheckReturnValue
public static UnremovableBeanBuildItem beanClassAnnotation(DotName annotationName) {
return new UnremovableBeanBuildItem(new BeanClassAnnotationExclusion(annotationName));
}
Expand All @@ -157,6 +164,7 @@ public static UnremovableBeanBuildItem beanClassAnnotation(DotName annotationNam
* @param annotationName
* @return a new build item
*/
@CheckReturnValue
public static UnremovableBeanBuildItem beanClassAnnotation(String nameStartsWith) {
return new UnremovableBeanBuildItem(new BeanClassAnnotationExclusion(nameStartsWith));
}
Expand All @@ -167,6 +175,7 @@ public static UnremovableBeanBuildItem beanClassAnnotation(String nameStartsWith
* @param annotationName
* @return a new build item
*/
@CheckReturnValue
public static UnremovableBeanBuildItem targetWithAnnotation(DotName annotationName) {
return new UnremovableBeanBuildItem(new Predicate<BeanInfo>() {
@Override
Expand Down

0 comments on commit eeaca37

Please sign in to comment.