1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/StringsInSwitch/RepeatedStringCaseLabels2.java Mon Nov 02 21:36:59 2009 -0800 1.3 @@ -0,0 +1,18 @@ 1.4 +/* 1.5 + * @test /nodynamiccopyright/ 1.6 + * @bug 6827009 1.7 + * @summary Check for repeated string case labels. 1.8 + * @compile/fail -source 6 RepeatedStringCaseLabels2.java 1.9 + * @compile/fail/ref=RSCL2.out -XDstdout -XDrawDiagnostics RepeatedStringCaseLabels2.java 1.10 + */ 1.11 +class RepeatedStringCaseLabels2 { 1.12 + String m(String s) { 1.13 + final String constant = "Hello" + " " + "World"; 1.14 + switch(s) { 1.15 + case "Hello World": 1.16 + return(s); 1.17 + case constant: 1.18 + return (s + s); 1.19 + } 1.20 + } 1.21 +}