2009-11-02 21:36:59 -08:00
|
|
|
/*
|
|
|
|
* @test /nodynamiccopyright/
|
|
|
|
* @bug 6827009
|
|
|
|
* @summary Check for non-constant case labels.
|
2015-05-15 01:36:32 -07:00
|
|
|
* @compile/fail/ref=NonConstantLabel6.out -XDrawDiagnostics -source 6 NonConstantLabel.java
|
2010-07-26 14:18:45 -07:00
|
|
|
* @compile/fail/ref=NonConstantLabel.out -XDrawDiagnostics NonConstantLabel.java
|
2009-11-02 21:36:59 -08:00
|
|
|
*/
|
|
|
|
class NonConstantLabel {
|
|
|
|
String m(String s) {
|
|
|
|
String fauxConstant = "Goodbye Cruel World";
|
|
|
|
switch(s) {
|
|
|
|
case "Hello World":
|
|
|
|
return(s);
|
|
|
|
case fauxConstant:
|
|
|
|
return (s + s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|