void (@NotNull List<? extends InspectionContext> init, @NotNull List<? extends LocalInspectionToolWrapper> toolWrappers, @NotNull List<? super InspectionContext> result, @NotNull BiConsumer<? super ProblemDescriptor, ? super InspectionProblemHolder> applyIncrementallyCallback, @NotNull Consumer<? super InspectionContext> contextFinishedCallback) { for (InspectionContext context : init) { LocalInspectionToolWrapper toolWrapper = context.tool; LocalInspectionTool tool = toolWrapper.getTool(); for (ProblemDescriptor descriptor : context.holder.getResults()) { PsiElement element = descriptor.getPsiElement(); if (element != null && tool.isSuppressedFor(element)) { registerSuppressedElements(element, toolWrapper.getID(), toolWrapper.getAlternativeID()); } } } HighlightDisplayKey redundantSuppressionKey = HighlightDisplayKey.find(RedundantSuppressInspectionBase.SHORT_NAME); InspectionProfile inspectionProfile = myInspectionProfileWrapper.getInspectionProfile(); if (redundantSuppressionKey == null || !inspectionProfile.isToolEnabled(redundantSuppressionKey, myPsiFile)) { return; } Language fileLanguage = myPsiFile.getLanguage(); InspectionSuppressor suppressor = ContainerUtil.find(LanguageInspectionSuppressors.INSTANCE.allForLanguage(fileLanguage), s -> s instanceof RedundantSuppressionDetector); if (!(suppressor instanceof RedundantSuppressionDetector redundantSuppressionDetector)) { return; } Set<String> activeTools = new HashSet<>(); for (LocalInspectionToolWrapper tool : toolWrappers) { if (tool.runForWholeFile()) { // no redundants for whole file tools pass return; } if (tool.isUnfair() || !tool.isApplicable(fileLanguage) || myInspectionProfileWrapper.getInspectionTool(tool.getShortName(), myPsiFile) instanceof GlobalInspectionToolWrapper) { continue; } activeTools.add(tool.getID()); ContainerUtil.addIfNotNull(activeTools, tool.getAlternativeID()); InspectionElementsMerger elementsMerger = InspectionElementsMerger.getMerger(tool.getShortName()); if (elementsMerger != null) { activeTools.addAll(Arrays.asList(elementsMerger.getSuppressIds())); } } InspectionToolWrapper<?,?> redundantSuppressTool = inspectionProfile.getInspectionTool(RedundantSuppressInspectionBase.SHORT_NAME, myPsiFile); LocalInspectionTool rsLocalTool = ((RedundantSuppressInspectionBase)redundantSuppressTool.getTool()).createLocalTool(redundantSuppressionDetector, mySuppressedElements, activeTools); List<LocalInspectionToolWrapper> wrappers = Collections.singletonList(new LocalInspectionToolWrapper(rsLocalTool)); InspectionRunner runner = new InspectionRunner(myPsiFile, myRestrictRange, myPriorityRange, myInspectInjected, true, myProgress, false, myInspectionProfileWrapper, mySuppressedElements); result.addAll(runner.inspect(wrappers, HighlightSeverity.WARNING, false, applyIncrementallyCallback, contextFinishedCallback, null)); }