[code-reflection] RFR: Unify code that generates code model of switch statement and expression [v3]

Mourad Abbay mabbay at openjdk.org
Thu Sep 5 16:46:05 UTC 2024


On Thu, 5 Sep 2024 12:32:04 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Refactor
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ReflectMethods.java line 1533:
> 
>> 1531:                 Body.Builder caseBody = visitCaseBody(c, caseBodyType);
>> 1532: 
>> 1533:                 if (c.labels.head instanceof JCTree.JCDefaultCaseLabel) {
> 
> I'm not sure this is optimal - can't we add all labels and bodies (even default ones) and then, after the loop, only add a synthetic default label if `isDefaultCaseNeeded` is set? Or, if there are cases where the flag is set, but there is already a real default label, can we maybe just unset the flag if we see a default label in the loop?
> 
> In other words, I don't see what adding the "regular" default body after the loop buys us.

We want to have the default body as the last one.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/220#discussion_r1745866356


More information about the babylon-dev mailing list