openrewrite / openrewrite/rewrite-static-analysis
DefaultComesLast recipe creates duplicate case
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 62
- Forks
- 112
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 40
Description
If default comes before a case and simply continues into that case
default:
case DERIVATION_MODE:
System.out.println("default");
break;
refactoring with org.openrewrite.staticanalysis.DefaultComesLast from org.openrewrite.recipe:rewrite-static-analysis:1.6.0 results in a duplicate case and code duplication
case DERIVATION_MODE:
System.out.println("default");
break;
case DERIVATION_MODE:
default:
System.out.println("default");
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Java switch example with org.openrewrite.staticanalysis.DefaultComesLast from rewrite-static-analysis:1.6.0, then inspect the recipe implementation and its existing tests. Done means the transformation no longer creates a duplicate case or duplicates the default branch, with a regression test covering this input.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100