public static void annotatePackages(Map<String, PackageAnnotator.PackageCoverageInfo> flattenPackages, CoverageInfoCollector collector) {
    Map<String, PackageAnnotator.PackageCoverageInfo> packages = new HashMap<>();
    for (var entry : flattenPackages.entrySet()) {
      String packageFQName = entry.getKey();
      var info = entry.getValue();
      collector.addPackage(packageFQName, info, true);

      while (!packageFQName.isEmpty()) {
        packages.computeIfAbsent(packageFQName, k -> new PackageAnnotator.PackageCoverageInfo()).append(info);
        final int index = packageFQName.lastIndexOf('.');
        if (index < 0) break;
        packageFQName = packageFQName.substring(0, index);
      }
      packages.computeIfAbsent("", k -> new PackageAnnotator.PackageCoverageInfo()).append(info);
    }
    for (Map.Entry<String, PackageAnnotator.PackageCoverageInfo> entry : packages.entrySet()) {
      collector.addPackage(entry.getKey(), entry.getValue(), false);
    }
  }
public static void annotatePackages(Map<String, PackageAnnotator.PackageCoverageInfo> flattenPackages, CoverageInfoCollector collector)