-
Notifications
You must be signed in to change notification settings - Fork 356
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
RemoveMethodInvocationsVisitor
can remove static method
#4754
RemoveMethodInvocationsVisitor
can remove static method
#4754
Conversation
Thanks for calling that out @dralagen ! The old recipe in rewrite-migrate-java used this visitor that still exists in rewrite-static-analysis. We'll need to work out the difference between that and the new RemoveMethodInvocationsVisitor that lives here. rewrite/rewrite-java/src/main/java/org/openrewrite/java/RemoveMethodInvocationsVisitor.java Lines 36 to 48 in 104f705
Any help appreciated, but not expected or required; just let me know if you're open to explore this further and know that we already appreciate you logging this as a runnable issue. |
RemoveMethodInvocationsVisitor
can remove static method
dd2441a
to
3aae7a2
Compare
Looking at the tests I believe the static method call is not removed by rewrite/rewrite-java/src/main/java/org/openrewrite/java/RemoveMethodInvocationsVisitor.java Lines 124 to 132 in cf71b0d
|
That's right, I just pushed a first implementation. |
rewrite-java/src/test/java/org/openrewrite/java/RemoveMethodInvocationsVisitorTest.java
Outdated
Show resolved
Hide resolved
rewrite-java/src/test/java/org/openrewrite/java/RemoveMethodInvocationsVisitorTest.java
Outdated
Show resolved
Hide resolved
rewrite-java/src/test/java/org/openrewrite/java/RemoveMethodInvocationsVisitorTest.java
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 taking this on @jevanlingen ! Did you happen to check if this also resolves the outstanding items on
And does this mean the visitor in rewrite-static-analysis can now be replaced & removed?
Yes and yes, I just tested it locally, all test of |
Thank you very much for your responsiveness and the time taken to fix it. |
What's changed?
Add test to verify if RemoveMethodInvocationsVisitor can delete static method
What's your motivation?
After moving recipe
org.openrewrite.java.migrate.RemoveMethodInvocation
defined on projectrewrite-migrate-java
toorg.openrewrite.java.RemoveMethodInvocations
in `rewrite-java' some custom recipe now failedthis exemple work but the recipe has been removed :
this exemple break TU : https://github.com/dralagen/rewrite-testing-frameworks/blob/removeMethodInvocations/src/main/resources/META-INF/rewrite/easymock.yml
Anyone you would like to review specifically?
@timtebeek I created the PR as draft with test the remove Method static invocation detect on the Migration from easymock to mockito
Have you considered any alternatives or workarounds?
I see the same issue on PR :
Checklist