private Set<Class<?>> add(final Class<?> cls, final Set<Class<?>> s) {
        if (cls.isInterface()) {
            s.add(cls);
        }
        for (final Class<?> iface : cls.getInterfaces()) {
            add(iface, s);
        }
        final Class<?> superclass = cls.getSuperclass();
        if (superclass != null) {
            add(superclass, s);
        }
        return s;
    }