Added test showing incompatibility between ChangeType and RenameVariable#5540
Closed
Added test showing incompatibility between ChangeType and RenameVariable#5540
Conversation
Comment on lines
+1476
to
+1480
| public J visit(Tree tree, ExecutionContext ctx) { | ||
| J t = super.visit(tree, ctx); | ||
| Tree visited = new ChangeType("java.util.Stack", "java.util.ArrayDeque", false) | ||
| .getVisitor().visit(t, ctx, getCursor()); | ||
| return (J) visited; |
Contributor
There was a problem hiding this comment.
Since it's visit(Tree) method, this test case causes the ChangeType recipe to be called several times with various scopes, right?
Contributor
Author
There was a problem hiding this comment.
Oeps... yeah.
I've changed it to test a few specific scopes, and you clearly see the issue.
On one hand it's good to be able to rename variables in an isolated scope, but I think the rename variables recipe should broaden it's scope to make all the necessary "transitive" changes outside the provided scope.
Right now it just operates in the provided scope.
8badac9 to
d524bd6
Compare
Member
|
The underlying issue has seen been fixed in a different way, so I think we can close this effort for now |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's changed?
Added test showing incompatibility between ChangeType and RenameVariable
What's your motivation?
When using
ChangeType, change type tries to rename the variable throughRenameVariable. Normally RenameVariable renames all relevant variables, but when invoked throughChangeTypeit seems to only rename the variable where it is declared.