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

Suggest avoiding default case in switch statements #481

Merged
merged 2 commits into from
Dec 4, 2018
Merged

Suggest avoiding default case in switch statements #481

merged 2 commits into from
Dec 4, 2018

Conversation

pkoenig10
Copy link
Member

@pkoenig10 pkoenig10 commented Nov 30, 2018

Fixes #480

A severity of WARNING is probably too strong for this check.

@pkoenig10 pkoenig10 requested a review from a team as a code owner November 30, 2018 22:20
@BugPattern(
name = "SwitchStatementDefaultCase",
category = Category.ONE_OFF,
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add a sentence or two to the README to flesh out the reasoning behind this a bit more (i.e. recommending to throw an unreachable exception)?

@iamdanfox
Copy link
Contributor

Thanks for implementing this @pkoenig10!

@pkoenig10
Copy link
Member Author

@iamdanfox do you have any opposition to making this a warning? If not now, maybe in the future?

@iamdanfox
Copy link
Contributor

I think it's OK to run with SUGGESTION for now because people with -Werror will pick this up straight away anyway.

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

Successfully merging this pull request may close these issues.

2 participants