void (final Map<File, ModuleDescriptor> contentRootToModules) { final Set<File> moduleContentRoots = contentRootToModules.keySet(); for (File contentRoot : moduleContentRoots) { final ModuleDescriptor checkedModule = contentRootToModules.get(contentRoot); myProgress.setText2(JavaUiBundle.message("progress.details.building.library.dependencies.for.module", checkedModule.getName())); buildJarDependencies(checkedModule); myProgress.setText2(JavaUiBundle.message("progress.details.building.module.dependencies.for.module", checkedModule.getName())); for (File aContentRoot : moduleContentRoots) { final ModuleDescriptor aModule = contentRootToModules.get(aContentRoot); if (checkedModule.equals(aModule)) { continue; // avoid self-dependencies } final Collection<? extends DetectedProjectRoot> aModuleRoots = aModule.getSourceRoots(); checkModules: for (DetectedProjectRoot srcRoot: checkedModule.getSourceRoots()) { final Set<String> referencedBySourceRoot = mySourceRootToReferencedPackagesMap.get(srcRoot.getDirectory()); for (DetectedProjectRoot aSourceRoot : aModuleRoots) { if (ContainerUtil.intersects(referencedBySourceRoot, mySourceRootToPackagesMap.get(aSourceRoot.getDirectory()))) { checkedModule.addDependencyOn(aModule); break checkModules; } } } } } }