@Test public void getImports_from_default_package_no_typeArgs() throws Exception { DAType daType = daType("Toto"); Assertions.assertThat(DATypeImportComputer.computeImports(daType)).extracting("qualifiedName.name").isEmpty(); }
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; }
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; } }
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; }  }
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; }  static Collection<DAImport> computeImports(DAType daType); }
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; }  static Collection<DAImport> computeImports(DAType daType);  }