code: public boolean visitTypeHierarchy(TypeMirror type, TypeVisitor visitor) {
      boolean result = true;
      if (type == null) {
        return result;
      }
      if (type.getKind() == TypeKind.DECLARED) {
        result = visitor.accept((DeclaredType) type);
      }
      for (TypeMirror superType : directSupertypes(type)) {
        if (!result) {
          return false;
        }
        result = visitTypeHierarchy(superType, visitor);
      }
      return result;
    }
docs: Visit all declared types in the hierarchy using a depth-first traversal, visiting classes
  before interfaces.