Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove RemoveMethodCallVisitor #406

Merged
merged 4 commits into from
Dec 10, 2024
Merged

Conversation

jevanlingen
Copy link
Contributor

What's changed?

Remove RemoveMethodInvocationsVisitor and update the RemoveUnneededAssertion recipe as it did use that vistor.

What's your motivation?

As the core's RemoveMethodInvocationsVisitor recipe can now also remove static methods (openrewrite/rewrite#4754), there is not need for the RemoveMethodCallVisitor anymore.

Any additional context

I went a little overboard with improving the RemoveUnneededAssertion recipe. I did not only replace the remove-method-invocation visitors, but also rewrote most of the other stuff. It used it's own form of TriFunction (called a InvokeRemoveMethodCallVisitor), which made the code a little hard to get. I reverted it to a native method, which is more in line with the rest of the code we tend to write.

Checklist

  • I've added unit tests to cover both positive and negative cases
  • I've read and applied the recipe conventions and best practices
  • I've used the IntelliJ IDEA auto-formatter on affected files

Copy link
Contributor

@timtebeek timtebeek left a comment

Choose a reason for hiding this comment

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

Great to see the reduction here; thanks for this and the change upstream!

@timtebeek timtebeek merged commit 4073a69 into main Dec 10, 2024
2 checks passed
@timtebeek timtebeek deleted the remove-remove-method-call-visitor branch December 10, 2024 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants