code: private Method similarMethod(String name, Class<?>[] types) throws NoSuchMethodException {
          final Class<?> type = type();
  
          // first priority: find a public method with a "similar" signature in class hierarchy
          // similar interpreted in when primitive argument types are converted to their wrappers
          for (Method method : type.getMethods()) {
              if (isSimilarSignature(method, name, types)) {
                  return method;
              }
          }
  
          // second priority: find a non-public method with a "similar" signature on declaring class
          for (Method method : type.getDeclaredMethods()) {
              if (isSimilarSignature(method, name, types)) {
                  return method;
              }
          }
  
          throw new NoSuchMethodException("No similar method " + name + " with params " + Arrays.toString(types)
                  + " could be found on type " + type() + ".");
      }
docs: Searches a method with a similar signature as desired using
  {@link #isSimilarSignature(java.lang.reflect.Method, String, Class[])}.
  <p>
  First public methods are searched in the class hierarchy, then private methods on the declaring class. If a
  method could be found, it is returned, otherwise a {@code NoSuchMethodException} is thrown.