Skip to content

Conversation

lahodaj
Copy link
Contributor

@lahodaj lahodaj commented Sep 12, 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.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Integration blocker

 ⚠️ Dependency #27247 must be integrated first

Issue

  • JDK-8367499: Refactor exhaustiveness computation from Flow into a separate class (Task - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/27253/head:pull/27253
$ git checkout pull/27253

Update a local copy of the PR:
$ git checkout pull/27253
$ git pull https://git.openjdk.org/jdk.git pull/27253/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 27253

View PR using the GUI difftool:
$ git pr show -t 27253

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/27253.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Sep 12, 2025

👋 Welcome back jlahoda! A progress list of the required criteria for merging this PR into pr/27247 will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Sep 12, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Sep 12, 2025

@lahodaj The following label will be automatically applied to this pull request:

  • compiler

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added compiler compiler-dev@openjdk.org rfr Pull request is ready for review labels Sep 12, 2025
@mlbridge
Copy link

mlbridge bot commented Sep 12, 2025

Webrevs

.collect(Collectors.toSet());

for (PatternDescription pdOne : patterns) {
if (pdOne instanceof BindingPattern bpOne) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The scope of this if is quite wide, you could consider inverting the condition and continueing if the condition does not match. This would save an indentation level.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but the point here is to move the code from one place to another (as suggested in the description). I suspect that any change, despite how desirable it might look, is likely to make reviewing this change more difficult, and hence I would like to avoid that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for the clarification.

@openjdk
Copy link

openjdk bot commented Oct 6, 2025

@lahodaj this pull request can not be integrated into pr/27247 due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JDK-8367499
git fetch https://git.openjdk.org/jdk.git pr/27247
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge pr/27247"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Oct 6, 2025
@openjdk openjdk bot removed the merge-conflict Pull request has merge conflict with target branch label Oct 9, 2025
Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, looks clean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compiler compiler-dev@openjdk.org rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

3 participants