code: public static Invocable findMostSpecificInvocable(
              Class<?>[] idealMatch, List<Invocable> methods )
          {
              // copy signatures into array for findMostSpecificMethod()
              List<Class<?>[]> candidateSigs = new ArrayList<>();
              List<Invocable> methodList = new ArrayList<>();
              for( Invocable method : methods ) {
                  Class<?>[] parameterTypes = method.getParameterTypes();
                  methodList.add( method );
                  candidateSigs.add( parameterTypes );
                  if( method.isVarArgs()
                          && idealMatch.length >= parameterTypes.length ) {
                      Class<?>[] candidateSig = new Class[idealMatch.length];
                      System.arraycopy(parameterTypes, 0, candidateSig, 0,
                              parameterTypes.length-1);
                      Arrays.fill(candidateSig, parameterTypes.length-1,
                          idealMatch.length, method.getVarArgsComponentType());
                      methodList.add( method );
                      candidateSigs.add( candidateSig );
                  }
              }
  
              int match = findMostSpecificSignature( idealMatch,
                      candidateSigs.toArray(new Class[candidateSigs.size()][]) );
              return match == -1 ? null : methodList.get(match);
          }
docs: Find the best match for signature idealMatch.
  It is assumed that the methods array holds only valid candidates
  (e.g. method name and number of args already matched).
  This method currently does not take into account Java 5 covariant
  return types... which I think will require that we find the most
  derived return type of otherwise identical best matches.
  
  @see #findMostSpecificSignature(Class[], Class[][])
  @param methods the set of candidate method which differ only in the
  types of their arguments.