code: private static void buildUpperBoundClassAndInterfaces(Type type, Set<Class<?>> result) {
  		if (type instanceof ParameterizedType || type instanceof Class<?>) {
  			result.add(erase(type));
  			return;
  		}
  
  		for (Type superType: getExactDirectSuperTypes(type)) {
  			buildUpperBoundClassAndInterfaces(superType, result);
  		}
  	}
docs: Helper method for getUpperBoundClassAndInterfaces, adding the result to the given set.