// Can a be converted to b? // score 0 = exact match // score Int.MAX_VALUE = no match // score 1 = conversion needed (boxing/unboxing or non-primitve widening) // score -2 = primitive widening needed static int typeConversionScoreWithUnboxing(Class a, Class b) { int score = typeConversionScore(a, b); if (score == 0 || score == 1) ret score; Class aPrim = boxedToPrimitiveType(a); if (aPrim != null) { int score2 = typeConversionScore(aPrim, b); if (score2 == 0) ret 1; else if (score2 != Int.MAX_VALUE) ret score2; } ret score; }