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

account for switch expressions in UnnecessaryParentheses check #2506

Closed
wants to merge 1 commit into from

Conversation

codylerum
Copy link
Contributor

@codylerum codylerum commented Aug 19, 2021

Fixes #1647

@google-cla google-cla bot added the cla: yes label Aug 19, 2021
Copy link
Collaborator

@cushon cushon left a 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){
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

copybara-service bot pushed a commit that referenced this pull request Oct 1, 2021
resolves #1647, resolves #2506

PiperOrigin-RevId: 400218891
copybara-service bot pushed a commit that referenced this pull request Oct 1, 2021
resolves #1647, resolves #2506

PiperOrigin-RevId: 400218891
@copybara-service copybara-service bot closed this in 0a87805 Oct 1, 2021
Stephan202 pushed a commit to PicnicSupermarket/error-prone that referenced this pull request Nov 8, 2021
resolves google#1647, resolves google#2506

PiperOrigin-RevId: 400246492

(cherry picked from commit 0a87805)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

False positive: UnnecessaryParentheses in selector expression of switch expressions
2 participants