diff --git a/spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java b/spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java index 146d3ba67d8..4c8dcc48dd0 100644 --- a/spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java +++ b/spring-beans/src/main/java/org/springframework/beans/AbstractNestablePropertyAccessor.java @@ -933,21 +933,16 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA * @param arrayType the desired type of the target array * @return a new array instance */ - private Object createArray(Class arrayType) { + private static Object createArray(Class arrayType) { Assert.notNull(arrayType, "Array type must not be null"); - if (arrayType.isArray()) { - Class componentType = arrayType.componentType(); - if (componentType.isArray()) { - Object array = Array.newInstance(componentType, 1); - Array.set(array, 0, createArray(componentType)); - return array; - } - else { - return Array.newInstance(componentType, 0); - } + Class componentType = arrayType.componentType(); + if (componentType.isArray()) { + Object array = Array.newInstance(componentType, 1); + Array.set(array, 0, createArray(componentType)); + return array; } else { - throw new IllegalArgumentException("Unsupported Array type: " + arrayType.getName()); + return Array.newInstance(componentType, 0); } } diff --git a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java index 99ca349a6a7..f83258ae738 100644 --- a/spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/BeanWrapperAutoGrowingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2024 the original author or authors. + * Copyright 2002-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.