code: private static void collectInterfaces(Class<?> type, Set<Class<?>> interfaceSet, Set<Class<?>> excludeSet) {
  
      for (Class<?> interfaceClass : type.getInterfaces()) {
        if ((excludeSet == null) || (!excludeSet.contains(interfaceClass))) {
          interfaceSet.add(interfaceClass);
        }
        collectInterfaces(interfaceClass, interfaceSet, excludeSet);
      }
    }
docs: Recursively collects all {@link Class#getInterfaces() interfaces} starting from the given {@code type}.
  
  @param type is the {@link Class} for which all {@link Class#getInterfaces() interfaces} shall be collected.
  @param interfaceSet is the {@link Set} where the {@link Class#getInterfaces() interfaces} will be
  {@link Set#add(Object) added}.
  @param excludeSet is a {@link Set} with {@link Class}es (interfaces) to omit. May be {@code null} for none.