RFR: 8367499: Refactor exhaustiveness computation from Flow into a separate class [v3]

Jan Lahoda jlahoda at openjdk.org
Thu Oct 9 15:31:26 UTC 2025


> Currently the switch exhaustiveness computation code is part of `Flow`. And while conceptually the check is part of the `Flow` phase, the code is >500 lines of code currently, and likely to get bigger/more complicated in the future. Among other reasons due to enhancements like https://bugs.openjdk.org/browse/JDK-8367530.
> 
> The proposal herein is to move the exhaustiveness computation to a separate class `ExhastivenessComputer`. There's no functional change, only move of the code. This is intentional, to aid the review process.
> 
> One possibility to inspect what is happening is:
> 
> git show upstream/pr/27247:src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java >/tmp/Flow-original.java
> diff -d -w /tmp/Flow-original.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ExhaustivenessComputer.java >/tmp/exhaustivenesscomputer-comparison.diff
> diff -d -w /tmp/Flow-original.java src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java >/tmp/flow-comparison.diff
> 
> and inspecting `/tmp/exhaustivenesscomputer-comparison.diff`, `/tmp/flow-comparison.diff`.

Jan Lahoda has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:

 - Merge branch 'JDK-8364991' into JDK-8367499
 - Adding doc comment.
 - 8367499: Refactor exhaustiveness computation from Flow into a separate class

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

Changes: https://git.openjdk.org/jdk/pull/27253/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=27253&range=02
  Stats: 1210 lines in 2 files changed: 637 ins; 570 del; 3 mod
  Patch: https://git.openjdk.org/jdk/pull/27253.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/27253/head:pull/27253

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


More information about the compiler-dev mailing list