Skip to content

Have UAnyOf#accept invoke TreeVisitor#visitOther#64

Open
rickie wants to merge 1 commit into
masterfrom
rossendrijver/refaster_uanyof
Open

Have UAnyOf#accept invoke TreeVisitor#visitOther#64
rickie wants to merge 1 commit into
masterfrom
rossendrijver/refaster_uanyof

Conversation

@rickie

@rickie rickie commented Mar 5, 2025

Copy link
Copy Markdown
Member

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 to Refaster#anyOf. This PR proposes that TreeVisitor#visitOther is invoked instead. This allows the visitor to implement proper support for UAnyOf if 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 all UAnyOf subtrees.

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?

@rickie rickie requested a review from Stephan202 March 5, 2025 14:38

@Stephan202 Stephan202 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rephrased ticket; good to open upstream!

@Stephan202 Stephan202 changed the title Have UAnyOf#accept traverse TreeVisitor#visitOther Have UAnyOf#accept invoke TreeVisitor#visitOther Mar 12, 2025
@Stephan202 Stephan202 force-pushed the rossendrijver/refaster_uanyof branch from 8c348e6 to ed2b5c7 Compare March 12, 2025 14:54
@rickie

rickie commented Mar 12, 2025

Copy link
Copy Markdown
Member Author

Filed: google#4891.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants