1 import edu.umd.cs.findbugs.annotations.DesireWarning; 2 3 public class ArrayToString { 4 5 private static final String[] gargs = new String[] { "1", "2" }; 6 7 public static void main(String[] args) { 8 ArrayToString a = new ArrayToString(); 9 a.print0(args); 10 a.print1(); 11 a.print2(); 12 a.print3(); 13 } 14 15 @DesireWarning("USELESS_STRING") 16 public void print0(String args[]) { 17 System.out.println(args.toString()); 18 } 19 20 @DesireWarning("USELESS_STRING") 21 public void print1() { 22 String[] args2 = new String[] { "Hello", "there" }; 23 System.out.println(args2.toString()); 24 } 25 26 @DesireWarning("DMI_INVOKING_TOSTRING_ON_ANONYMOUS_ARRAY") 27 public void print2() { 28 System.out.println((new String[] { "one", "two" }).toString()); 29 } 30 31 @DesireWarning("DMI_INVOKING_TOSTRING_ON_ARRAY") 32 public void print3() { 33 System.out.println(gargs.toString()); 34 } 35 }