void (Map<String, Set<ModuleNode>> packagesDeclaredInModules) { Map<PsiJavaModule, ModuleNode> nodesByDescriptor = new HashMap<>(); for (ModuleNode moduleNode : myModuleNodes) { if (moduleNode.getDescriptor() != null) { nodesByDescriptor.put(moduleNode.getDescriptor(), moduleNode); } for (String packageName : moduleNode.getRequiredPackages()) { Set<ModuleNode> set = packagesDeclaredInModules.get(packageName); if (set == null) { PsiPackage psiPackage = JavaPsiFacade.getInstance(myProject).findPackage(packageName); if (psiPackage != null) { PsiJavaModule descriptor = ReadAction.compute(() -> findDescriptor(psiPackage)); if (descriptor != null) { ModuleNode dependencyNode = nodesByDescriptor.computeIfAbsent(descriptor, ModuleNode::new); moduleNode.getDependencies().add(dependencyNode); } } } else { if (set.size() != 1) { LOG.info("Split package " + packageName + " found in " + set); } moduleNode.getDependencies().addAll(set); } } myProgressTracker.increment(); } }