GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — `MinimumSwitchCases` ignores switches with cases with more than 1 break. by JohannisK · Pull Request #568 · openrewrite/rewrite-static-analysis

Conversation

@JohannisK

@JohannisK JohannisK commented May 26, 2025

Copy link
Copy Markdown
Contributor

What's changed?

MinimumSwitchCases ignores switches with cases with more than 1 break.

What's your motivation?

When a case contains several breaks rewriting it to an if-statement results in an if-statement with a break.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
JohannisK added 2 commits May 26, 2025 07:51
@JohannisK
Added check for multiple break statements
974a3af
@JohannisK
formatting
97ef9ce
@moderne-meeseeks moderne-meeseeks Bot added this to OpenRewrite May 26, 2025
@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite May 26, 2025
Jenson3210
Jenson3210 reviewed May 26, 2025
View reviewed changes
Comment thread src/main/java/org/openrewrite/staticanalysis/MinimumSwitchCases.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@JohannisK
Added support for nested switches
33ed31a
Jenson3210
Jenson3210 reviewed May 26, 2025
View reviewed changes
Comment thread src/test/java/org/openrewrite/staticanalysis/MinimumSwitchCasesTest.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

Jenson3210
Jenson3210 approved these changes May 26, 2025
View reviewed changes

@Jenson3210 Jenson3210 left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Thanks for this fix here!

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@github-project-automation github-project-automation Bot moved this from In Progress to Ready to Review in OpenRewrite May 26, 2025
@JohannisK
JohannisK merged commit 19da2f7 into main May 26, 2025
@JohannisK
JohannisK deleted the 1200-incorrectincomplete-switch-expression-conversion-to-if-condition branch May 26, 2025 08:31
@github-project-automation github-project-automation Bot moved this from Ready to Review to Done in OpenRewrite May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

2 more reviewers
@jevanlingen jevanlingen jevanlingen left review comments
@Jenson3210 Jenson3210 Jenson3210 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

OpenRewrite
Archived in project

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@JohannisK @jevanlingen @Jenson3210
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.