1 /*
2 * @test /nodynamiccopyright/
3 * @bug 6827009
4 * @summary Check for non-constant case labels.
5 * @compile/fail/ref=NonConstantLabel6.out -XDrawDiagnostics -source 6 NonConstantLabel.java
6 * @compile/fail/ref=NonConstantLabel.out -XDrawDiagnostics NonConstantLabel.java
7 */
8 class NonConstantLabel {
9 String m(String s) {
10 String fauxConstant = "Goodbye Cruel World";
11 switch(s) {
12 case "Hello World":
13 return(s);
14 case fauxConstant:
15 return (s + s);
16 }
17 }
18 }
|
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 6827009
4 * @summary Check for non-constant case labels.
5 * @compile/fail/ref=NonConstantLabel.out -XDrawDiagnostics NonConstantLabel.java
6 */
7 class NonConstantLabel {
8 String m(String s) {
9 String fauxConstant = "Goodbye Cruel World";
10 switch(s) {
11 case "Hello World":
12 return(s);
13 case fauxConstant:
14 return (s + s);
15 }
16 }
17 }
|