Enum rewrite problem with ASTRewrite #3979
Open
+73
−14
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.
When an EnumConstantDeclaration is rewritten, changes made to its anonymous class body—such as renaming variables or methods—are not reflected if the enum constant itself is renamed. In such cases, the original body is retained, and modifications within it are discarded. However, if the enum constant name remains unchanged, rewrites to the body are applied as expected. This indicates a potential issue in how ASTRewrite handles concurrent updates to both the enum constant and its associated body.
Ensures that the visitor always processes the body of the anonymous class, even if the changes are only in its nested children
Fixes: #3939
What it does
How to test
Author checklist