boolean (DifferentiateContext context, Difference.Specifier<JvmClass, JvmClass.Diff> classesDiff, Utils future, Utils present) { Iterable<JvmClass> addedClasses = classesDiff.added(); if (Iterators.isEmpty(addedClasses)) { return true; } debug("Processing added classes:"); BackDependencyIndex index = context.getGraph().getIndex(ClassShortNameIndex.NAME); assert index != null; // affecting dependencies on all other classes with the same short name Set<ReferenceID> affectedNodes = new HashSet<>(); for (JvmClass addedClass : addedClasses){ debug("Class name: ", addedClass.getName()); // class duplication checks if (!addedClass.isAnonymous() && !addedClass.isLocal() && addedClass.getOuterFqName().isEmpty()) { Set<NodeSource> deletedSources = context.getDelta().getDeletedSources(); Predicate<? super NodeSource> belongsToChunk = context.getParams().belongsToCurrentCompilationChunk(); Set<NodeSource> candidates = Iterators.collect( Iterators.filter(present.getNodeSources(addedClass.getReferenceID()), s -> !deletedSources.contains(s) && belongsToChunk.test(s)), new HashSet<>() ); if (!Iterators.isEmpty(Iterators.filter(candidates, src -> !context.isCompiled(src)))) { Iterators.collect(context.getDelta().getSources(addedClass.getReferenceID()), candidates); final StringBuilder msg = new StringBuilder(); msg.append("Possibly duplicated classes in the same compilation chunk; Scheduling for recompilation sources: "); for (NodeSource candidate : candidates) { context.affectNodeSource(candidate); msg.append(candidate.getPath()).append("; "); } debug(msg.toString()); continue; // if duplicates are found, do not perform further checks for classes with the same short name } } if (!addedClass.isAnonymous() && !addedClass.isLocal()) { Iterators.collect(index.getDependencies(new JvmNodeReferenceID(addedClass.getShortName())), affectedNodes); affectedNodes.add(addedClass.getReferenceID()); } } for (ReferenceID id : Iterators.unique(Iterators.flat(Iterators.map(affectedNodes, id -> context.getGraph().getDependingNodes(id))))) { affectNodeSources(context, id, "Affecting dependencies on class with the same short name: " + id + " ", true); } debug("End of added classes processing."); return true; }