mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
IDEA-80097 "Redundant suppression" inspection ability to ignore "ALL"
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>4</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="method" FQNAME="x.S void f()" />
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>42</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="method" FQNAME="x.S void j()" />
|
||||
</problem>
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>53</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="field" FQNAME="x.S$3ss s" />
|
||||
</problem>
|
||||
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>19</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="method" FQNAME="x.S void h()" />
|
||||
</problem>
|
||||
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>30</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<entry_point TYPE="class" FQNAME="x.S$1ss" />
|
||||
</problem>
|
||||
|
||||
|
||||
<problem>
|
||||
<file>X.java</file>
|
||||
<line>11</line>
|
||||
<problem_class>Redundant suppression</problem_class>
|
||||
<description>Redundant suppression</description>
|
||||
<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>
|
||||
@@ -0,0 +1,69 @@
|
||||
package x;
|
||||
|
||||
class S {
|
||||
public void f() {
|
||||
//noinspection HardCodedStringLiteral
|
||||
String s=null;
|
||||
//noinspection HardCodedStringLiteral
|
||||
String s2="sssssss";
|
||||
}
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
void g() {
|
||||
String s = null;
|
||||
}
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
void g2() {
|
||||
String s = "sssssss";
|
||||
}
|
||||
|
||||
void h() {
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
String s = null;
|
||||
}
|
||||
void h2() {
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
String s = "sssssss";
|
||||
}
|
||||
|
||||
void i() {
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
class ss {
|
||||
String s = null;
|
||||
}
|
||||
}
|
||||
void i2() {
|
||||
@SuppressWarnings({"HardCodedStringLiteral"})
|
||||
class ss {
|
||||
String s = "sssssss";
|
||||
}
|
||||
}
|
||||
|
||||
/** @noinspection HardCodedStringLiteral */
|
||||
void j() {
|
||||
String s = null;
|
||||
}
|
||||
/** @noinspection HardCodedStringLiteral */
|
||||
void j2() {
|
||||
String s = "sssssss";
|
||||
}
|
||||
|
||||
void k() {
|
||||
class ss {
|
||||
/** @noinspection HardCodedStringLiteral */
|
||||
String s = null;
|
||||
}
|
||||
}
|
||||
void k2() {
|
||||
class ss {
|
||||
/** @noinspection HardCodedStringLiteral */
|
||||
String s = "sssssss";
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"EmptyMethod"})
|
||||
void foo() {}
|
||||
|
||||
@SuppressWarnings({"EmptyMethod"})
|
||||
void foo1() {String f;}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
@@ -0,0 +1,8 @@
|
||||
package x;
|
||||
|
||||
public class S {
|
||||
@SuppressWarnings("ALL")
|
||||
public static void main(String[] args) {
|
||||
System.out.println(args[0]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.intellij.codeInspection;
|
||||
|
||||
import com.intellij.codeInspection.ex.GlobalInspectionToolWrapper;
|
||||
import com.intellij.codeInspection.ex.InspectionProfileImpl;
|
||||
import com.intellij.codeInspection.ex.InspectionToolRegistrar;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
|
||||
public class RedundantSuppressTest extends InspectionTestCase {
|
||||
private GlobalInspectionToolWrapper myWrapper;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
InspectionToolRegistrar.getInstance().ensureInitialized();
|
||||
myWrapper = new GlobalInspectionToolWrapper(new RedundantSuppressInspection());
|
||||
}
|
||||
|
||||
public void testDefaultFile() throws Exception {
|
||||
InspectionProfileImpl.INIT_INSPECTIONS = true;
|
||||
doTest();
|
||||
InspectionProfileImpl.INIT_INSPECTIONS = false;
|
||||
}
|
||||
|
||||
public void testSuppressAll() throws Exception {
|
||||
InspectionProfileImpl.INIT_INSPECTIONS = true;
|
||||
try {
|
||||
((RedundantSuppressInspection)myWrapper.getTool()).IGNORE_ALL = true;
|
||||
doTest();
|
||||
}
|
||||
finally {
|
||||
((RedundantSuppressInspection)myWrapper.getTool()).IGNORE_ALL = false;
|
||||
InspectionProfileImpl.INIT_INSPECTIONS = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest("redundantSuppress/" + getTestName(true), myWrapper,"java 1.5",true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user