Cross Reference: NonConstantLabel.java
xref
: /
openjdk7
/
langtools
/
test
/
tools
/
javac
/
StringsInSwitch
/
NonConstantLabel.java
Home
History
Annotate
Line#
Navigate
Download
Search
only in
./
429
N/A
/*
429
N/A
* @test /nodynamiccopyright/
429
N/A
* @bug 6827009
429
N/A
* @summary Check for non-constant case labels.
429
N/A
* @
compile
/
fail
-source 6
NonConstantLabel.java
610
N/A
* @
compile
/
fail
/
ref
=NonConstantLabel.out -XDrawDiagnostics
NonConstantLabel.java
429
N/A
*/
429
N/A
class
NonConstantLabel
{
429
N/A
String
m(
String
s) {
429
N/A
String
fauxConstant
=
"Goodbye Cruel World"
;
429
N/A
switch
(s) {
429
N/A
case
"Hello World"
:
429
N/A
return
(s);
429
N/A
case
fauxConstant
:
429
N/A
return
(s + s);
429
N/A
}
429
N/A
}
429
N/A
}