Skip to content

Commit

Permalink
Merge pull request #42835 from gsmet/annotation-processor-fixes
Browse files Browse the repository at this point in the history
Config Doc - Fix two scanning issues
  • Loading branch information
gastaldi authored Aug 28, 2024
2 parents 742b76f + 5464841 commit 7e86ad8
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,7 @@ private void scanElement(List<ConfigAnnotationListener> 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();
Expand All @@ -205,9 +203,7 @@ private void scanElement(List<ConfigAnnotationListener> 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);
}
}

Expand Down Expand Up @@ -263,6 +259,17 @@ private void scanElement(List<ConfigAnnotationListener> 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);
Expand Down

0 comments on commit 7e86ad8

Please sign in to comment.