don't let "'StringBuffer' can be replaced with 'String'" inspection report problems...
[idea/community.git] / plugins / InspectionGadgets / test / com / siyeh / igtest / performance / string_buffer_replaceable_by_string / StringBufferReplaceableByString.java
1 package com.siyeh.igtest.performance.string_buffer_replaceable_by_string;
2
3 public class StringBufferReplaceableByString {
4
5   StringBuilder foo() {
6     StringBuilder builder = new StringBuilder("asdfasdfasdf");
7     StringBuffer buffer = new StringBuffer("test");
8     StringBuilder result = new StringBuilder("return");
9     return result;
10   }
11
12   public void foo1()
13   {
14     final StringBuffer buffer = new StringBuffer().append('a');
15     System.out.println(buffer.toString());
16   }
17
18   public void foo2()
19   {
20     final StringBuffer buffer = new StringBuffer("foo").append("bar");
21     System.out.println(buffer.toString());
22   }
23
24   public void bar(int i) {
25     System.out.println(new StringBuilder("asdf").append(i).toString());
26   }
27
28   public void exceptions(String pcdata, int i) {
29     StringBuilder b = new StringBuilder();
30     String s = new StringBuilder().append(pcdata, 0, i).toString();
31   }
32 }