docs: private static Method resolveAmbiguousMethod(Set<Method> candidates,
              Class<?>[] paramTypes) {
          // Identify which parameter isn't an exact match
          Method m = candidates.iterator().next();
  
          int nonMatchIndex = 0;
          Class<?> nonMatchClass = null;
  
          for (int i = 0; i < paramTypes.length; i++) {
              if (m.getParameterTypes()[i] != paramTypes[i]) {
                  nonMatchIndex = i;
                  nonMatchClass = paramTypes[i];
                  break;
              }
          }
  
          if (nonMatchClass == null) {
              // Null will always be ambiguous
              return null;
          }
  
          for (Method c : candidates) {
             if (c.getParameterTypes()[nonMatchIndex] ==
                     paramTypes[nonMatchIndex]) {
                 // Methods have different non-matching parameters
                 // Result is ambiguous
                 return null;
             }
          }
  
          // Can't be null
          Class<?> superClass = nonMatchClass.getSuperclass();
          while (superClass != null) {
              for (Method c : candidates) {
                  if (c.getParameterTypes()[nonMatchIndex].equals(superClass)) {
                      // Found a match
                      return c;
                  }
              }
              superClass = superClass.getSuperclass();
          }
  
          // Treat instances of Number as a special case
          Method match = null;
          if (Number.class.isAssignableFrom(nonMatchClass)) {
              for (Method c : candidates) {
                  Class<?> candidateType = c.getParameterTypes()[nonMatchIndex];
                  if (Number.class.isAssignableFrom(candidateType) ||
                          candidateType.isPrimitive()) {
                      if (match == null) {
                          match = c;
                      } else {
                          // Match still ambiguous
                          match = null;
                          break;
                      }
                  }
              }
          }
  
          return match;
      }