code: public Set<TypeMirror> getFlattenedSupertypeHierarchy(Types types,
                                                          TypeMirror typeMirror) {
      List<TypeMirror> toAdd = new ArrayList<>();
      LinkedHashSet<TypeMirror> result = new LinkedHashSet<>();
      toAdd.add(typeMirror);
      for (int i = 0; i < toAdd.size(); i++) {
        TypeMirror type = toAdd.get(i);
        if (result.add(type)) {
          toAdd.addAll(types.directSupertypes(type));
        }
      }
      return result;
    }
docs: Returns all of the superclasses and superinterfaces for a given generator
  including the generator itself. The returned set maintains an internal
  breadth-first ordering of the generator, followed by its interfaces (and their
  super-interfaces), then the supertype and its interfaces, and so on.
  
  @param types      types
  @param typeMirror of the class to check
  @return Set of implemented super types