diff --git a/src/main/java/org/codehaus/groovy/runtime/metaclass/ClosureMetaClass.java b/src/main/java/org/codehaus/groovy/runtime/metaclass/ClosureMetaClass.java index 04585f83c69..ffd574e3835 100644 --- a/src/main/java/org/codehaus/groovy/runtime/metaclass/ClosureMetaClass.java +++ b/src/main/java/org/codehaus/groovy/runtime/metaclass/ClosureMetaClass.java @@ -145,9 +145,10 @@ public Object chooseMethod(final Class[] arguments, final boolean coerce) { } else if (arguments.length == 1 && arguments[0] == null) { return MetaClassHelper.chooseMostGeneralMethodWith1NullParam(methods); } else { - List matchingMethods = new ArrayList(); final Object[] data = methods.getArray(); - for (int i = 0, n = methods.size(); i < n; i += 1) { + final int length = data.length; + List matchingMethods = new ArrayList(length); + for (int i = 0; i < length; i += 1) { Object method = data[i]; // making this false helps find matches