Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isAcceptable() call to Preconditions methods #4021

Merged
merged 3 commits into from
Feb 19, 2024

Conversation

knutwannheden
Copy link
Contributor

When constructing a precondition using Preconditions#and(), or(), or not() then the returned visitor must also call isAcceptable() on the input visitor(s) in order to avoid any ClassCastException in case the input visitor overrides visit(Tree, P) and as a result probably doesn't call isAcceptable() on itself.

When constructing a precondition using `Preconditions#and()`, `or()`, or `not()` then the returned visitor must also call `isAcceptable()` on the input visitor(s) in order to avoid any `ClassCastException` in case the input visitor overrides `visit(Tree, P)` and as a result probably doesn't call `isAcceptable()` on itself.
@timtebeek timtebeek added the bug Something isn't working label Feb 19, 2024
Copy link
Member

@jkschneider jkschneider left a comment

Choose a reason for hiding this comment

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

This should not be necessary since the resulting visitor is used in Preconditions.check

@jkschneider jkschneider merged commit fc4714a into main Feb 19, 2024
1 check passed
@jkschneider jkschneider deleted the preconditions-acceptable branch February 19, 2024 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants