From 3e87a015d922cdddd8b5d2a9c921455a6692c31d Mon Sep 17 00:00:00 2001 From: Roberto Cortez Date: Tue, 18 Apr 2023 11:09:10 +0100 Subject: [PATCH] Get element type without annotations --- .../generate_doc/ConfigDocItemFinder.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigDocItemFinder.java b/core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigDocItemFinder.java index 26035efd27f36..0e5c0643f18ea 100644 --- a/core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigDocItemFinder.java +++ b/core/processor/src/main/java/io/quarkus/annotation/processor/generate_doc/ConfigDocItemFinder.java @@ -159,8 +159,6 @@ private List recursivelyFindConfigItems(Element element, String r String name = null; String defaultValue = NO_DEFAULT; String defaultValueDoc = EMPTY; - final TypeMirror typeMirror = unwrapTypeMirror(enclosedElement.asType()); - String type = typeMirror.toString(); List acceptedValues = null; final TypeElement clazz = (TypeElement) element; final String fieldName = enclosedElement.getSimpleName().toString(); @@ -250,6 +248,9 @@ private List recursivelyFindConfigItems(Element element, String r defaultValue = EMPTY; } + TypeMirror typeMirror = unwrapTypeMirror(enclosedElement.asType()); + String type = getType(typeMirror); + if (isConfigGroup(type)) { List groupConfigItems = readConfigGroupItems(configPhase, rootName, name, type, configSection, withinAMap, generateSeparateConfigGroupDocsFiles); @@ -387,6 +388,15 @@ private TypeMirror unwrapTypeMirror(TypeMirror typeMirror) { return typeMirror; } + private String getType(TypeMirror typeMirror) { + if (typeMirror instanceof DeclaredType) { + DeclaredType declaredType = (DeclaredType) typeMirror; + TypeElement typeElement = (TypeElement) declaredType.asElement(); + return typeElement.getQualifiedName().toString(); + } + return typeMirror.toString(); + } + private boolean isConfigGroup(String type) { if (type.startsWith("java.") || PRIMITIVE_TYPES.contains(type)) { return false;