void (DetectedProjectRoot root, Map<File, DetectedRootData> rootData) { DetectedRootData[] allRoots = rootData.values().toArray(new DetectedRootData[0]); for (DetectedRootData child : allRoots) { final File childDirectory = child.getDirectory(); if (FileUtil.isAncestor(root.getDirectory(), childDirectory, true)) { for (DetectedProjectRoot projectRoot : child.getAllRoots()) { if (!root.canContainRoot(projectRoot)) { child.removeRoot(projectRoot); } } if (child.isEmpty()) { rootData.remove(childDirectory); } } } }