@@ -115,7 +115,7 @@ public DisposableBeanAdapter(Object bean, String beanName, RootBeanDefinition be
115
115
(bean instanceof AutoCloseable && CLOSE_METHOD_NAME .equals (destroyMethodNames [0 ]));
116
116
if (!this .invokeAutoCloseable ) {
117
117
this .destroyMethodNames = destroyMethodNames ;
118
- Method [] destroyMethods = new Method [ destroyMethodNames .length ] ;
118
+ List < Method > destroyMethods = new ArrayList <>( destroyMethodNames .length ) ;
119
119
for (int i = 0 ; i < destroyMethodNames .length ; i ++) {
120
120
String destroyMethodName = destroyMethodNames [i ];
121
121
Method destroyMethod = determineDestroyMethod (destroyMethodName );
@@ -138,10 +138,10 @@ else if (paramTypes.length == 1 && boolean.class != paramTypes[0]) {
138
138
}
139
139
}
140
140
destroyMethod = ClassUtils .getInterfaceMethodIfPossible (destroyMethod , bean .getClass ());
141
+ destroyMethods .add (destroyMethod );
141
142
}
142
- destroyMethods [i ] = destroyMethod ;
143
143
}
144
- this .destroyMethods = destroyMethods ;
144
+ this .destroyMethods = destroyMethods . toArray ( Method []:: new ) ;
145
145
}
146
146
}
147
147
@@ -236,9 +236,7 @@ public void destroy() {
236
236
}
237
237
else if (this .destroyMethods != null ) {
238
238
for (Method destroyMethod : this .destroyMethods ) {
239
- if (destroyMethod != null ) {
240
- invokeCustomDestroyMethod (destroyMethod );
241
- }
239
+ invokeCustomDestroyMethod (destroyMethod );
242
240
}
243
241
}
244
242
else if (this .destroyMethodNames != null ) {
0 commit comments