private static List<Method> collectAllMethodsRecursively(Class<?> clazz) {
    ArrayList<Method> list = new ArrayList<>();
    for (Class<?> cl = clazz; cl != null; cl = cl.getSuperclass()) {
      list.addAll(Arrays.asList(cl.getDeclaredMethods()));
    }
    return list;
  }
private static List<Method> collectAllMethodsRecursively(Class<?> clazz)