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

Aggelos Biboudis abimpoudis at openjdk.org
Fri Sep 1 15:12:30 UTC 2023


On Fri, 1 Sep 2023 12:55:41 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Address review
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java line 578:
> 
>> 576:                         }
>> 577: 
>> 578:                         boolean hasGuard = c.guard != null;
> 
> Can this declaration occur before the enclosing `if` ?

Extracted the inlined code in a separate step.

> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java line 590:
> 
>> 588:                         continueSwitch.target = tree;
>> 589: 
>> 590:                         if (previousC != null && hasGuard && previousCompletesNormally) {
> 
> What happens if there are three of them?

Correct. I refactored and extracted the code in a separate step.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15532#discussion_r1313160057
PR Review Comment: https://git.openjdk.org/jdk/pull/15532#discussion_r1313159596


More information about the compiler-dev mailing list