> From: "Brian Goetz"
> To: "Remi Forax" , "Tagir Valeev"
> Cc: "amber-spec-experts"
> Sent: Jeudi 28 Octobre 2021 19:48:40
> Subject: Re: switch expression with not explicit yield value should work ?
> If all branches throw,
t;
Cc: "amber-spec-experts"
Sent: Lundi 30 Août 2021 04:00:27
Subject: Re: switch expression with not explicit yield value should work ?
Hello!
I think this is not related to recent JEPs. This behavior is
standardised since Java 14 when Switch expression was introduced:
// Compilation e
- Original Message -
> From: "Tagir Valeev"
> To: "Remi Forax"
> Cc: "amber-spec-experts"
> Sent: Lundi 30 Août 2021 04:00:27
> Subject: Re: switch expression with not explicit yield value should work ?
> Hello!
>
> I think this is not r
Hello!
I think this is not related to recent JEPs. This behavior is
standardised since Java 14 when Switch expression was introduced:
// Compilation error
int x = switch(0) {
default -> throw new IllegalArgumentException();
};
This is explicitly specified (15.28.1) [1]:
> It is a compile-ti
Another case where the spec is weird,
i've converted a project that generate a visitor from a grammar (something like
yacc) to use a switch on type instead.
Sometimes for a degenerate portion of the grammar i've an empty visitor that
always throw an exception,
the equivalent code with a switch i