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

Archie L. Cobbs duke at openjdk.org
Fri Nov 11 21:49:31 UTC 2022


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.

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

Commit messages:
 - 8296846: Minor cleanup of some dead code in Flow.java

Changes: https://git.openjdk.org/jdk/pull/11112/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=11112&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8296846
  Stats: 13 lines in 1 file changed: 0 ins; 13 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/11112.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/11112/head:pull/11112

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


More information about the compiler-dev mailing list