@ SuppressWarnings ( "fallthrough" ) Symbol selectBest ( Env < AttrContext > env , Type site , List < Type > argtypes , List < Type > typeargtypes , Symbol sym , Symbol bestSoFar , boolean allowBoxing , boolean useVarargs , boolean operator ) { if ( sym . kind == ERR || ! sym . isInheritedIn ( site . tsym , types ) ) { return bestSoFar ; } else if ( useVarargs && ( sym . flags ( ) & VARARGS ) == 0 ) { return bestSoFar . kind >= ERRONEOUS ? new BadVarargsMethod ( ( ResolveError ) bestSoFar . baseSymbol ( ) ) : bestSoFar ; } Assert . check ( sym . kind < AMBIGUOUS ) ; try { Type mt = rawInstantiate ( env , site , sym , null , argtypes , typeargtypes , allowBoxing , useVarargs , types . noWarnings ) ; if ( ! operator || verboseResolutionMode . contains ( VerboseResolutionMode . PREDEF ) ) currentResolutionContext . addApplicableCandidate ( sym , mt ) ; } catch ( InapplicableMethodException ex ) { if ( ! operator ) currentResolutionContext . addInapplicableCandidate ( sym , ex . getDiagnostic ( ) ) ; switch ( bestSoFar . kind ) { case ABSENT_MTH : return new InapplicableSymbolError ( currentResolutionContext ) ; case WRONG_MTH : if ( operator ) return bestSoFar ; bestSoFar = new InapplicableSymbolsError ( currentResolutionContext ) ; default : return bestSoFar ; } } if ( ! isAccessible ( env , site , sym ) ) { return ( bestSoFar . kind == ABSENT_MTH ) ? new AccessError ( env , site , sym ) : bestSoFar ; } return ( bestSoFar . kind > AMBIGUOUS ) ? sym : mostSpecific ( argtypes , sym , bestSoFar , env , site , allowBoxing && operator , useVarargs ) ; }
Select the best method for a call site among two choices .