}
throw proxy.getRuntime().newArgumentError("no " + name + " with arguments matching " + Arrays.toString(argTypes) + " on object " + proxy.getMetaClass());
}
protected JavaCallable findCallable(IRubyObject self, String name, IRubyObject[] args, int arity) {
JavaCallable callable;
if ((callable = javaCallable) == null) {
JavaCallable[] callablesForArity = null;
if (arity >= javaCallables.length || (callablesForArity = javaCallables[arity]) == null) {
if (javaVarargsCallables != null) {
callable = CallableSelector.matchingCallableArityN(cache, javaVarargsCallables, args, arity);
if (callable == null) {
throw CallableSelector.argTypesDoNotMatch(self.getRuntime(), self, javaVarargsCallables, (Object[])args);
}
return callable;
} else {
throw self.getRuntime().newArgumentError(args.length, javaCallables.length - 1);
}
}
callable = CallableSelector.matchingCallableArityN(cache, callablesForArity, args, arity);
if (callable == null && javaVarargsCallables != null) {
callable = CallableSelector.matchingCallableArityN(cache, javaVarargsCallables, args, arity);
if (callable == null) {
throw CallableSelector.argTypesDoNotMatch(self.getRuntime(), self, javaVarargsCallables, (Object[])args);
}
return callable;
}
if (callable == null) {
throw CallableSelector.argTypesDoNotMatch(self.getRuntime(), self, callablesForArity, (Object[])args);
}
} else {
if (!callable.isVarArgs() && callable.getParameterTypes().length != args.length) {
throw self.getRuntime().newArgumentError(args.length, callable.getParameterTypes().length);
}
}
return callable;
}