summaryrefslogtreecommitdiff
path: root/plugins/InspectionGadgets/test/com/siyeh/igtest
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2013-04-24 10:43:41 -0700
committerTor Norbye <tnorbye@google.com>2013-04-24 10:43:41 -0700
commitb17587c84879dd2ea42495f1fbdadbc806b9475b (patch)
treeb4d9014f69cb8289627ddc75339a6b0b3fe1bc5e /plugins/InspectionGadgets/test/com/siyeh/igtest
parentb569bc6aa78f6eacf72e8b90622d300e1a9db25f (diff)
downloadidea-b17587c84879dd2ea42495f1fbdadbc806b9475b.tar.gz
Snapshot e242282deb41c328afbe971fc167e47ddfb26df9 from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: Ifdc1818cde7b63f6d7bf42801f18c7f1557b8d85
Diffstat (limited to 'plugins/InspectionGadgets/test/com/siyeh/igtest')
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/UnnecessaryToString.java30
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/expected.xml32
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_valueof/UnnecessaryCallToStringValueOf.java7
-rw-r--r--plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_valueof/expected.xml14
4 files changed, 83 insertions, 0 deletions
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/UnnecessaryToString.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/UnnecessaryToString.java
new file mode 100644
index 000000000000..a77660ab714a
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/UnnecessaryToString.java
@@ -0,0 +1,30 @@
+package com.siyeh.igtest.style.unnecessary_tostring;
+
+public class UnnecessaryToString {
+
+ String foo(Object o) {
+ return "star" + o.toString();
+ }
+
+ String bar() {
+ char[] cs = {'!'};
+ return "wars" + cs.toString();
+ }
+
+ void fizzz(Object o) {
+ boolean c = true;
+ System.out.println(o.toString() + c);
+ }
+
+ void polyadic(Object s) {
+ s = "abc" + s.toString() + "efg";
+ }
+
+ void printStream(Object o) {
+ System.out.print(o.toString());
+ }
+
+ void builder(StringBuilder builder, Object o) {
+ builder.append(o.toString());
+ }
+} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/expected.xml
new file mode 100644
index 000000000000..9aea4d234a81
--- /dev/null
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_tostring/expected.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<problems>
+
+ <problem>
+ <file>UnnecessaryToString.java</file>
+ <line>6</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unnecessary call to '.toString()'</problem_class>
+ <description>Unnecessary &lt;code&gt;toString()&lt;/code&gt; call #loc</description>
+ </problem>
+
+ <problem>
+ <file>UnnecessaryToString.java</file>
+ <line>20</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unnecessary call to '.toString()'</problem_class>
+ <description>Unnecessary &lt;code&gt;toString()&lt;/code&gt; call #loc</description>
+ </problem>
+
+ <problem>
+ <file>UnnecessaryToString.java</file>
+ <line>24</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unnecessary call to '.toString()'</problem_class>
+ <description>Unnecessary &lt;code&gt;toString()&lt;/code&gt; call #loc</description>
+ </problem>
+
+ <problem>
+ <file>UnnecessaryToString.java</file>
+ <line>28</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unnecessary call to '.toString()'</problem_class>
+ <description>Unnecessary &lt;code&gt;toString()&lt;/code&gt; call #loc</description>
+ </problem>
+
+</problems> \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_valueof/UnnecessaryCallToStringValueOf.java b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_valueof/UnnecessaryCallToStringValueOf.java
index cf3f87cfae7a..023d86fef245 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_valueof/UnnecessaryCallToStringValueOf.java
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_valueof/UnnecessaryCallToStringValueOf.java
@@ -21,4 +21,11 @@ public class UnnecessaryCallToStringValueOf {
s = "abc" + String.valueOf('d') + "efg";
}
+ void printStream() {
+ System.out.print(String.valueOf(7));
+ }
+
+ void builder(StringBuilder builder) {
+ builder.append(String.valueOf(0x8));
+ }
} \ No newline at end of file
diff --git a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_valueof/expected.xml b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_valueof/expected.xml
index 315e44ea81b7..c453124dc5ca 100644
--- a/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_valueof/expected.xml
+++ b/plugins/InspectionGadgets/test/com/siyeh/igtest/style/unnecessary_valueof/expected.xml
@@ -15,4 +15,18 @@
<description>&lt;code&gt;String.valueOf('d')&lt;/code&gt; can be simplified to ''d'' #loc</description>
</problem>
+ <problem>
+ <file>UnnecessaryCallToStringValueOf.java</file>
+ <line>25</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unnecessary call to 'String.valueOf()'</problem_class>
+ <description>&lt;code&gt;String.valueOf(7)&lt;/code&gt; can be simplified to '7' #loc</description>
+ </problem>
+
+ <problem>
+ <file>UnnecessaryCallToStringValueOf.java</file>
+ <line>29</line>
+ <problem_class severity="WARNING" attribute_key="WARNING_ATTRIBUTES">Unnecessary call to 'String.valueOf()'</problem_class>
+ <description>&lt;code&gt;String.valueOf(0x8)&lt;/code&gt; can be simplified to '0x8' #loc</description>
+ </problem>
+
</problems> \ No newline at end of file