From 992ae2ea6bdd82efed20247836a4ca0f9b781635 Mon Sep 17 00:00:00 2001 From: Sam Brannen <104798+sbrannen@users.noreply.github.com> Date: Thu, 8 Jan 2026 13:34:03 +0100 Subject: [PATCH] Precompute PropertyDescriptor array in SimpleBeanInfoFactory Closes gh-36112 --- .../org/springframework/beans/SimpleBeanInfoFactory.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/SimpleBeanInfoFactory.java b/spring-beans/src/main/java/org/springframework/beans/SimpleBeanInfoFactory.java index 6b0e5d0234e..750e5cfb368 100644 --- a/spring-beans/src/main/java/org/springframework/beans/SimpleBeanInfoFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/SimpleBeanInfoFactory.java @@ -21,7 +21,6 @@ import java.beans.BeanInfo; import java.beans.IntrospectionException; import java.beans.PropertyDescriptor; import java.beans.SimpleBeanInfo; -import java.util.Collection; import org.springframework.core.Ordered; @@ -48,8 +47,8 @@ class SimpleBeanInfoFactory implements BeanInfoFactory, Ordered { @Override public BeanInfo getBeanInfo(Class beanClass) throws IntrospectionException { - Collection pds = - PropertyDescriptorUtils.determineBasicProperties(beanClass); + PropertyDescriptor[] pds = PropertyDescriptorUtils.determineBasicProperties(beanClass) + .toArray(PropertyDescriptorUtils.EMPTY_PROPERTY_DESCRIPTOR_ARRAY); return new SimpleBeanInfo() { @Override @@ -58,7 +57,7 @@ class SimpleBeanInfoFactory implements BeanInfoFactory, Ordered { } @Override public PropertyDescriptor[] getPropertyDescriptors() { - return pds.toArray(PropertyDescriptorUtils.EMPTY_PROPERTY_DESCRIPTOR_ARRAY); + return pds; } }; }