String (final PsiPackage psiPackage, @Nullable final Module module, @NotNull final CoverageDataManager coverageDataManager, boolean flatten) { if (psiPackage == null) return null; final boolean subCoverageActive = coverageDataManager.isSubCoverageActive(); if (module != null) { final PsiDirectory[] directories = psiPackage.getDirectories(GlobalSearchScope.moduleScope(module)); PackageAnnotator.SummaryCoverageInfo result = null; for (PsiDirectory directory : directories) { final VirtualFile virtualFile = directory.getVirtualFile(); result = merge(result, myDirCoverageInfos.get(virtualFile)); } return getCoverageInformationString(result, subCoverageActive); } else { PackageAnnotator.PackageCoverageInfo info = getPackageCoverageInfo(psiPackage.getQualifiedName(), flatten); return getCoverageInformationString(info, subCoverageActive); } }