class DATypeImportComputer {

  public static Collection<DAImport> computeImports(DAType daType) {
    List<DAImport> qualifiedName = hasQualifiedNameToImport(daType)
        ? Collections.<DAImport>emptyList() : Collections.singletonList(DAImportImpl.from(daType.getQualifiedName()));

    Set<DAImport> res = new HashSet<DAImport>();
    addAll(res, qualifiedName);
    List<Collection<DAImport>> argsImportLists = from(daType.getTypeArgs()).transform(COMPUTE_IMPORTS).toList();
    for (Collection<DAImport> importList : argsImportLists) {
      addAll(res, importList);
    }
    addAll(res,
        daType.getSuperBound() == null ? Collections.<DAImport>emptyList() : computeImports(daType.getSuperBound())
    );
    addAll(res, daType.getExtendsBound() == null ? Collections.<DAImport>emptyList() : computeImports(daType.getExtendsBound()));
    return res;
  }

}