Use Arrays.copyOf and Arrays.copyOfRange where possible

Closes gh-23393
This commit is contained in:
stsypanov
2019-07-31 19:17:22 +03:00
committed by Sam Brannen
parent 216ffcfe62
commit 78d56dc61b
5 changed files with 6 additions and 12 deletions

View File

@@ -25,6 +25,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -721,8 +722,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
synchronized (this) {
if (!this.cached) {
if (arguments != null) {
Object[] cachedMethodArguments = new Object[paramTypes.length];
System.arraycopy(descriptors, 0, cachedMethodArguments, 0, arguments.length);
DependencyDescriptor[] cachedMethodArguments = Arrays.copyOf(descriptors, arguments.length);
registerDependentBeans(beanName, autowiredBeans);
if (autowiredBeans.size() == paramTypes.length) {
Iterator<String> it = autowiredBeans.iterator();