Skip to content

Commit

Permalink
Move optional free form map resolution to where it's already handled
Browse files Browse the repository at this point in the history
  • Loading branch information
gsmet committed Aug 13, 2024
1 parent 1fb86f7 commit 1f13dbe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,11 @@ private void resolveProperty(ConfigRoot configRoot, Map<String, ConfigSection> 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());

Expand All @@ -192,7 +194,7 @@ private void resolveProperty(ConfigRoot configRoot, Map<String, ConfigSection> 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(),
Expand Down

0 comments on commit 1f13dbe

Please sign in to comment.