@@ -76,8 +76,6 @@ public abstract class AbstractNestablePropertyAccessor extends AbstractPropertyA
7676 */
7777 private static final Log logger = LogFactory .getLog (AbstractNestablePropertyAccessor .class );
7878
79- private int autoGrowCollectionLimit = Integer .MAX_VALUE ;
80-
8179 @ Nullable Object wrappedObject ;
8280
8381 private String nestedPath = "" ;
@@ -156,21 +154,6 @@ protected AbstractNestablePropertyAccessor(Object object, String nestedPath, Abs
156154 }
157155
158156
159- /**
160- * Specify a limit for array and collection auto-growing.
161- * <p>Default is unlimited on a plain accessor.
162- */
163- public void setAutoGrowCollectionLimit (int autoGrowCollectionLimit ) {
164- this .autoGrowCollectionLimit = autoGrowCollectionLimit ;
165- }
166-
167- /**
168- * Return the limit for array and collection auto-growing.
169- */
170- public int getAutoGrowCollectionLimit () {
171- return this .autoGrowCollectionLimit ;
172- }
173-
174157 /**
175158 * Switch the target object, replacing the cached introspection results only
176159 * if the class of the new object is different to that of the replaced object.
@@ -298,7 +281,7 @@ private void processKeyedProperty(PropertyTokenHolder tokens, PropertyValue pv)
298281 Object convertedValue = convertIfNecessary (tokens .canonicalName , oldValue , pv .getValue (),
299282 componentType , ph .nested (tokens .keys .length ));
300283 int length = Array .getLength (propValue );
301- if (arrayIndex >= length && arrayIndex < this . autoGrowCollectionLimit ) {
284+ if (arrayIndex >= length && arrayIndex < getAutoGrowCollectionLimit () ) {
302285 Object newArray = Array .newInstance (componentType , arrayIndex + 1 );
303286 System .arraycopy (propValue , 0 , newArray , 0 , length );
304287 int lastKeyIndex = tokens .canonicalName .lastIndexOf ('[' );
@@ -324,7 +307,7 @@ else if (propValue instanceof List list) {
324307 Object convertedValue = convertIfNecessary (tokens .canonicalName , oldValue , pv .getValue (),
325308 requiredType .getResolvableType ().resolve (), requiredType );
326309 int size = list .size ();
327- if (index >= size && index < this . autoGrowCollectionLimit ) {
310+ if (index >= size && index < getAutoGrowCollectionLimit () ) {
328311 for (int i = size ; i < index ; i ++) {
329312 try {
330313 list .add (null );
@@ -761,7 +744,7 @@ private Object growArrayIfNecessary(Object array, int index, String name) {
761744 return array ;
762745 }
763746 int length = Array .getLength (array );
764- if (index >= length && index < this . autoGrowCollectionLimit ) {
747+ if (index >= length && index < getAutoGrowCollectionLimit () ) {
765748 Class <?> componentType = array .getClass ().componentType ();
766749 Object newArray = Array .newInstance (componentType , index + 1 );
767750 System .arraycopy (array , 0 , newArray , 0 , length );
@@ -785,7 +768,7 @@ private void growCollectionIfNecessary(Collection<Object> collection, int index,
785768 return ;
786769 }
787770 int size = collection .size ();
788- if (index >= size && index < this . autoGrowCollectionLimit ) {
771+ if (index >= size && index < getAutoGrowCollectionLimit () ) {
789772 Class <?> elementType = ph .getResolvableType ().getNested (nestingLevel ).asCollection ().resolveGeneric ();
790773 if (elementType != null ) {
791774 for (int i = collection .size (); i < index + 1 ; i ++) {
0 commit comments