RFR: 8314226: Series of colon-style fallthrough switch cases with guards compiled incorrectly [v5]

Aggelos Biboudis abimpoudis at openjdk.org
Fri Sep 8 20:25:45 UTC 2023

On Thu, 7 Sep 2023 14:26:25 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>>   Make patchCompletingNormallyCases void returning
> I think I'd like to ask for some more tests. Especially:
> - multiple cases with statements where the fall through goes from one to the other, e.g. something like:
>    case Integer _ when ((Integer) obj) > 0:
>    case String _ when !((String) obj).isEmpty():
>        System.err.println(1);
>    case null:
>        System.err.println(2);
>    default:    
>        System.err.println(3);
> - cases with loop statements with break (and/or continue) to the loop. E.g.:
> while (true) {break;}
> instead of `System.err.println(2);`
> - break/continue, return, yield(?) going outside of the switch (probably one of them would be enough) in the duplicated section.

Thank you @lahodaj for the improvement. This is extremely elegant and reduces the code size!!!


PR Comment: https://git.openjdk.org/jdk/pull/15532#issuecomment-1712178630

More information about the compiler-dev mailing list