@JRubyMethod(name = "varargs?") public RubyBoolean varargs_p() { return getRuntime().newBoolean(isVarArgs()); }
@JRubyMethod(name = "varargs?") public RubyBoolean varargs_p() { return getRuntime().newBoolean(isVarArgs()); }
@JRubyMethod(name = "varargs?") public RubyBoolean varargs_p() { return getRuntime().newBoolean(isVarArgs()); }
@JRubyMethod(name = "varargs?") public RubyBoolean varargs_p() { return getRuntime().newBoolean(isVarArgs()); }
protected final T findCallableArityTwo(IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1) { T callable = this.javaCallable; if ( callable == null ) { // TODO: varargs? final T[] callablesForArity; if ( javaCallables.length <= 2 || (callablesForArity = javaCallables[2]) == null ) { if ((callable = matchVarArgsCallableArityTwo(self, arg0, arg1)) == null ) { throw runtime.newArgumentError(2, javaCallables.length - 1); } return callable; } callable = CallableSelector.matchingCallableArityTwo(runtime, this, callablesForArity, arg0, arg1); if ( callable == null ) { if ((callable = matchVarArgsCallableArityTwo(self, arg0, arg1)) == null ) { throw newErrorDueArgumentTypeMismatch(self, callablesForArity, arg0, arg1); } } } else { if (!callable.isVarArgs()) checkCallableArity(callable, 2); } return callable; }
protected final T findCallableArityThree(IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { T callable = this.javaCallable; if ( callable == null ) { // TODO: varargs? final T[] callablesForArity; if ( javaCallables.length <= 3 || (callablesForArity = javaCallables[3]) == null ) { if ( ( callable = matchVarArgsCallableArityThree(self, arg0, arg1, arg2) ) == null ) { throw runtime.newArgumentError(3, javaCallables.length - 1); } return callable; } callable = CallableSelector.matchingCallableArityThree(runtime, this, callablesForArity, arg0, arg1, arg2); if ( callable == null ) { if ( ( callable = matchVarArgsCallableArityThree(self, arg0, arg1, arg2) ) == null ) { throw newErrorDueArgumentTypeMismatch(self, callablesForArity, arg0, arg1, arg2); } } } else { if (!callable.isVarArgs()) checkCallableArity(callable, 3); } return callable; }
protected final T findCallableArityZero(IRubyObject self, String name) { T callable = this.javaCallable; if ( callable == null ) { final T[] callablesForArity; if ( javaCallables.length == 0 || (callablesForArity = javaCallables[0]) == null ) { if ( ( callable = matchVarArgsCallableArityZero(self) ) == null ) { throw newErrorDueNoMatchingCallable(self, name); } return callable; } callable = CallableSelector.matchingCallableArityZero(runtime, this, callablesForArity); if ( callable == null ) { if ((callable = matchVarArgsCallableArityZero(self)) == null ) { throw newErrorDueArgumentTypeMismatch(self, callablesForArity); } } } else { if (!callable.isVarArgs()) checkCallableArity(callable, 0); } return callable; }
protected final T findCallableArityTwo(IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1) { T callable = this.javaCallable; if ( callable == null ) { // TODO: varargs? final T[] callablesForArity; if ( javaCallables.length <= 2 || (callablesForArity = javaCallables[2]) == null ) { if ((callable = matchVarArgsCallableArityTwo(self, arg0, arg1)) == null ) { throw runtime.newArgumentError(2, javaCallables.length - 1); } return callable; } callable = CallableSelector.matchingCallableArityTwo(runtime, this, callablesForArity, arg0, arg1); if ( callable == null ) { if ((callable = matchVarArgsCallableArityTwo(self, arg0, arg1)) == null ) { throw newErrorDueArgumentTypeMismatch(self, callablesForArity, arg0, arg1); } } } else { if (!callable.isVarArgs()) checkCallableArity(callable, 2); } return callable; }
protected final T findCallableArityFour(IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) { T callable = this.javaCallable; if ( callable == null ) { // TODO: varargs? final T[] callablesForArity; if ( javaCallables.length <= 4 || (callablesForArity = javaCallables[4]) == null ) { if ( ( callable = matchVarArgsCallableArityFour(self, arg0, arg1, arg2, arg3) ) == null ) { throw runtime.newArgumentError(4, javaCallables.length - 1); } return callable; } callable = CallableSelector.matchingCallableArityFour(runtime, this, callablesForArity, arg0, arg1, arg2, arg3); if ( callable == null ) { if ( ( callable = matchVarArgsCallableArityFour(self, arg0, arg1, arg2, arg3) ) == null ) { throw newErrorDueArgumentTypeMismatch(self, callablesForArity, arg0, arg1, arg2, arg3); } } } else { if (!callable.isVarArgs()) checkCallableArity(callable, 4); } return callable; }
private T findCallableArityN(IRubyObject self, String name, IRubyObject[] args, int arity) { T callable = this.javaCallable; if ( callable == null ) { final T[] callablesForArity; if ( arity >= javaCallables.length || (callablesForArity = javaCallables[arity]) == null ) { if ( ( callable = matchVarArgsCallableArityN(self, args) ) == null ) { throw runtime.newArgumentError(args.length, javaCallables.length - 1); } return callable; } callable = CallableSelector.matchingCallableArityN(runtime, this, callablesForArity, args); if ( callable == null ) { if ( ( callable = matchVarArgsCallableArityN(self, args) ) == null ) { throw newErrorDueArgumentTypeMismatch(self, callablesForArity, args); } } } else { if (!callable.isVarArgs()) checkCallableArity(callable, args.length); } return callable; }
protected final T findCallableArityFour(IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) { T callable = this.javaCallable; if ( callable == null ) { // TODO: varargs? final T[] callablesForArity; if ( javaCallables.length <= 4 || (callablesForArity = javaCallables[4]) == null ) { if ( ( callable = matchVarArgsCallableArityFour(self, arg0, arg1, arg2, arg3) ) == null ) { throw runtime.newArgumentError(4, javaCallables.length - 1); } return callable; } callable = CallableSelector.matchingCallableArityFour(runtime, this, callablesForArity, arg0, arg1, arg2, arg3); if ( callable == null ) { if ( ( callable = matchVarArgsCallableArityFour(self, arg0, arg1, arg2, arg3) ) == null ) { throw newErrorDueArgumentTypeMismatch(self, callablesForArity, arg0, arg1, arg2, arg3); } } } else { if (!callable.isVarArgs()) checkCallableArity(callable, 4); } return callable; }
private T findCallableArityN(IRubyObject self, String name, IRubyObject[] args, int arity) { T callable = this.javaCallable; if ( callable == null ) { final T[] callablesForArity; if ( arity >= javaCallables.length || (callablesForArity = javaCallables[arity]) == null ) { if ( ( callable = matchVarArgsCallableArityN(self, args) ) == null ) { throw runtime.newArgumentError(args.length, javaCallables.length - 1); } return callable; } callable = CallableSelector.matchingCallableArityN(runtime, this, callablesForArity, args); if ( callable == null ) { if ( ( callable = matchVarArgsCallableArityN(self, args) ) == null ) { throw newErrorDueArgumentTypeMismatch(self, callablesForArity, args); } } } else { if (!callable.isVarArgs()) checkCallableArity(callable, args.length); } return callable; }
protected final T findCallableArityOne(IRubyObject self, String name, IRubyObject arg0) { T callable = this.javaCallable; if ( callable == null ) { // TODO: varargs? final T[] callablesForArity; if ( javaCallables.length <= 1 || (callablesForArity = javaCallables[1]) == null ) { if ((callable = matchVarArgsCallableArityOne(self, arg0)) == null) { throw runtime.newArgumentError(1, javaCallables.length - 1); } return callable; } callable = CallableSelector.matchingCallableArityOne(runtime, this, callablesForArity, arg0); if ( callable == null ) { if ((callable = matchVarArgsCallableArityOne(self, arg0)) == null ) { throw newErrorDueArgumentTypeMismatch(self, callablesForArity, arg0); } } } else { if (!callable.isVarArgs()) checkCallableArity(callable, 1); } return callable; }
protected final T findCallableArityZero(IRubyObject self, String name) { T callable = this.javaCallable; if ( callable == null ) { final T[] callablesForArity; if ( javaCallables.length == 0 || (callablesForArity = javaCallables[0]) == null ) { if ( ( callable = matchVarArgsCallableArityZero(self) ) == null ) { throw newErrorDueNoMatchingCallable(self, name); } return callable; } callable = CallableSelector.matchingCallableArityZero(runtime, this, callablesForArity); if ( callable == null ) { if ((callable = matchVarArgsCallableArityZero(self)) == null ) { throw newErrorDueArgumentTypeMismatch(self, callablesForArity); } } } else { if (!callable.isVarArgs()) checkCallableArity(callable, 0); } return callable; }
protected final T findCallableArityOne(IRubyObject self, String name, IRubyObject arg0) { T callable = this.javaCallable; if ( callable == null ) { // TODO: varargs? final T[] callablesForArity; if ( javaCallables.length <= 1 || (callablesForArity = javaCallables[1]) == null ) { if ((callable = matchVarArgsCallableArityOne(self, arg0)) == null) { throw runtime.newArgumentError(1, javaCallables.length - 1); } return callable; } callable = CallableSelector.matchingCallableArityOne(runtime, this, callablesForArity, arg0); if ( callable == null ) { if ((callable = matchVarArgsCallableArityOne(self, arg0)) == null ) { throw newErrorDueArgumentTypeMismatch(self, callablesForArity, arg0); } } } else { if (!callable.isVarArgs()) checkCallableArity(callable, 1); } return callable; }
protected final T findCallableArityThree(IRubyObject self, String name, IRubyObject arg0, IRubyObject arg1, IRubyObject arg2) { T callable = this.javaCallable; if ( callable == null ) { // TODO: varargs? final T[] callablesForArity; if ( javaCallables.length <= 3 || (callablesForArity = javaCallables[3]) == null ) { if ( ( callable = matchVarArgsCallableArityThree(self, arg0, arg1, arg2) ) == null ) { throw runtime.newArgumentError(3, javaCallables.length - 1); } return callable; } callable = CallableSelector.matchingCallableArityThree(runtime, this, callablesForArity, arg0, arg1, arg2); if ( callable == null ) { if ( ( callable = matchVarArgsCallableArityThree(self, arg0, arg1, arg2) ) == null ) { throw newErrorDueArgumentTypeMismatch(self, callablesForArity, arg0, arg1, arg2); } } } else { if (!callable.isVarArgs()) checkCallableArity(callable, 3); } return callable; }
@SuppressWarnings("unchecked") // NULL_CACHE RubyToJavaInvoker(RubyModule host, Member member, String name) { super(host, Visibility.PUBLIC, name); this.runtime = host.getRuntime(); final T callable; T[] varargsCallables = null; int minVarArgsArity = -1; callable = createCallable(runtime, member); int minArity = callable.getArity(); if ( callable.isVarArgs() ) { // TODO does it need to happen? varargsCallables = createCallableArray(callable); minVarArgsArity = getMemberArity(member) - 1; } cache = NULL_CACHE; // if there's a single callable - matching (and thus the cache) won't be used this.javaCallable = callable; this.javaCallables = null; this.javaVarargsCallables = varargsCallables; setArity(minArity, minArity, minVarArgsArity); setupNativeCall(); }
@SuppressWarnings("unchecked") // NULL_CACHE RubyToJavaInvoker(RubyModule host, Member member, String name) { super(host, Visibility.PUBLIC, name); this.runtime = host.getRuntime(); final T callable; T[] varargsCallables = null; int minVarArgsArity = -1; callable = createCallable(runtime, member); int minArity = callable.getArity(); if ( callable.isVarArgs() ) { // TODO does it need to happen? varargsCallables = createCallableArray(callable); minVarArgsArity = getMemberArity(member) - 1; } cache = NULL_CACHE; // if there's a single callable - matching (and thus the cache) won't be used this.javaCallable = callable; this.javaCallables = null; this.javaVarargsCallables = varargsCallables; setArity(minArity, minArity, minVarArgsArity); setupNativeCall(); }
if (!callable.isVarArgs() && callable.getParameterTypes().length != args.length) { throw self.getRuntime().newArgumentError(args.length, callable.getParameterTypes().length);
if (!callable.isVarArgs() && callable.getParameterTypes().length != args.length) { throw self.getRuntime().newArgumentError(args.length, callable.getParameterTypes().length);