private T matchVarArgsCallableArityN(IRubyObject self, IRubyObject[] args) { final T[] varArgsCallables = this.javaVarargsCallables; if ( varArgsCallables != null ) { T callable = CallableSelector.matchingCallableArityN(runtime, this, varArgsCallables, args); if ( callable == null ) { throw newErrorDueArgumentTypeMismatch(self, varArgsCallables, args); } return callable; } return null; }
private T matchVarArgsCallableArityN(IRubyObject self, IRubyObject[] args) { final T[] varArgsCallables = this.javaVarargsCallables; if ( varArgsCallables != null ) { T callable = CallableSelector.matchingCallableArityN(runtime, this, varArgsCallables, args); if ( callable == null ) { throw newErrorDueArgumentTypeMismatch(self, varArgsCallables, args); } return callable; } return null; }
private JavaProxyConstructor matchConstructor(final ThreadContext context, final JavaProxyConstructor[] constructors, final int arity, final IRubyObject... args) { ArrayList<JavaProxyConstructor> forArity = findCallablesForArity(arity, constructors); if ( forArity.size() == 0 ) { throw context.runtime.newArgumentError("wrong number of arguments for constructor"); } final JavaProxyConstructor matching = CallableSelector.matchingCallableArityN( context.runtime, this, forArity.toArray(new JavaProxyConstructor[forArity.size()]), args ); if ( matching == null ) { throw context.runtime.newArgumentError("wrong number of arguments for constructor"); } return matching; }
private JavaProxyConstructor matchConstructor(final ThreadContext context, final JavaProxyConstructor[] constructors, final int arity, final IRubyObject... args) { ArrayList<JavaProxyConstructor> forArity = findCallablesForArity(arity, constructors); if ( forArity.size() == 0 ) { throw context.runtime.newArgumentError("wrong number of arguments for constructor"); } final JavaProxyConstructor matching = CallableSelector.matchingCallableArityN( context.runtime, this, forArity.toArray(new JavaProxyConstructor[forArity.size()]), args ); if ( matching == null ) { throw context.runtime.newArgumentError("wrong number of arguments for constructor"); } return matching; }
private JavaProxyConstructor matchConstructor0(final ThreadContext context, final JavaProxyConstructor[] constructors, final int arity, final IRubyObject[] args) { JavaProxyConstructor forArity = checkCallableForArity(arity, constructors, 0); if ( forArity == null ) { throw context.runtime.newArgumentError("wrong number of arguments for constructor"); } final JavaProxyConstructor matching = CallableSelector.matchingCallableArityN( context.runtime, this, new JavaProxyConstructor[] { forArity }, args ); if ( matching == null ) { throw context.runtime.newArgumentError("wrong number of arguments for constructor"); } return matching; }
private JavaProxyConstructor matchConstructor0(final ThreadContext context, final JavaProxyConstructor[] constructors, final int arity, final IRubyObject[] args) { JavaProxyConstructor forArity = checkCallableForArity(arity, constructors, 0); if ( forArity == null ) { throw context.runtime.newArgumentError("wrong number of arguments for constructor"); } final JavaProxyConstructor matching = CallableSelector.matchingCallableArityN( context.runtime, this, new JavaProxyConstructor[] { forArity }, args ); if ( matching == null ) { throw context.runtime.newArgumentError("wrong number of arguments for constructor"); } return matching; }
if (arity >= javaCallables.length || (callablesForArity = javaCallables[arity]) == null) { if (javaVarargsCallables != null) { callable = CallableSelector.matchingCallableArityN(runtime, cache, javaVarargsCallables, args, arity); if (callable == null) { throw CallableSelector.argTypesDoNotMatch(self.getRuntime(), self, javaVarargsCallables, (Object[])args); callable = CallableSelector.matchingCallableArityN(runtime, cache, callablesForArity, args, arity); if (callable == null && javaVarargsCallables != null) { callable = CallableSelector.matchingCallableArityN(runtime, cache, javaVarargsCallables, args, arity); if (callable == null) { throw CallableSelector.argTypesDoNotMatch(self.getRuntime(), self, javaVarargsCallables, (Object[])args);
if (arity >= javaCallables.length || (callablesForArity = javaCallables[arity]) == null) { if (javaVarargsCallables != null) { callable = CallableSelector.matchingCallableArityN(runtime, cache, javaVarargsCallables, args, arity); if (callable == null) { throw CallableSelector.argTypesDoNotMatch(self.getRuntime(), self, javaVarargsCallables, (Object[])args); callable = CallableSelector.matchingCallableArityN(runtime, cache, callablesForArity, args, arity); if (callable == null && javaVarargsCallables != null) { callable = CallableSelector.matchingCallableArityN(runtime, cache, javaVarargsCallables, args, arity); if (callable == null) { throw CallableSelector.argTypesDoNotMatch(self.getRuntime(), self, javaVarargsCallables, (Object[])args);
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; }
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; }
JavaProxyConstructor matching = (JavaProxyConstructor)CallableSelector.matchingCallableArityN( runtime, methodCache, forArity.toArray(new JavaProxyConstructor[forArity.size()]), args, args.length);
JavaProxyConstructor matching = (JavaProxyConstructor)CallableSelector.matchingCallableArityN( runtime, methodCache, forArity.toArray(new JavaProxyConstructor[forArity.size()]), args, args.length);