RFR: 8296846: Minor cleanup of some dead code in Flow.java

Archie L. Cobbs duke at openjdk.org
Wed Nov 16 20:27:04 UTC 2022


On Fri, 11 Nov 2022 21:40:36 GMT, Archie L. Cobbs <duke at openjdk.org> wrote:

> This patch removes two bits of dead code that I ran across.
> 
> The only interesting bit is the second patch, which removes this check:
> 
>                 /*  Ignore synthetic methods, except for translated lambda methods.
>                  */
>                 if ((tree.sym.flags() & (SYNTHETIC | LAMBDA_METHOD)) == SYNTHETIC) {
>                     return;
>                 }
> 
> because it's always preceded by this more general check:
> 
>              /*  MemberEnter can generate synthetic methods ignore them
>               */
>              if ((tree.sym.flags() & SYNTHETIC) != 0) {
>                  return;
>              }
> 
> and so can never match.
> 
> So the patch preserves the existing behavior, but the bit being removed there begs the question: was there some scenario where `tree.sym.flags()` could have both `SYNTHETIC` and `LAMBDA_METHOD` that we were supposed to be handling?
> 
> As it turns out, the `LAMBDA_METHOD` flag is only ever set by `LambdaToMethod`, but that class runs after this code (during flow analysis). So if there ever was any such scenario, it can no longer happen anyway.

Thanks for the review.

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

PR: https://git.openjdk.org/jdk/pull/11112


More information about the compiler-dev mailing list