private static boolean assignable(Class<?> type, final IRubyObject arg) { return JavaClass.assignable(type, getJavaClass(arg)) || // handle 'native' signatures e.g. method with a (org.jruby.RubyArray arg) ( arg != null && type.isAssignableFrom(arg.getClass()) ); }
final Class<?> argClass = getJavaClass(arg); if (type.isPrimitive()) {
private static boolean assignable(Class<?> type, final IRubyObject arg) { return JavaClass.assignable(type, getJavaClass(arg)) || // handle 'native' signatures e.g. method with a (org.jruby.RubyArray arg) ( arg != null && type.isAssignableFrom(arg.getClass()) ); }
final Class<?> argClass = getJavaClass(arg); if (type.isPrimitive()) {
private static boolean duckable(final Class<?> type, final IRubyObject arg) { return JavaUtil.isDuckTypeConvertable(getJavaClass(arg), type); }
private static boolean duckable(final Class<?> type, final IRubyObject arg) { return JavaUtil.isDuckTypeConvertable(getJavaClass(arg), type); }
private static int calcExactnessScore(final ParameterTypes callable, final IRubyObject[] args) { final Class[] types = callable.getParameterTypes(); int count = 0; if ( callable.isVarArgs() ) { // varargs exactness gives the last N args as +1 since they'll already // have been determined to fit // dig out as many trailing args as possible that match varargs type final int nonVarargs = types.length - 1; count += 1; // add one for vararg // check remaining args for (int i = 0; i < nonVarargs && i < args.length; i++) { if ( types[i] == getJavaClass(args[i]) ) count++; } } else { for (int i = 0; i < args.length; i++) { if ( types[i] == getJavaClass(args[i]) ) count++; } } return count; }
private static int calcExactnessScore(final ParameterTypes callable, final IRubyObject[] args) { final Class[] types = callable.getParameterTypes(); int count = 0; if ( callable.isVarArgs() ) { // varargs exactness gives the last N args as +1 since they'll already // have been determined to fit // dig out as many trailing args as possible that match varargs type final int nonVarargs = types.length - 1; count += 1; // add one for vararg // check remaining args for (int i = 0; i < nonVarargs && i < args.length; i++) { if ( types[i] == getJavaClass(args[i]) ) count++; } } else { for (int i = 0; i < args.length; i++) { if ( types[i] == getJavaClass(args[i]) ) count++; } } return count; }