From 1f13dbe10f7e795018ac554340779459ca4972d3 Mon Sep 17 00:00:00 2001 From: Guillaume Smet Date: Tue, 13 Aug 2024 18:34:05 +0200 Subject: [PATCH] Move optional free form map resolution to where it's already handled --- .../documentation/config/discovery/ResolvedType.java | 6 +----- .../documentation/config/resolver/ConfigResolver.java | 6 ++++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/discovery/ResolvedType.java b/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/discovery/ResolvedType.java index 558e65cd4b42b..aec9070a196aa 100644 --- a/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/discovery/ResolvedType.java +++ b/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/discovery/ResolvedType.java @@ -75,11 +75,7 @@ public static ResolvedType makeMap(TypeMirror type, ResolvedType unwrappedResolv unwrappedResolvedType.binaryName, unwrappedResolvedType.qualifiedName, unwrappedResolvedType.simplifiedName, unwrappedResolvedType.isPrimitive, true, unwrappedResolvedType.isList, - unwrappedResolvedType.isOptional - // backwards compatibility with versions before Quarkus 3.14 - // see https://github.com/quarkusio/quarkus/issues/42505 - || "java.lang.String".equals(unwrappedResolvedType.qualifiedName) - || TypeUtil.isPrimitiveWrapper(unwrappedResolvedType.qualifiedName), + unwrappedResolvedType.isOptional, unwrappedResolvedType.isDeclared, unwrappedResolvedType.isInterface, unwrappedResolvedType.isClass, unwrappedResolvedType.isEnum, unwrappedResolvedType.isDuration, unwrappedResolvedType.isConfigGroup); } diff --git a/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/resolver/ConfigResolver.java b/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/resolver/ConfigResolver.java index 88a4098ca0e50..377dc0484e568 100644 --- a/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/resolver/ConfigResolver.java +++ b/core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/resolver/ConfigResolver.java @@ -172,9 +172,11 @@ private void resolveProperty(ConfigRoot configRoot, Map e } String potentiallyMappedPath = propertyPath; + boolean optional = discoveryConfigProperty.getType().isOptional(); if (discoveryConfigProperty.getType().isMap()) { - // it is a leaf pass through map + // it is a leaf pass through map, it is always optional + optional = true; typeQualifiedName = discoveryConfigProperty.getType().wrapperType().toString(); typeSimplifiedName = utils.element().simplifyGenericType(discoveryConfigProperty.getType().wrapperType()); @@ -192,7 +194,7 @@ private void resolveProperty(ConfigRoot configRoot, Map e discoveryConfigProperty.getSourceName(), potentiallyMappedPath, additionalPaths, ConfigNamingUtil.toEnvVarName(potentiallyMappedPath), typeQualifiedName, typeSimplifiedName, discoveryConfigProperty.getType().isMap(), discoveryConfigProperty.getType().isList(), - discoveryConfigProperty.getType().isOptional(), discoveryConfigProperty.getMapKey(), + optional, discoveryConfigProperty.getMapKey(), discoveryConfigProperty.isUnnamedMapKey(), context.isWithinMap(), discoveryConfigProperty.isConverted(), discoveryConfigProperty.getType().isEnum(),