1 /**
2 * @test /nodynamiccopyright/
3 * @bug 8206986
4 * @compile/fail/ref=SwitchNoExtraTypes.out -XDrawDiagnostics SwitchNoExtraTypes.java
5 */
6
7 public class SwitchNoExtraTypes {
8
9 private void switchBoolean(boolean b) {
10 switch (b) {
11 case true: return ;
12 }
13 }
14
15 private void switchLong(long l) {
16 switch (l) {
17 case 0: return ;
18 }
19 }
20
21 private void switchFloat(float f) {
22 switch (f) {
23 case 0: return ;
|
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 8206986
4 * @summary Verify switch over boolean/long/float/double is not allowed.
5 * @compile/fail/ref=SwitchNoExtraTypes.out -XDrawDiagnostics SwitchNoExtraTypes.java
6 */
7
8 public class SwitchNoExtraTypes {
9
10 private void switchBoolean(boolean b) {
11 switch (b) {
12 case true: return ;
13 }
14 }
15
16 private void switchLong(long l) {
17 switch (l) {
18 case 0: return ;
19 }
20 }
21
22 private void switchFloat(float f) {
23 switch (f) {
24 case 0: return ;
|