// returns Int.MAX_VALUE if not applicable // returns -score if conversions are needed // or +score if no conversions are needed // Lower score is better static int methodApplicabilityScore_withPrimitiveWidening(Executable m, O[] args) { Class[] types = m.getParameterTypes(); if (types.length != l(args)) ret Int.MAX_VALUE; int score = 0; bool widenings; for (int i = 0; i < types.length; i++) { O a = args[i]; Class c = types[i]; // null can be assigned to any non-primitive type if (a == null) { if (c.isPrimitive()) ret Int.MAX_VALUE; } else { Class t = a.getClass(); int s = typeConversionScoreWithUnboxing(t, c); printVars ifdef typeConversionScore_debug("typeConversionScoreWithUnboxing", +t, +c, +s); if (s == Int.MAX_VALUE) ret Int.MAX_VALUE; if (s < 0) set widenings; score += abs(s); } } ret widenings ? -score : score; }