You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Not at this stage sorry, but perhaps in the future if I become a more regular user. (From a glance at some rule implementations, the pattern matching engine indeed looks interesting and powerful!)
At this stage I'm just running some initial trials and was lucky to spot (the less simple variant of) this amongst a fairly large changeset.
The text was updated successfully, but these errors were encountered:
Good catch! If the instanceof checks a variable and the if statement's body contains any assignments to that variable, then the best thing would probably be to not apply the recipe to that instanceof check.
Good catch! If the instanceof checks a variable and the if statement's body contains any assignments to that variable, then the best thing would probably be to not apply the recipe to that instanceof check.
I think not quite that simple, since I spotted many valid single-assignments updating the tested variable which would be nice to still be cleaned up. To pick one example:
// Drop the optional Unary Plus tokenif (exprinstanceofPlusUnary) {
expr = ((PlusUnary) expr).single();
}
So I think the ideal rule would be to consider multiple reassignments. I guess this could get complex when using the (!(o instanceof SomeType)) { ... } form this would need to consider the flow control of everything following the if / ternary
So I think the ideal rule would be to consider multiple reassignments. I guess this could get complex when using the (!(o instanceof SomeType)) { ... } form this would need to consider the flow control of everything following the if / ternary
Uh oh!
There was an error while loading. Please reload this page.
What version of OpenRewrite are you using?
I am using
How are you running OpenRewrite?
I am running Gradle in a multi-module project:
What is the smallest, simplest way to reproduce the problem?
What did you expect to see?
Perhaps unchanged? Regardless the code should print
30
What did you see instead?
The is modified to the following, and prints
5
Are you interested in contributing a fix to OpenRewrite?
Not at this stage sorry, but perhaps in the future if I become a more regular user. (From a glance at some rule implementations, the pattern matching engine indeed looks interesting and powerful!)
At this stage I'm just running some initial trials and was lucky to spot (the less simple variant of) this amongst a fairly large changeset.
The text was updated successfully, but these errors were encountered: