Have UAnyOf#accept invoke TreeVisitor#visitOther#64
Open
rickie wants to merge 1 commit into
Open
Conversation
Stephan202
approved these changes
Mar 12, 2025
Stephan202
left a comment
Member
There was a problem hiding this comment.
Rephrased ticket; good to open upstream!
UAnyOf#accept traverse TreeVisitor#visitOtherUAnyOf#accept invoke TreeVisitor#visitOther
8c348e6 to
ed2b5c7
Compare
Member
Author
|
Filed: google#4891. |
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.
In PicnicSupermarket/error-prone-support#261 we're developing an approach to speed up Refaster. The idea is to first index all identifiers referenced by Refaster
@BeforeTemplates and then use the identifiers found in a compilation unit under consideration to select the subset of Refaster rules that have a nonzero probability of matching.While working on this, we noticed that
UAnyOf#accept(TreeVisitor, Object)descends only into the first expression passed toRefaster#anyOf. This PR proposes thatTreeVisitor#visitOtheris invoked instead. This allows the visitor to implement proper support forUAnyOfif desired. With this change, all public Error Prone unit tests still pass. We hope that this change is also compatible with Google-internal code. Naturally, we are open to alternatives that would allow visiting allUAnyOfsubtrees.In the context of this same project, we have another question regarding some non-public types and methods of the Refaster implementation. Currently, we're using reflection to access some of these. Ideally, we avoid this approach. Would you be open to increasing the visibility of certain types and methods?