redundant suppression: simple global tools do not start if not enabled => no need to explicit check (IDEA-225676)

new inspection context doesn't contain any tools so one need to initialize context with tools explicitly to perform checks there

GitOrigin-RevId: b43cbccc70651b8a43783970af11a81cfb5b6847
This commit is contained in:
Anna Kozlova
2019-11-07 02:40:58 +00:00
committed by intellij-monorepo-bot
parent 44bc9274ec
commit ddf076a38c
3 changed files with 30 additions and 1 deletions
@@ -0,0 +1,14 @@
// "Fix all 'Redundant suppression' problems in file" "true"
import java.util.ArrayList;
public class Test {
@SafeVarargs
static <T> void foo(T... t){
}
void foo() {
foo(new ArrayList<String>());
foo(new ArrayList<String>());
}
}
@@ -0,0 +1,16 @@
// "Fix all 'Redundant suppression' problems in file" "true"
import java.util.ArrayList;
public class Test {
@SafeVarargs
static <T> void foo(T... t){
}
void foo() {
//noinspection un<caret>checked
foo(new ArrayList<String>());
//noinspection unchecked
foo(new ArrayList<String>());
}
}
@@ -70,7 +70,6 @@ public class RedundantSuppressInspection extends GlobalSimpleInspectionTool {
@NotNull ProblemsHolder problemsHolder,
@NotNull GlobalInspectionContext globalContext,
@NotNull ProblemDescriptionsProcessor problemDescriptionsProcessor) {
if (!((GlobalInspectionContextBase)globalContext).isToCheckFile(file, this)) return;
InspectionSuppressor extension = LanguageInspectionSuppressors.INSTANCE.forLanguage(file.getLanguage());
if (!(extension instanceof RedundantSuppressionDetector)) return;
final CommonProblemDescriptor[] descriptors = checkElement(file, (RedundantSuppressionDetector)extension, manager);