mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
redundant suppression: disable for global tools which need graph (IDEA-159279)
This commit is contained in:
+3
-10
@@ -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());
|
||||
}
|
||||
|
||||
@@ -52,12 +52,4 @@
|
||||
<entry_point TYPE="method" FQNAME="x.S void g()" />
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>67</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="method" FQNAME="x.S void foo1()" />
|
||||
</problem>
|
||||
|
||||
</problems>
|
||||
Reference in New Issue
Block a user