test/tools/javac/StringsInSwitch/BadlyTypedLabel2.java

changeset 430
8fb9b4be3cb1
child 611
4172cfff05f0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/StringsInSwitch/BadlyTypedLabel2.java	Mon Nov 02 21:36:59 2009 -0800
     1.3 @@ -0,0 +1,19 @@
     1.4 +/*
     1.5 + * @test  /nodynamiccopyright/
     1.6 + * @bug 6827009
     1.7 + * @summary Check for case lables of different types.
     1.8 + * @compile/fail -source 6 BadlyTypedLabel2.java
     1.9 + * @compile/fail/ref=BadlyTypedLabel2.out -XDstdout -XDrawDiagnostics BadlyTypedLabel2.java
    1.10 + */
    1.11 +import static java.math.RoundingMode.*;
    1.12 +
    1.13 +class BadlyTypedLabel2 {
    1.14 +    String m(String s) {
    1.15 +        switch(s) {
    1.16 +        case "Oh what a feeling...":
    1.17 +            return(s);
    1.18 +        case CEILING:
    1.19 +            return ("... switching on the ceiling!");
    1.20 +        }
    1.21 +    }
    1.22 +}

mercurial