docs: private static Method findMethodOnClass(Method originalMethod, String methodName, Type classToSearch, ResolutionContext ctx, Class<?> originalClass) {
          methodLoop: for (Method m : getClass(classToSearch).getDeclaredMethods()) {
              if (!methodName.equals(m.getName())) {
                  continue;
              }
  
              final int modifiers = m.getModifiers();
  
              if (Modifier.isPrivate(modifiers)) {
                  if (!classToSearch.equals(originalClass)) {
                      // Ignore private methods outside the original class
                      continue;
                  }
              } else if (!Modifier.isPublic(modifiers) && !Modifier.isProtected(modifiers)) {
                  if (!getClass(classToSearch).getPackage().equals(originalClass.getPackage())) {
                      // Ignore package-scoped methods outside of the original class's package
                      continue;
                  }
              }
  
              Type[] typesToMatch = originalMethod.getGenericParameterTypes();
              Type[] types = m.getGenericParameterTypes();
              if (typesToMatch.length != types.length) {
                  continue;
              }
  
              for (int i = 0; i < typesToMatch.length; i++) {
                  if (!typesEquivalent(typesToMatch[i], types[i], ctx)) {
                      continue methodLoop;
                  }
              }
  
              if (!typesEquivalent(originalMethod.getGenericReturnType(), m.getGenericReturnType(), ctx)) {
                  continue;
              }
  
              return m;
          }
  
          return null;
      }