Disallowing break label (and continue label) inside an expression switch

Remi Forax forax at univ-mlv.fr
Fri Mar 2 14:30:01 UTC 2018

Hi all,
as far as i remember, the current idea to differentiate between a break label and a break value is to let the compiler figure this out,
i wonder if it's not simpler to disallow break label (and continue label) inside an expression switch.

After all, an expression switch do not exist yet, so no backward compatibility issue, it may make some refactoring impossible but had the great advantage to do not allow a lot of puzzler codes like the one below.

enum Result {

Result result(String[] args) {
  ONE: for(String s: args) {
     return switch(s) {
       case "several":
       case "many":
         break MANY;
       case "one":
         break ONE;
  throw ...;


More information about the amber-spec-experts mailing list