-
Notifications
You must be signed in to change notification settings - Fork 51
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
FinalizeMethodArguments should consider unary increments/decrements #176
Comments
Thanks for the detailed report @AlejandroBertolo ! Seems like an oversight indeed, and would be good to see fixed. Thanks for offering to help out; let me know if you're able to fit that in, otherwise I can try to fit this in. Roughly speaking the steps should be:
|
Greetings. Thanks for your work in this useful library!.
We've found a issue with the FinalizeMethodArguments recipe, by which unary operators are not considered when deciding if a parameter has been reassigned. This leads to compilation errors in processed source code.
What version of OpenRewrite are you using?
staticAnalysis 1.0.7
RecipeBom 2.3.0
RewriteMavenPlugin 5.7.1
How are you running OpenRewrite?
Through Maven plugin, in a multi-module project.
What is the smallest, simplest way to reproduce the problem?
The following test generates changes that won't compile.
edit: edited the test for less complexity
What did you expect to see?
What did you see instead?
Are you interested in contributing a fix to OpenRewrite?
Yes. The fix seems easy as it is already implemented in FinalizeLocalVariables. Bringing the VisitUnary and VisitAssignmentOperator logic from that recipe seems to fix the issues (altho the "add" variable in the last test method is not finalized, though that would be a minor concern).
The text was updated successfully, but these errors were encountered: