}
private static final boolean DEBUG = true;
private static ParameterTypes findMatchingCallableForArgs(Ruby runtime, Map cache, int signatureCode, ParameterTypes[] methods, IRubyObject... args) {
ParameterTypes method = null;
// try the new way first
List<ParameterTypes> newFinds = findCallable(methods, args);
if (newFinds.size() > 0) {
// new way found one, so let's go with that
if (newFinds.size() == 1) {
method = newFinds.get(0);
} else {
// narrow to most specific version (or first version, if none are more specific
ParameterTypes mostSpecific = null;
Class[] msTypes = null;
boolean ambiguous = false;
OUTER: for (ParameterTypes candidate : newFinds) {
if (mostSpecific == null) {
mostSpecific = candidate;
msTypes = mostSpecific.getParameterTypes();
continue;
}
Class[] cTypes = candidate.getParameterTypes();