MCPcopy Index your code
hub / github.com/beanshell/beanshell / findMostSpecificSignature

Method findMostSpecificSignature

src/bsh/Reflect.java:664–687  ·  view source on GitHub ↗
(Class[] idealMatch, Class[][] candidates)

Source from the content-addressed store, hash-verified

662 friendly extraneous tests shouldn't be a problem.
663 */
664 static int findMostSpecificSignature(Class[] idealMatch, Class[][] candidates) {
665 for (int round = Types.FIRST_ROUND_ASSIGNABLE; round <= Types.LAST_ROUND_ASSIGNABLE; round++) {
666 Class[] bestMatch = null;
667 int bestMatchIndex = -1;
668
669 for (int i = 0; i < candidates.length; i++) {
670 Class[] targetMatch = candidates[i];
671
672 // If idealMatch fits targetMatch and this is the first match
673 // or targetMatch is more specific than the best match, make it
674 // the new best match.
675 if (Types.isSignatureAssignable(idealMatch, targetMatch, round) && ((bestMatch == null) || Types.isSignatureAssignable(targetMatch, bestMatch, Types.JAVA_BASE_ASSIGNABLE))) {
676 bestMatch = targetMatch;
677 bestMatchIndex = i;
678 }
679 }
680
681 if (bestMatch != null) {
682 return bestMatchIndex;
683 }
684 }
685
686 return -1;
687 }
688
689
690 private static String accessorName(String getorset, String propName) {

Callers 5

getConstructorArgsMethod · 0.95
getMethodMethod · 0.95

Calls 1

isSignatureAssignableMethod · 0.95

Tested by 1