Source:
private Resolution selectBest(Env env, JavaType site, List<JavaType> argTypes, List<JavaType> typeParams, JavaSymbol candidate, Resolution bestSoFar, boolean autoboxing) { JavaSymbol.TypeJavaSymbol siteSymbol = site.symbol; if (candidate.kind >= JavaSymbol.ERRONEOUS || !isInheritedIn(candidate, siteSymbol) || candidate.type == null) { return bestSoFar; } JavaSymbol.MethodJavaSymbol methodJavaSymbol = (JavaSymbol.MethodJavaSymbol) candidate; if(!hasCompatibleArity(methodJavaSymbol.parameterTypes().size(), argTypes.size(), methodJavaSymbol.isVarArgs())) { return bestSoFar; } List<JavaType> formals = ((JavaType.MethodJavaType) methodJavaSymbol.type).argTypes; formals = typeSubstitutionSolver.applySiteSubstitutionToFormalParameters(formals, site); TypeSubstitution substitution = typeSubstitutionSolver.getTypeSubstitution(methodJavaSymbol, site, typeParams, argTypes); if (substitution == null) { return bestSoFar; } formals = typeSubstitutionSolver.applySubstitutionToFormalParameters(formals, substitution); if (!isArgumentsAcceptable(argTypes, formals, methodJavaSymbol.isVarArgs(), autoboxing)) { return bestSoFar; } if (!isAccessible(env, siteSymbol, candidate)) { return new Resolution(new AccessErrorJavaSymbol(candidate, Symbols.unknownType)); } JavaSymbol mostSpecific = selectMostSpecific(candidate, bestSoFar.symbol, substitution); if (mostSpecific.isKind(JavaSymbol.AMBIGUOUS)) { return bestSoFar; } Resolution resolution = new Resolution(mostSpecific); resolution.type = typeSubstitutionSolver.getReturnType((JavaSymbol.MethodJavaSymbol) mostSpecific, site, typeParams, substitution); return resolution; }

Target:
private Resolution selectBest(Env env, JavaType site, List<JavaType> argTypes, List<JavaType> typeParams, JavaSymbol candidate, Resolution bestSoFar, boolean autoboxing) { JavaSymbol.TypeJavaSymbol siteSymbol = site.symbol; if (candidate.kind >= JavaSymbol.ERRONEOUS || !isInheritedIn(candidate, siteSymbol) || candidate.type == null) { return bestSoFar; } JavaSymbol.MethodJavaSymbol methodJavaSymbol = (JavaSymbol.MethodJavaSymbol) candidate; if(!hasCompatibleArity(methodJavaSymbol.parameterTypes().size(), argTypes.size(), methodJavaSymbol.isVarArgs())) { return bestSoFar; } TypeSubstitution substitution = typeSubstitutionSolver.getTypeSubstitution(methodJavaSymbol, site, typeParams, argTypes); if (substitution == null) { return bestSoFar; } List<JavaType> formals = ((JavaType.MethodJavaType) methodJavaSymbol.type).argTypes; formals = typeSubstitutionSolver.applySiteSubstitutionToFormalParameters(formals, site); formals = typeSubstitutionSolver.applySubstitutionToFormalParameters(formals, substitution); if (!isArgumentsAcceptable(argTypes, formals, methodJavaSymbol.isVarArgs(), autoboxing)) { return bestSoFar; } if (!isAccessible(env, siteSymbol, candidate)) { Resolution resolution = new Resolution(new AccessErrorJavaSymbol(candidate, Symbols.unknownType)); resolution.type = Symbols.unknownType; return resolution; } JavaSymbol mostSpecific = selectMostSpecific(candidate, bestSoFar.symbol, substitution); if (mostSpecific.isKind(JavaSymbol.AMBIGUOUS)) { return bestSoFar; } Resolution resolution = new Resolution(mostSpecific); JavaType resturnType = ((JavaType.MethodJavaType) ((JavaSymbol.MethodJavaSymbol) mostSpecific).type).resultType; resolution.type = typeSubstitutionSolver.getReturnType(resturnType, site, !typeParams.isEmpty(), substitution); return resolution; }