RFR: 8329115: Crash involving return from inner switch

Jan Lahoda jlahoda at openjdk.org
Wed Mar 27 09:05:31 UTC 2024


On Tue, 26 Mar 2024 18:05:36 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

> When a `return` is used erroneously in a `switch`, attribution should continue for the `tree.expr` of a return node if exists.
> 
> 
> int test() {
>       return switch (new R1()) {
>           case R1() -> {
>               return switch (new R2()) { // crashes, instead it should just be the error: attempt to return out of a switch expression
>                   case R2() -> 1;
>               };
>           }
>       };
>   }

Looks good to me, thanks!

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

Marked as reviewed by jlahoda (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/18494#pullrequestreview-1962690780


More information about the compiler-dev mailing list