test/tools/javac/StringsInSwitch/StringSwitches.java
Print this page
*** 21,31 ****
* questions.
*/
/*
* @test
! * @bug 6827009
* @summary Positive tests for strings in switch.
* @author Joseph D. Darcy
*/
public class StringSwitches {
--- 21,31 ----
* questions.
*/
/*
* @test
! * @bug 6827009 7071246
* @summary Positive tests for strings in switch.
* @author Joseph D. Darcy
*/
public class StringSwitches {
*** 34,43 ****
--- 34,44 ----
int failures = 0;
failures += testPileup();
failures += testSwitchingTwoWays();
failures += testNamedBreak();
+ failures += testExtraParens();
if (failures > 0) {
throw new RuntimeException();
}
}
*** 258,263 ****
--- 259,279 ----
return result |= (1<<4);
}
result |= (1<<5);
return result;
}
+
+ private static int testExtraParens() {
+ int failures = 1;
+ String s = "first";
+
+ switch(s) {
+ case ("first"):
+ failures = 0;
+ break;
+ case "second":
+ throw new RuntimeException("Should not be reached.");
+ }
+
+ return failures;
+ }
}