New JEP: Switch Expressions for the Java Language

Remi Forax forax at univ-mlv.fr
Thu Dec 7 23:02:03 UTC 2017


Hi Brian,
correct me of i'm wrong but there is no discussion about accessing to a local variable in the body of an expression,

void m(int x, int y) {
  return switch(x) {
    case 0 -> y;   // is it allowed, how is it translated ?
    default -> 0;
  };
}

regards,
Rémi

----- Mail original -----
> De: "Brian Goetz" <brian.goetz at oracle.com>
> À: "amber-spec-experts" <amber-spec-experts at openjdk.java.net>
> Envoyé: Jeudi 7 Décembre 2017 23:33:36
> Objet: New JEP: Switch Expressions for the Java Language

> We've separated out a package of standalone improvements to `switch`
> (switch expressions, case null, and case alternation) into their own JEP:
> 
>      https://bugs.openjdk.java.net/browse/JDK-8192963


More information about the amber-spec-experts mailing list