diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspectionBase.java
index 6732fc17adea..766c9c89b37f 100644
--- a/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspectionBase.java
+++ b/java/java-analysis-impl/src/com/intellij/codeInspection/RedundantSuppressInspectionBase.java
@@ -18,7 +18,6 @@ package com.intellij.codeInspection;
import com.intellij.analysis.AnalysisScope;
import com.intellij.codeInsight.daemon.GroupNames;
import com.intellij.codeInsight.daemon.impl.RemoveSuppressWarningAction;
-import com.intellij.codeInspection.deadCode.UnusedDeclarationInspectionBase;
import com.intellij.codeInspection.ex.GlobalInspectionContextBase;
import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper;
import com.intellij.codeInspection.ex.InspectionToolWrapper;
@@ -182,7 +181,7 @@ public class RedundantSuppressInspectionBase extends GlobalInspectionTool {
else if (toolWrapper.getShortName().equals(shortName)) {
//ignore global unused as it won't be checked anyway
if (toolWrapper instanceof LocalInspectionToolWrapper ||
- toolWrapper instanceof GlobalInspectionToolWrapper && !isGlobalInspectionRunCustomly(toolWrapper.getTool())) {
+ toolWrapper instanceof GlobalInspectionToolWrapper && !((GlobalInspectionToolWrapper)toolWrapper).getTool().isGraphNeeded()) {
suppressedTools.put(toolWrapper, shortName);
}
else {
@@ -217,10 +216,8 @@ public class RedundantSuppressInspectionBase extends GlobalInspectionTool {
else if (toolWrapper instanceof GlobalInspectionToolWrapper) {
final GlobalInspectionToolWrapper global = (GlobalInspectionToolWrapper)toolWrapper;
GlobalInspectionTool globalTool = global.getTool();
- if (isGlobalInspectionRunCustomly(globalTool)) continue;
- if (globalTool.isGraphNeeded()) {
- refManager.findAllDeclarations();
- }
+ //when graph is needed, results probably depend on outer files so absence of results on one file (in current context) doesn't guarantee anything
+ if (globalTool.isGraphNeeded()) continue;
descriptors = new ArrayList<>();
globalContext.getRefManager().iterate(new RefVisitor() {
@Override public void visitElement(@NotNull RefEntity refEntity) {
@@ -301,10 +298,6 @@ public class RedundantSuppressInspectionBase extends GlobalInspectionTool {
return result.toArray(new ProblemDescriptor[result.size()]);
}
- private static boolean isGlobalInspectionRunCustomly(InspectionProfileEntry tool) {
- return tool instanceof UnusedDeclarationInspectionBase;
- }
-
protected GlobalInspectionContextBase createContext(PsiFile file) {
return new GlobalInspectionContextBase(file.getProject());
}
diff --git a/java/java-tests/testData/inspection/redundantSuppress/defaultFile/expected.xml b/java/java-tests/testData/inspection/redundantSuppress/defaultFile/expected.xml
index f21d9d67b61e..2297f77f6bdc 100644
--- a/java/java-tests/testData/inspection/redundantSuppress/defaultFile/expected.xml
+++ b/java/java-tests/testData/inspection/redundantSuppress/defaultFile/expected.xml
@@ -52,12 +52,4 @@
-
- X.java
- 67
- Redundant suppression
- Redundant suppression
-
-
-
\ No newline at end of file