void (Project project, GlobalInspectionContextEx context) { reportMessage(1, "Running second analysis stage..."); printBeforeSecondStageProblems(); ChangeListManager changeListManager = ChangeListManager.getInstance(project); context.setGlobalReportedProblemFilter( (entity, description) -> { if (!(entity instanceof RefElement)) return false; Pair<VirtualFile, Integer> fileAndLine = findFileAndLineByRefElement((RefElement)entity); if (fileAndLine == null) return false; return secondAnalysisFilter(changeListManager, description, fileAndLine.first, fileAndLine.second); } ); context.setReportedProblemFilter( (element, descriptors) -> { List<ProblemDescriptorBase> any = ContainerUtil.filterIsInstance(descriptors, ProblemDescriptorBase.class); if (!any.isEmpty()) { ProblemDescriptorBase problemDescriptor = any.get(0); String text = problemDescriptor.toString(); VirtualFile file = problemDescriptor.getContainingFile(); if (file == null) return true; int line = problemDescriptor.getLineNumber(); return secondAnalysisFilter(changeListManager, text, file, line); } return true; } ); }