RFR: 8304694: Runtime exception thrown when break stmt is missing

Vicente Romero vromero at openjdk.org
Wed Mar 22 20:57:40 UTC 2023


On Wed, 22 Mar 2023 16:14:34 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> For code like this:
> 
>     public static int runFallThrough(R6 r) {
>         switch (r) {
>             case R6(var v1, var v2) when v1 != 0: return 0;
>             case R6(var v1, var v2):
>         }
>         return 1;
>     }
> 
> 
> The execution falls through from the last case not outside the switch, but inside the fallback default case (that throws).
> 
> The current code is injecting breaks, but only for rule cases, and this situation where the last case needs a break is not handled. To simplify the code, it is now proposed to inject breaks at the beginning of the processing (rather than during processing/at the end) to all necessary cases.

looks good

-------------

Marked as reviewed by vromero (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/13146#pullrequestreview-1353462578


More information about the compiler-dev mailing list