private static void getAllInterfaces(Class<?> cls, Set<Class<?>> interfacesFound) {
        while (cls != null) {
            final Class<?>[] interfaces = cls.getInterfaces();
            for (final Class<?> i : interfaces) {
                if (interfacesFound.add(i)) {
                    getAllInterfaces(i, interfacesFound);
                }
            }
            cls = cls.getSuperclass();
        }
    }
Returns a set of all interfaces defined for {@code cls}.
Interfaces are sorted from lowest to highest level (i.e. children before parents)
core/src/main/java/com/linecorp/armeria/internal/common/util/Types.java