-
Notifications
You must be signed in to change notification settings - Fork 745
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
account for switch expressions in UnnecessaryParentheses check #2506
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix!
Tree parent = state.getPath().getParentPath().getLeaf(); | ||
if (parent instanceof StatementTree) { | ||
return NO_MATCH; | ||
}else if (parent instanceof SwitchExpressionTree){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to change this a bit when I merge the PR, because we want to avoid referencing SwitchExpressionTree
because that class is only available in JDK >= 12, and we want to remain compatible with JDK 8 for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds Good. As long as you don't need anything else from me I'll let you take it from here.
resolves google#1647, resolves google#2506 PiperOrigin-RevId: 400246492 (cherry picked from commit 0a87805)
Fixes #1647