diff --git a/src/main/java/org/apache/ibatis/executor/loader/ResultLoaderMap.java b/src/main/java/org/apache/ibatis/executor/loader/ResultLoaderMap.java index e7f85681174..d8f578a2137 100644 --- a/src/main/java/org/apache/ibatis/executor/loader/ResultLoaderMap.java +++ b/src/main/java/org/apache/ibatis/executor/loader/ResultLoaderMap.java @@ -90,7 +90,7 @@ public void remove(String property) { public void loadAll() throws SQLException { final Set methodNameSet = loaderMap.keySet(); - String[] methodNames = methodNameSet.toArray(new String[methodNameSet.size()]); + String[] methodNames = methodNameSet.toArray(new String[0]); for (String methodName : methodNames) { load(methodName); } diff --git a/src/main/java/org/apache/ibatis/executor/loader/cglib/CglibProxyFactory.java b/src/main/java/org/apache/ibatis/executor/loader/cglib/CglibProxyFactory.java index 3168ebaed67..6ebc0224fac 100644 --- a/src/main/java/org/apache/ibatis/executor/loader/cglib/CglibProxyFactory.java +++ b/src/main/java/org/apache/ibatis/executor/loader/cglib/CglibProxyFactory.java @@ -93,8 +93,8 @@ static Object createStaticProxy(Class type, Callback callback, List> if (constructorArgTypes.isEmpty()) { enhanced = enhancer.create(); } else { - Class[] typesArray = constructorArgTypes.toArray(new Class[constructorArgTypes.size()]); - Object[] valuesArray = constructorArgs.toArray(new Object[constructorArgs.size()]); + Class[] typesArray = constructorArgTypes.toArray(new Class[0]); + Object[] valuesArray = constructorArgs.toArray(new Object[0]); enhanced = enhancer.create(typesArray, valuesArray); } return enhanced; diff --git a/src/main/java/org/apache/ibatis/executor/loader/javassist/JavassistProxyFactory.java b/src/main/java/org/apache/ibatis/executor/loader/javassist/JavassistProxyFactory.java index cf8c307a330..dcb47b41413 100644 --- a/src/main/java/org/apache/ibatis/executor/loader/javassist/JavassistProxyFactory.java +++ b/src/main/java/org/apache/ibatis/executor/loader/javassist/JavassistProxyFactory.java @@ -87,8 +87,8 @@ static Object createStaticProxy(Class type, MethodHandler callback, List[] typesArray = constructorArgTypes.toArray(new Class[constructorArgTypes.size()]); - Object[] valuesArray = constructorArgs.toArray(new Object[constructorArgs.size()]); + Class[] typesArray = constructorArgTypes.toArray(new Class[0]); + Object[] valuesArray = constructorArgs.toArray(new Object[0]); try { enhanced = enhancer.create(typesArray, valuesArray); } catch (Exception e) { diff --git a/src/test/java/org/apache/ibatis/submitted/custom_collection_handling/CustomObjectFactory.java b/src/test/java/org/apache/ibatis/submitted/custom_collection_handling/CustomObjectFactory.java index bd486f14c34..3d66b8b4bc9 100644 --- a/src/test/java/org/apache/ibatis/submitted/custom_collection_handling/CustomObjectFactory.java +++ b/src/test/java/org/apache/ibatis/submitted/custom_collection_handling/CustomObjectFactory.java @@ -53,11 +53,11 @@ private T instantiateClass(Class type, List> constructorArgTypes } return constructor.newInstance(); } - constructor = type.getDeclaredConstructor(constructorArgTypes.toArray(new Class[constructorArgTypes.size()])); + constructor = type.getDeclaredConstructor(constructorArgTypes.toArray(new Class[0])); if (!constructor.isAccessible()) { constructor.setAccessible(true); } - return constructor.newInstance(constructorArgs.toArray(new Object[constructorArgs.size()])); + return constructor.newInstance(constructorArgs.toArray(new Object[0])); } catch (Exception e) { StringBuilder argTypes = new StringBuilder(); if (constructorArgTypes != null) {