public static void annotateDirectories(Map<VirtualFile, PackageAnnotator.PackageCoverageInfo> flattenDirectories,
                                  CoverageInfoCollector collector,
                                  Set<VirtualFile> sourceRoots) {
    Map<VirtualFile, PackageAnnotator.DirCoverageInfo> directories = new HashMap<>();
    for (var entry : flattenDirectories.entrySet()) {
      var info = entry.getValue();
      VirtualFile dir = entry.getKey();
      while (dir != null) {
        directories.computeIfAbsent(dir, PackageAnnotator.DirCoverageInfo::new).append(info);
        if (sourceRoots.contains(dir)) break;
        dir = dir.getParent();
      }
    }

    for (PackageAnnotator.DirCoverageInfo dir : directories.values()) {
      collector.addSourceDirectory(dir.sourceRoot, dir);
    }
  }
public static void annotateDirectories(Map<VirtualFile, PackageAnnotator.PackageCoverageInfo> flattenDirectories,
                                  CoverageInfoCollector collector,
                                  Set<VirtualFile> sourceRoots)