This is an automated email from the ASF dual-hosted git repository. gnodet pushed a commit to branch feature/optimize-composite-bean-helper-performance in repository https://gitbox.apache.org/repos/asf/maven.git
commit f0e55066df13eefd01934ff2f8d0520d07918c51 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Thu Jul 3 21:39:29 2025 +0200 Extract common code --- .../internal/OptimizedCompositeBeanHelper.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/impl/maven-core/src/main/java/org/apache/maven/configuration/internal/OptimizedCompositeBeanHelper.java b/impl/maven-core/src/main/java/org/apache/maven/configuration/internal/OptimizedCompositeBeanHelper.java index f84abee1f8..2cfe8eb701 100644 --- a/impl/maven-core/src/main/java/org/apache/maven/configuration/internal/OptimizedCompositeBeanHelper.java +++ b/impl/maven-core/src/main/java/org/apache/maven/configuration/internal/OptimizedCompositeBeanHelper.java @@ -247,13 +247,7 @@ private Object convertPropertyForMethod( throws ComponentConfigurationException { TypeLiteral<?> paramType = TypeLiteral.get(methodInfo.parameterType); - Class<?> rawPropertyType = paramType.getRawType(); - - if (valueType != null && rawPropertyType.isAssignableFrom(valueType)) { - rawPropertyType = valueType; // pick more specific type - } - - return convertProperty(beanType, rawPropertyType, paramType.getType(), configuration); + return convertProperty(beanType, valueType, configuration, paramType); } /** @@ -264,13 +258,19 @@ private Object convertPropertyForField( throws ComponentConfigurationException { TypeLiteral<?> fieldType = TypeLiteral.get(field.getGenericType()); - Class<?> rawPropertyType = fieldType.getRawType(); + return convertProperty(beanType, valueType, configuration, fieldType); + } + + private Object convertProperty( + Class<?> beanType, Class<?> valueType, PlexusConfiguration configuration, TypeLiteral<?> paramType) + throws ComponentConfigurationException { + Class<?> rawPropertyType = paramType.getRawType(); if (valueType != null && rawPropertyType.isAssignableFrom(valueType)) { rawPropertyType = valueType; // pick more specific type } - return convertProperty(beanType, rawPropertyType, fieldType.getType(), configuration); + return convertProperty(beanType, rawPropertyType, paramType.getType(), configuration); } /**