summaryrefslogtreecommitdiff
path: root/plugins/InspectionGadgets/test/com/siyeh/igtest
diff options
context:
space:
mode:
authorJean-Baptiste Queru <jbq@google.com>2013-02-08 15:14:04 -0800
committerJean-Baptiste Queru <jbq@google.com>2013-02-08 15:14:04 -0800
commit9edc8f6b58f71ec510ba36b838f115718d9a174d (patch)
tree06f6df92024fa534ff27e1c0b5fc8b2002848093 /plugins/InspectionGadgets/test/com/siyeh/igtest
parentb56ea2a18f232d79481e778085fd64e8ae486fc3 (diff)
downloadidea-9edc8f6b58f71ec510ba36b838f115718d9a174d.tar.gz
Snapshot of commit 84dc01e773388c2c72a1fc437f313dd5747e7809
from branch master of git://git.jetbrains.org/idea/community.git
Diffstat (limited to 'plugins/InspectionGadgets/test/com/siyeh/igtest')
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/EmptyStatementBody.java (renamed from plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/EmptyStatementBodyInspection.java)7
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/expected.xml65
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/public_constructor/PublicConstructor.java3
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/classmetrics/constructor_count/ConstructorCount.java16
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/classmetrics/constructor_count/expected.xml9
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/fallthru_in_switch_statement/FallthruInSwitch.java (renamed from plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/FallthruInSwithInspection.java)8
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/fallthru_in_switch_statement/expected.xml18
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_density/SwitchStatementDensity.java (renamed from plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementDensityInspection.java)16
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_density/expected.xml9
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_confusing_declaration/SwitchStatementWithConfusingDeclaration.java (renamed from plugins/InspectionGadgets/test/com/siyeh/igtest/confusing/SwitchStatementWithConfusingDeclaration.java)2
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_confusing_declaration/expected.xml9
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_too_few_branches/SwitchStatementWithTooFewBranches.java22
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_too_few_branches/expected.xml9
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statements_without_default/SwitchStatementsWithoutDefault.java (renamed from plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementsWithoutDefaultInspection.java)11
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statements_without_default/expected.xml18
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/C.java58
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/expected.xml44
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/extends_utility_class/ExtendsUtilityClass.java27
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/extends_utility_class/expected.xml9
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/package_dot_html_may_be_package_info/expected.xml9
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/package_dot_html_may_be_package_info/package.html3
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/unnecessary_javadoc_link/UnnecessaryJavaDocLink.java (renamed from plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_javadoc_link/UnnecessaryJavaDocLink.java)4
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/unnecessary_javadoc_link/expected.xml (renamed from plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_javadoc_link/expected.xml)0
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/jdk/auto_boxing/expected.xml7
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/BooleanConstructor.java10
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/expected.xml17
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/verbose/UnnecessaryLocalVariableInspection.java35
27 files changed, 387 insertions, 58 deletions
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/EmptyStatementBodyInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/EmptyStatementBody.java
index 4b1aca254417..38f7601b13ab 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/EmptyStatementBodyInspection.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/EmptyStatementBody.java
@@ -1,8 +1,8 @@
-package com.siyeh.igtest.bugs;
+package com.siyeh.igtest.bugs.empty_statement_body;
-public class EmptyStatementBodyInspection
+public class EmptyStatementBody
{
- private void foo()
+ private void foo(int j)
{
while(bar());
while(bar()){
@@ -29,6 +29,7 @@ public class EmptyStatementBodyInspection
}
else;
+ switch (j) {}
}
private boolean bar()
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/expected.xml
new file mode 100644
index 000000000000..2132751ff25d
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/empty_statement_body/expected.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>7</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;while&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>8</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;while&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>11</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;for&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>12</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;for&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>16</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;if&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>17</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;if&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>23</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;else&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>30</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;else&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+
+ <problem>
+ <file>EmptyStatementBody.java</file>
+ <line>32</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Statement with empty body</problem_class>
+ <description>&lt;code&gt;switch&lt;/code&gt; statement has empty body #loc</description>
+ </problem>
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/public_constructor/PublicConstructor.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/public_constructor/PublicConstructor.java
index cfb0d7ffdf3a..35a177b86a7b 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/public_constructor/PublicConstructor.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/classlayout/public_constructor/PublicConstructor.java
@@ -6,4 +6,7 @@ abstract class X implements java.io.Externalizable {
}
class Y {
public Y() {}
+}
+abstract class Z {
+ public Z() {}
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/classmetrics/constructor_count/ConstructorCount.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/classmetrics/constructor_count/ConstructorCount.java
new file mode 100644
index 000000000000..bc415dfc0d95
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/classmetrics/constructor_count/ConstructorCount.java
@@ -0,0 +1,16 @@
+package com.siyeh.igtest.classmetrics.constructor_count;
+
+public class ConstructorCount {
+
+ ConstructorCount() {}
+ ConstructorCount(String s) {}
+
+ @Deprecated
+ ConstructorCount(int i) {}
+
+ class A {
+ A() {}
+ A(int i) {}
+ A(String s) {}
+ }
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/classmetrics/constructor_count/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/classmetrics/constructor_count/expected.xml
new file mode 100644
index 000000000000..ebac7c232104
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/classmetrics/constructor_count/expected.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+ <problem>
+ <file>ConstructorCount.java</file>
+ <line>11</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Class with too many constructors</problem_class>
+ <description>&lt;code&gt;A&lt;/code&gt; has too many constructors (constructor count = 3) #loc</description>
+ </problem>
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/FallthruInSwithInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/fallthru_in_switch_statement/FallthruInSwitch.java
index 94629ee3a6dd..ed8501e48045 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/FallthruInSwithInspection.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/fallthru_in_switch_statement/FallthruInSwitch.java
@@ -1,10 +1,10 @@
-package com.siyeh.igtest.bugs;
+package com.siyeh.igtest.controlflow.fallthru_in_switch_statement;
-public class FallthruInSwithInspection
+public class FallthruInSwitch
{
private int m_bar;
- public FallthruInSwithInspection()
+ public FallthruInSwitch()
{
m_bar = 0;
}
@@ -15,6 +15,8 @@ public class FallthruInSwithInspection
switch(bar)
{
case (3):
+ System.out.println();
+ // Falls through
case (4):
System.out.println("3");
case (5):
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/fallthru_in_switch_statement/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/fallthru_in_switch_statement/expected.xml
new file mode 100644
index 000000000000..fa39d92753c6
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/fallthru_in_switch_statement/expected.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+
+ <problem>
+ <file>FallthruInSwitch.java</file>
+ <line>22</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Fall-through in 'switch' statement</problem_class>
+ <description>&lt;code&gt;case (5):&lt;/code&gt; fall-through in 'switch' statement #loc</description>
+ </problem>
+
+ <problem>
+ <file>FallthruInSwitch.java</file>
+ <line>23</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Fall-through in 'switch' statement</problem_class>
+ <description>&lt;code&gt;case (6):&lt;/code&gt; fall-through in 'switch' statement #loc</description>
+ </problem>
+
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementDensityInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_density/SwitchStatementDensity.java
index 338e69cb98be..d3d4ed73e00e 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementDensityInspection.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_density/SwitchStatementDensity.java
@@ -1,10 +1,10 @@
-package com.siyeh.igtest.bugs;
+package com.siyeh.igtest.controlflow.switch_statement_density;
-public class SwitchStatementDensityInspection
+public class SwitchStatementDensity
{
private int m_bar;
- public SwitchStatementDensityInspection()
+ public SwitchStatementDensity()
{
m_bar = 0;
}
@@ -28,6 +28,14 @@ public class SwitchStatementDensityInspection
System.out.println("3");
System.out.println("3");
System.out.println("3");
+ System.out.println("3");
+ System.out.println("3");
+ System.out.println("3");
+ System.out.println("3");
+ System.out.println("3");
+ System.out.println("3");
+ System.out.println("3");
+ System.out.println("3");
break;
case 6:
System.out.println("4");
@@ -35,7 +43,7 @@ public class SwitchStatementDensityInspection
default:
break;
}
-
+ switch(bar) {}
}
}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_density/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_density/expected.xml
new file mode 100644
index 000000000000..8cbf72395415
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_density/expected.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+ <problem>
+ <file>SwitchStatementDensity.java</file>
+ <line>15</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'switch' statement with too low of a branch density</problem_class>
+ <description>&lt;code&gt;switch&lt;/code&gt; has too low of a branch density (19%) #loc</description>
+ </problem>
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/confusing/SwitchStatementWithConfusingDeclaration.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_confusing_declaration/SwitchStatementWithConfusingDeclaration.java
index bd4d476b85ca..7f175281b597 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/confusing/SwitchStatementWithConfusingDeclaration.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_confusing_declaration/SwitchStatementWithConfusingDeclaration.java
@@ -1,4 +1,4 @@
-package com.siyeh.igtest.confusing;
+package com.siyeh.igtest.controlflow.switch_statement_with_confusing_declaration;
public class SwitchStatementWithConfusingDeclaration
{
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_confusing_declaration/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_confusing_declaration/expected.xml
new file mode 100644
index 000000000000..d92c4d5334ce
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_confusing_declaration/expected.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+ <problem>
+ <file>SwitchStatementWithConfusingDeclaration.java</file>
+ <line>10</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Local variable used and declared in different 'switch' branches</problem_class>
+ <description>Local variable &lt;code&gt;x&lt;/code&gt; declared in one 'switch' branch and used in another #loc</description>
+ </problem>
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_too_few_branches/SwitchStatementWithTooFewBranches.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_too_few_branches/SwitchStatementWithTooFewBranches.java
new file mode 100644
index 000000000000..1bc89357dd89
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_too_few_branches/SwitchStatementWithTooFewBranches.java
@@ -0,0 +1,22 @@
+package com.siyeh.igtest.controlflow.switch_statement_with_too_few_branches;
+
+class SwitchStatementWithTooFewBranches {
+
+ void foo(int i) {
+ switch (i) {}
+ switch (i) {
+ case 1:
+ System.out.println(i);
+ }
+ switch(i) {
+ case 1:
+ break;
+ case 2:
+ break;
+ case 3:
+ break;
+
+ }
+ switch (i)
+ }
+}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_too_few_branches/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_too_few_branches/expected.xml
new file mode 100644
index 000000000000..c3237ad733b8
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statement_with_too_few_branches/expected.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+ <problem>
+ <file>SwitchStatementWithTooFewBranches.java</file>
+ <line>7</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'switch' statement with too few branches</problem_class>
+ <description>&lt;code&gt;switch&lt;/code&gt; has too few branches (1), and should probably be replaced with an 'if' statement #loc</description>
+ </problem>
+</problems>
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementsWithoutDefaultInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statements_without_default/SwitchStatementsWithoutDefault.java
index f33bc24694c7..8c81c4091247 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/bugs/SwitchStatementsWithoutDefaultInspection.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statements_without_default/SwitchStatementsWithoutDefault.java
@@ -1,10 +1,10 @@
-package com.siyeh.igtest.bugs;
+package com.siyeh.igtest.controlflow.switch_statements_without_default;
-public class SwitchStatementsWithoutDefaultInspection
+public class SwitchStatementsWithoutDefault
{
private int m_bar;
- public SwitchStatementsWithoutDefaultInspection()
+ public SwitchStatementsWithoutDefault()
{
m_bar = 0;
}
@@ -58,5 +58,10 @@ public class SwitchStatementsWithoutDefaultInspection
case baz:
break;
}
+ switch (var)
+ }
+
+ enum MyEnum {
+ foo, bar, baz;
}
}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statements_without_default/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statements_without_default/expected.xml
new file mode 100644
index 000000000000..e3ec484499da
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/controlflow/switch_statements_without_default/expected.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+
+ <problem>
+ <file>SwitchStatementsWithoutDefault.java</file>
+ <line>32</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'switch' statement without 'default' branch</problem_class>
+ <description>&lt;code&gt;switch&lt;/code&gt; statement without 'default' branch #loc</description>
+ </problem>
+
+ <problem>
+ <file>SwitchStatementsWithoutDefault.java</file>
+ <line>55</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'switch' statement without 'default' branch</problem_class>
+ <description>&lt;code&gt;switch&lt;/code&gt; statement without 'default' branch #loc</description>
+ </problem>
+
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/C.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/C.java
index 4c70c60d9822..234c1ba884de 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/C.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/C.java
@@ -25,4 +25,62 @@ class C {
long ll = l;
return (int) ll;
}
+
+ public int foo() {
+ int a = 2;
+ int b = a;
+ return b;
+ }
+
+ public int bar() {
+ int b = 3;
+ return b;
+ }
+
+ public int bar2() throws Exception{
+ final Exception b = new Exception();
+ throw b;
+ }
+
+ public int baz() {
+ int a;
+ int b = 3;
+ a = b;
+ return a;
+ }
+
+ public int bazoom() {
+ final int i = foo();
+ bar();
+ final int value = i;
+ System.out.println(value);
+ return 3;
+ }
+
+ double time() {
+ double time = 0.0, dt = time - 1.0;
+ System.out.println(time);
+ return dt;
+ }
+
+ double time2() {
+ double time = 0.0, dt = time - 1.0;
+ return time;
+ }
+
+ void time3() {
+ double time = 0.0, dt = time - 1.0;
+ double time2 = time;
+ time2 += 1;
+ }
+
+ void through() throws Exception {
+ Exception e2 = instance(), e3 = new RuntimeException(e2);
+ throw e2;
+ }
+
+ Exception instance() {
+ return null;
+ }
+
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/expected.xml
index 0f4650b6bbb0..bf91c5c62e2c 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/dataflow/unnecessary_local_vars/expected.xml
@@ -55,4 +55,48 @@
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Redundant local variable</problem_class>
<description>Local variable &lt;code&gt;r3&lt;/code&gt; is redundant #loc</description>
</problem>
+
+ <problem>
+ <file>C.java</file>
+ <line>30</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Redundant local variable</problem_class>
+ <description>Local variable &lt;code&gt;a&lt;/code&gt; is redundant #loc</description>
+ </problem>
+
+ <problem>
+ <file>C.java</file>
+ <line>31</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Redundant local variable</problem_class>
+ <description>Local variable &lt;code&gt;b&lt;/code&gt; is redundant #loc</description>
+ </problem>
+
+ <problem>
+ <file>C.java</file>
+ <line>36</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Redundant local variable</problem_class>
+ <description>Local variable &lt;code&gt;b&lt;/code&gt; is redundant #loc</description>
+ </problem>
+
+ <problem>
+ <file>C.java</file>
+ <line>41</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Redundant local variable</problem_class>
+ <description>Local variable &lt;code&gt;b&lt;/code&gt; is redundant #loc</description>
+ </problem>
+
+ <problem>
+ <file>C.java</file>
+ <line>47</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Redundant local variable</problem_class>
+ <description>Local variable &lt;code&gt;b&lt;/code&gt; is redundant #loc</description>
+ </problem>
+
+ <problem>
+ <file>C.java</file>
+ <line>55</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Redundant local variable</problem_class>
+ <description>Local variable &lt;code&gt;value&lt;/code&gt; is redundant #loc</description>
+ </problem>
+
+
</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/extends_utility_class/ExtendsUtilityClass.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/extends_utility_class/ExtendsUtilityClass.java
new file mode 100644
index 000000000000..553a464e3273
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/extends_utility_class/ExtendsUtilityClass.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2000-2013 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.siyeh.igtest.inheritance.extends_utility_class;
+
+public class ExtendsUtilityClass {
+// all members are static
+
+ public static void member() {}
+}
+class Extender extends ExtendsUtilityClass {}
+class Extender2 extends ExtendsUtilityClass {
+
+ public void nonStaticMethod() {}
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/extends_utility_class/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/extends_utility_class/expected.xml
new file mode 100644
index 000000000000..0511c7f95cb7
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/inheritance/extends_utility_class/expected.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+ <problem>
+ <file>ExtendsUtilityClass.java</file>
+ <line>24</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Class extends utility class</problem_class>
+ <description>Class &lt;code&gt;Extender2&lt;/code&gt; extends utility class 'ExtendsUtilityClass' #loc</description>
+ </problem>
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/package_dot_html_may_be_package_info/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/package_dot_html_may_be_package_info/expected.xml
new file mode 100644
index 000000000000..dd5618e37f02
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/package_dot_html_may_be_package_info/expected.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+ <problem>
+ <file>package.html</file>
+ <line>1</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">'package.html' may be converted to 'package-info.java'</problem_class>
+ <description>&lt;code&gt;package.html&lt;/code&gt; may be converted to &lt;code&gt;package-info.java&lt;/code&gt;</description>
+ </problem>
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/package_dot_html_may_be_package_info/package.html b/plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/package_dot_html_may_be_package_info/package.html
new file mode 100644
index 000000000000..b074131a521c
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/package_dot_html_may_be_package_info/package.html
@@ -0,0 +1,3 @@
+<html>
+this is a test file
+</html> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_javadoc_link/UnnecessaryJavaDocLink.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/unnecessary_javadoc_link/UnnecessaryJavaDocLink.java
index 9a1882fbf974..cf67f8ec04c3 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_javadoc_link/UnnecessaryJavaDocLink.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/unnecessary_javadoc_link/UnnecessaryJavaDocLink.java
@@ -1,4 +1,4 @@
-package com.siyeh.igtest.style.unnecessary_javadoc_link;
+package com.siyeh.igtest.javadoc.unnecessary_javadoc_link;
public class UnnecessaryJavaDocLink {
@@ -21,7 +21,7 @@ public class UnnecessaryJavaDocLink {
}
/**
- * @see com.siyeh.igtest.style.unnecessary_javadoc_link.UnnecessaryJavaDocLink
+ * @see com.siyeh.igtest.javadoc.unnecessary_javadoc_link.UnnecessaryJavaDocLink
* something
*/
void bar() {}
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_javadoc_link/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/unnecessary_javadoc_link/expected.xml
index d8e1a99fad21..d8e1a99fad21 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_javadoc_link/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/javadoc/unnecessary_javadoc_link/expected.xml
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/jdk/auto_boxing/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/jdk/auto_boxing/expected.xml
index aa560f17e0e9..2f40755387dc 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/jdk/auto_boxing/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/jdk/auto_boxing/expected.xml
@@ -17,13 +17,6 @@
<problem>
<file>AutoBoxing.java</file>
- <line>11</line>
- <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Auto-boxing</problem_class>
- <description>Auto-boxing &lt;code&gt;someNumber++&lt;/code&gt; #loc</description>
- </problem>
-
- <problem>
- <file>AutoBoxing.java</file>
<line>12</line>
<problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Auto-boxing</problem_class>
<description>Auto-boxing &lt;code&gt;~someNumber&lt;/code&gt; #loc</description>
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/BooleanConstructor.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/BooleanConstructor.java
new file mode 100644
index 000000000000..f08d4ebecc2e
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/BooleanConstructor.java
@@ -0,0 +1,10 @@
+package com.siyeh.igtest.performance.boolean_constructor;
+
+public class BooleanConstructor {
+
+ void foo(boolean b) {
+ Boolean b1 = new Boolean();
+ Boolean b2 = new Boolean(b);
+ Boolean b3 = new Boolean(true);
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/expected.xml
new file mode 100644
index 000000000000..d7cc45f68716
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/performance/boolean_constructor/expected.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+ <problem>
+ <file>BooleanConstructor.java</file>
+ <line>7</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Boolean constructor call</problem_class>
+ <description>Boolean constructor call &lt;code&gt;new Boolean(b)&lt;/code&gt; #loc</description>
+ </problem>
+
+ <problem>
+ <file>BooleanConstructor.java</file>
+ <line>8</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Boolean constructor call</problem_class>
+ <description>Boolean constructor call &lt;code&gt;new Boolean(true)&lt;/code&gt; #loc</description>
+ </problem>
+
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/verbose/UnnecessaryLocalVariableInspection.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/verbose/UnnecessaryLocalVariableInspection.java
deleted file mode 100644
index 3102286c2a5a..000000000000
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/verbose/UnnecessaryLocalVariableInspection.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.siyeh.igtest.verbose;
-
-public class UnnecessaryLocalVariableInspection {
-
- public int foo() {
- int a = 2;
- int b = a;
- return b;
- }
-
- public int bar() {
- int b = 3;
- return b;
- }
-
- public int bar2() throws Exception{
- final Exception b = new Exception();
- throw b;
- }
-
- public int baz() {
- int a;
- int b = 3;
- a = b;
- return a;
- }
-
- public int bazoom() {
- final int i = foo();
- bar();
- final int value = i;
- System.out.println(value);
- return 3;
- }
-}