langtools/test/tools/javac/StringsInSwitch/RepeatedStringCaseLabels1.java
author sogoel
Thu, 05 Jun 2014 10:57:10 -0700
changeset 24797 850ebd4d80a7
parent 6150 d055fa8ced62
child 30715 099641abfb05
permissions -rw-r--r--
8044072: Group 2: create .out files for OverrideChecks tests in tools/javac dir Reviewed-by: jjg
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4142
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
     1
/*
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
     2
 * @test  /nodynamiccopyright/
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
     3
 * @bug 6827009
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
     4
 * @summary Check for repeated string case labels.
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
     5
 * @compile/fail -source 6 RepeatedStringCaseLabels1.java
6150
d055fa8ced62 6971882: Remove -XDstdout from javac test
jjg
parents: 4142
diff changeset
     6
 * @compile/fail/ref=RSCL1.out -XDrawDiagnostics RepeatedStringCaseLabels1.java
4142
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
     7
 */
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
     8
class RepeatedStringCaseLabels1 {
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
     9
    String m(String s) {
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
    10
        switch(s) {
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
    11
        case "Hello World":
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
    12
            return(s);
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
    13
        case "Hello" + " " + "World":
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
    14
            return (s + s);
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
    15
        }
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
    16
    }
bd950c8f4fb3 6827009: Project Coin: Strings in Switch
darcy
parents:
diff changeset
    17
}