-
Notifications
You must be signed in to change notification settings - Fork 80
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
Recipe to call ToolProvider methods as static methods, not on instances #477
Recipe to call ToolProvider methods as static methods, not on instances #477
Conversation
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.
Hi! Some quick feedback to hopefully prevent any duplicate work, and end up with a leaner PR.
src/test/java/org/openrewrite/java/migrate/RemovedToolProviderConstructorTest.java
Outdated
Show resolved
Hide resolved
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 prompting me to revisit ChangeMethodTargetToStatic
@ranuradh ; I've now simplified your PR to retain the test and implement the recipe as a declarative one, as per our best practices. That also clears out the cycle issues we saw before.
Good to merge if you ask me; I'll leave a final review and merge up to @cjobinabo
Thanks @timtebeek this works. I have another recipe call that is similar to this one..will help with that as well! |
What's changed?
Created RemovedToolProviderConstructor Recipe:
For the following rule:
What's your motivation?
This recipe checks for a specific method pattern and converts it to a static call.The existing recipe ChangeMethodTargetToStatic did not work in this case since it doesn't meet the criteria of the method should not be static and should not be of the SameReceiverType
Anything in particular you'd like reviewers to focus on?
I had to create a new branch and work on this recipe since my old branch got corrupted for some reason so this work is a duplicate of #454 and I updated the test to cover the chained call of the methods to be converted to Static.
Anyone you would like to review specifically?
@cjobinabo
Have you considered any alternatives or workarounds?
Any additional context
Checklist