From bf4ffee1b55e77f51a30fbdb2a167959c944961a Mon Sep 17 00:00:00 2001 From: Matej Novotny Date: Thu, 27 Jun 2024 14:27:36 +0200 Subject: [PATCH] Arc - Add null check when trying to load qualifier class --- .../src/main/java/io/quarkus/arc/processor/Beans.java | 6 ++++++ 1 file changed, 6 insertions(+) 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 d0d87e32b1d79..b5eb22584600c 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 @@ -680,6 +680,12 @@ static boolean hasQualifier(BeanDeployment beanDeployment, AnnotationInstance re //as this is called in a tight loop we only do it if necessary values = new ArrayList<>(); Set nonBindingFields = beanDeployment.getQualifierNonbindingMembers(requiredQualifier.name()); + if (requiredClazz == null) { + throw new IllegalStateException("Failed to find bean qualifier class with name " + + requiredQualifier.name() + " in application index. Make sure the class is part of " + + "the Jandex index. Classes that are not subject to discovery can be registered via " + + "AdditionalBeanBuildItem and non-qualifier annotations can use QualifierRegistrarBuildItem"); + } for (AnnotationValue val : requiredQualifier.valuesWithDefaults(beanDeployment.getBeanArchiveIndex())) { if (!requiredClazz.method(val.name()).hasAnnotation(DotNames.NONBINDING) && !nonBindingFields.contains(val.name())) {