From 0586a0c01347104ffb2015206954828446ad7925 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Wed, 28 Aug 2024 14:25:15 +0200 Subject: [PATCH 1/2] Config Doc - Always scan the superclass and interfaces Several config roots can share the same super class or interface so we need to scan them always as the content of the scan will be attached to the root element. --- .../config/scanner/ConfigAnnotationScanner.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/scanner/ConfigAnnotationScanner.java b/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/scanner/ConfigAnnotationScanner.java index 7618489e6326d..08a06fbe24f3e 100644 --- a/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/scanner/ConfigAnnotationScanner.java +++ b/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/scanner/ConfigAnnotationScanner.java @@ -193,9 +193,7 @@ private void scanElement(List listeners, DiscoveryRoot debug("Detected superinterface: " + superInterfaceTypeElement, clazz); applyListeners(listeners, l -> l.onInterface(configRootElement, superInterfaceTypeElement)); - if (!isConfigRootAlreadyHandled(superInterfaceTypeElement)) { - scanElement(listeners, configRootElement, superInterfaceTypeElement); - } + scanElement(listeners, configRootElement, superInterfaceTypeElement); } } else { TypeMirror superclass = clazz.getSuperclass(); @@ -205,9 +203,7 @@ private void scanElement(List listeners, DiscoveryRoot debug("Detected superclass: " + superclassTypeElement, clazz); applyListeners(listeners, l -> l.onSuperclass(configRootElement, clazz)); - if (!isConfigRootAlreadyHandled(superclassTypeElement)) { - scanElement(listeners, configRootElement, superclassTypeElement); - } + scanElement(listeners, configRootElement, superclassTypeElement); } } From 5464841a05f530e82e8b46aa916a1e828895a244 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Wed, 28 Aug 2024 14:26:29 +0200 Subject: [PATCH 2/2] Config Doc - Scan config groups that are outside of the module For traditional config roots, we also need to scan the potential config groups that are not in this module. Fixes #42815 --- .../config/scanner/ConfigAnnotationScanner.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/scanner/ConfigAnnotationScanner.java b/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/scanner/ConfigAnnotationScanner.java index 08a06fbe24f3e..5ae2110b70d55 100644 --- a/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/scanner/ConfigAnnotationScanner.java +++ b/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/scanner/ConfigAnnotationScanner.java @@ -259,6 +259,17 @@ private void scanElement(List listeners, DiscoveryRoot if (resolvedType.isEnum()) { handleEnum(listeners, resolvedType.unwrappedTypeElement()); + } else if (resolvedType.isClass()) { + TypeElement unwrappedTypeElement = resolvedType.unwrappedTypeElement(); + if (utils.element().isAnnotationPresent(unwrappedTypeElement, Types.ANNOTATION_CONFIG_GROUP) + && !isConfigGroupAlreadyHandled(unwrappedTypeElement)) { + debug("Detected config group: " + resolvedType + " on field: " + + field, clazz); + + DiscoveryConfigGroup discoveryConfigGroup = applyRootListeners( + l -> l.onConfigGroup(unwrappedTypeElement)); + scanElement(listeners, discoveryConfigGroup, unwrappedTypeElement); + } } debug("Detected enclosed field: " + field, clazz);