diff --git a/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java b/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java index c1d623485..a1a93804c 100644 --- a/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java +++ b/src/main/java/org/apache/commons/collections4/functors/InstantiateTransformer.java @@ -70,8 +70,6 @@ public class InstantiateTransformer implements Transformer if (paramTypes == null || paramTypes.length == 0) { return new InstantiateTransformer(); } - paramTypes = paramTypes.clone(); - args = args.clone(); return new InstantiateTransformer(paramTypes, args); } @@ -87,14 +85,16 @@ public class InstantiateTransformer implements Transformer /** * Constructor that performs no validation. * Use instantiateTransformer if you want that. + *

+ * Note: from 4.0, the input parameters will be cloned * - * @param paramTypes the constructor parameter types, not cloned - * @param args the constructor arguments, not cloned + * @param paramTypes the constructor parameter types + * @param args the constructor arguments */ public InstantiateTransformer(final Class[] paramTypes, final Object[] args) { super(); - iParamTypes = paramTypes; - iArgs = args; + iParamTypes = paramTypes.clone(); + iArgs = args.clone(); } /**