diff options
author | Jean-Baptiste Queru <jbq@google.com> | 2013-02-08 15:14:04 -0800 |
---|---|---|
committer | Jean-Baptiste Queru <jbq@google.com> | 2013-02-08 15:14:04 -0800 |
commit | 9edc8f6b58f71ec510ba36b838f115718d9a174d (patch) | |
tree | 06f6df92024fa534ff27e1c0b5fc8b2002848093 /plugins/InspectionGadgets/test/com | |
parent | b56ea2a18f232d79481e778085fd64e8ae486fc3 (diff) | |
download | idea-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')
33 files changed, 417 insertions, 58 deletions
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/MoveThrows.after.java b/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/MoveThrows.after.java new file mode 100644 index 000000000000..2a8a561991d8 --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/MoveThrows.after.java @@ -0,0 +1,6 @@ +class C { + /** + * @throws RuntimeException + */ + void foo() {} +}
\ No newline at end of file diff --git a/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/MoveThrowsExistingComment.after.java b/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/MoveThrowsExistingComment.after.java new file mode 100644 index 000000000000..3727d489d70f --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/MoveThrowsExistingComment.after.java @@ -0,0 +1,8 @@ +class C { + + /** + * bla bla bla + * @throws RuntimeException + */ + void foo() {} +}
\ No newline at end of file diff --git a/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/MoveThrowsExistingComment.java b/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/MoveThrowsExistingComment.java new file mode 100644 index 000000000000..e1a66f77fcee --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/MoveThrowsExistingComment.java @@ -0,0 +1,7 @@ +class C { + + /** + * bla bla bla + */ + void foo() throws <caret>RuntimeException {} +}
\ No newline at end of file diff --git a/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/RemoveThrows.after.java b/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/RemoveThrows.after.java new file mode 100644 index 000000000000..a9706e21c8db --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/RemoveThrows.after.java @@ -0,0 +1,3 @@ +class C { + void foo() throws Exception {} +}
\ No newline at end of file diff --git a/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/RemoveThrows.java b/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/RemoveThrows.java new file mode 100644 index 000000000000..4d59f12ab08d --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/RemoveThrows.java @@ -0,0 +1,3 @@ +class C { + void foo() throws RuntimeExcept<caret>ion, Exception {} +}
\ No newline at end of file diff --git a/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/moveThrows.java b/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/moveThrows.java new file mode 100644 index 000000000000..ea95fddcf155 --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igfixes/errorhandling/throws_runtime_exception/moveThrows.java @@ -0,0 +1,3 @@ +class C { + void foo() throws RuntimeException<caret> {} +}
\ No newline at end of file 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><code>while</code> 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><code>while</code> 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><code>for</code> 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><code>for</code> 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><code>if</code> 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><code>if</code> 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><code>else</code> 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><code>else</code> 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><code>switch</code> 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><code>A</code> 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><code>case (5):</code> 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><code>case (6):</code> 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><code>switch</code> 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 <code>x</code> 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><code>switch</code> 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><code>switch</code> 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><code>switch</code> 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 <code>r3</code> 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 <code>a</code> 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 <code>b</code> 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 <code>b</code> 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 <code>b</code> 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 <code>b</code> 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 <code>value</code> 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 <code>Extender2</code> 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><code>package.html</code> may be converted to <code>package-info.java</code></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 <code>someNumber++</code> #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 <code>~someNumber</code> #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 <code>new Boolean(b)</code> #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 <code>new Boolean(true)</code> #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; - } -} |