Add recipe to remove unused constructor and method parameters#560
Add recipe to remove unused constructor and method parameters#560iddeepak wants to merge 44 commits intoopenrewrite:mainfrom
Conversation
|
This one done: Do we cover |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
RemoveUnusedParams only handles unused parameters. Unused assignments would need their own recipe |
…s.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Pankraz76
left a comment
There was a problem hiding this comment.
try avoid feature envy (& DRY) giving single point of truth (SPOT)
Pankraz76
left a comment
There was a problem hiding this comment.
new test case - cover constructor as well.
Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments Updated review comments
…s.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…s.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Pankraz76
left a comment
There was a problem hiding this comment.
last polish.
Done very well, could already merge.
|
you are really talented, keep pushing @iddeepak. |
…s.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…s.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…s.java Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
This PR is stale because it has been open for 90 days with no activity. Remove |
|
This PR is stale because it has been open for 90 days with no activity. Remove |
What’s changed?
I’ve added a new recipe class, RemoveUnusedParams, that automatically removes parameters from Java methods when they’re declared but never referenced in the method body. It still respects:
@Deprecated)Alongside the main recipe, I’ve expanded the unit tests to cover:
What’s your motivation?
Over time, code tends to accumulate unused parameters—leftovers from refactoring, changing requirements, or evolving APIs. They add noise, make signatures harder to read, and can confuse future maintainers. This recipe:
Anything in particular you'd like reviewers to focus on?
JavaIsoVisitorpass—does it still scale on large projects?Anyone you would like to review specifically?
Have you considered any alternatives or workarounds?
MethodMatcheror type-based override detection; this felt like overkill for a simple annotation check.Any additional context
mvn test.Checklist