diff --git a/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java b/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java index 9427194fd7f49c..6e3f49ea9d1d0c 100644 --- a/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java +++ b/core/deployment/src/main/java/io/quarkus/deployment/configuration/RunTimeConfigurationGenerator.java @@ -1310,10 +1310,7 @@ private MethodDescriptor generateParserBody(final ConfigPatternMap ke if (matched instanceof FieldContainer) { final FieldContainer fieldContainer = (FieldContainer) matched; if (dynamic) { - if (!itemMember.getPropertyName().isEmpty()) { - // consume segment - matchedBody.invokeVirtualMethod(NI_PREVIOUS, keyIter); - } + generateConsumeSegments(matchedBody, keyIter, itemMember.getPropertyName()); // we have to get or create all containing (and contained) groups of this member matchedBody.invokeStaticMethod(generateGetEnclosing(fieldContainer, type), keyIter, config); @@ -1467,10 +1464,7 @@ private MethodDescriptor generateGetEnclosing(final FieldContainer matchNode, fi // get the parent final FieldContainer fieldContainer = (FieldContainer) parent; final ClassDefinition.ClassMember classMember = fieldContainer.getClassMember(); - if (!classMember.getPropertyName().isEmpty()) { - // consume segment - mc.invokeVirtualMethod(NI_PREVIOUS, keyIter); - } + generateConsumeSegments(mc, keyIter, classMember.getPropertyName()); final ResultHandle enclosing = mc.invokeStaticMethod(generateGetEnclosing(fieldContainer, type), keyIter, config); @@ -1576,10 +1570,7 @@ private MethodDescriptor generateGetEnclosing(final MapContainer matchNode, fina if (parent instanceof FieldContainer) { // get the parent final FieldContainer fieldContainer = (FieldContainer) parent; - if (!fieldContainer.getClassMember().getPropertyName().isEmpty()) { - // consume segment - mc.invokeVirtualMethod(NI_PREVIOUS, keyIter); - } + generateConsumeSegments(mc, keyIter, fieldContainer.getClassMember().getPropertyName()); final ResultHandle enclosing = mc.invokeStaticMethod(generateGetEnclosing(fieldContainer, type), keyIter, config); if (!fieldContainer.getClassMember().getPropertyName().isEmpty()) { @@ -1619,6 +1610,20 @@ private MethodDescriptor generateGetEnclosing(final MapContainer matchNode, fina return md; } + private void generateConsumeSegments(BytecodeCreator bc, ResultHandle keyIter, String propertyName) { + if (propertyName.isEmpty()) { + return; + } + bc.invokeVirtualMethod(NI_PREVIOUS, keyIter); + // For properties whose name contains dots, + // we need to call previous() multiple times + int dotIndex = propertyName.indexOf('.'); + while (dotIndex >= 0) { + bc.invokeVirtualMethod(NI_PREVIOUS, keyIter); + dotIndex = propertyName.indexOf('.', dotIndex + 1); + } + } + private FieldDescriptor getOrCreateConverterInstance(Field field) { return getOrCreateConverterInstance(field, ConverterType.of(field)); }