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

Paul Sandoz psandoz at openjdk.org
Thu Sep 5 18:08:02 UTC 2024


On Thu, 5 Sep 2024 01:49:24 GMT, Mourad Abbay <mabbay at openjdk.org> wrote:

>> Unify code that generates code model of switch statement and expression
>
> Mourad Abbay has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Refactor

Marked as reviewed by psandoz (Lead).

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ReflectMethods.java line 1674:

> 1672: 
> 1673:             JCTree.JCCaseLabel headCl = c.labels.head;
> 1674:             switch (c.caseKind) {

Suggestion, up to you. You can make this a switch expression yielding the body builder and directly return the result

return switch (c.caseKind) {
...

  try {
    yield stack.body;
  } finally {
    popBody();
  }
...

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

PR Review: https://git.openjdk.org/babylon/pull/220#pullrequestreview-2283759177
PR Review Comment: https://git.openjdk.org/babylon/pull/220#discussion_r1745962614


More information about the babylon-dev mailing list