Set<File> (@NotNull final PsiFile srcFile, @Nullable final Module module, @NotNull final CoverageSuitesBundle suite) { if (module == null) { return Collections.emptySet(); } final Set<File> classFiles = new HashSet<>(); final CompilerModuleExtension moduleExtension = Objects.requireNonNull(CompilerModuleExtension.getInstance(module)); final @Nullable File outputpath = getOutputpath(moduleExtension); final @Nullable File testOutputpath = getTestOutputpath(moduleExtension); final @Nullable VirtualFile outputpathVirtualFile = fileToVirtualFileWithRefresh(outputpath); final @Nullable VirtualFile testOutputpathVirtualFile = fileToVirtualFileWithRefresh(testOutputpath); for (JavaCoverageEngineExtension extension : JavaCoverageEngineExtension.EP_NAME.getExtensionList()) { if (extension.collectOutputFiles(srcFile, outputpathVirtualFile, testOutputpathVirtualFile, suite, classFiles)) return classFiles; } final Project project = module.getProject(); final CoverageDataManager dataManager = CoverageDataManager.getInstance(project); boolean includeTests = suite.isTrackTestFolders(); final VirtualFile[] roots = JavaCoverageClassesEnumerator.getRoots(dataManager, module, includeTests); String packageVmName = AnalysisUtils.fqnToInternalName(getPackageName(srcFile)); final List<File> children = new ArrayList<>(); for (VirtualFile root : roots) { if (root == null) continue; final VirtualFile packageDir = root.findFileByRelativePath(packageVmName); if (packageDir == null) continue; final File dir = VfsUtilCore.virtualToIoFile(packageDir); if (!dir.exists()) continue; final File[] files = dir.listFiles(); if (files == null) continue; Collections.addAll(children, files); } final PsiClass[] classes = ReadAction.compute(() -> ((PsiClassOwner)srcFile).getClasses()); for (final PsiClass psiClass : classes) { final String className = ReadAction.compute(() -> psiClass.getName()); if (className == null) continue; for (File child : children) { if (FileUtilRt.extensionEquals(child.getName(), JavaClassFileType.INSTANCE.getDefaultExtension())) { final String childName = FileUtilRt.getNameWithoutExtension(child.getName()); if (childName.equals(className) || //class or inner childName.startsWith(className) && childName.charAt(className.length()) == '$') { classFiles.add(child); } } } } return classFiles; }