-
Notifications
You must be signed in to change notification settings - Fork 746
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
MissingDefault gives false positives about default case comments in new-style switches #2709
Comments
I’m trying to fix this. |
jingjing-0919
added a commit
to jingjing-0919/error-prone
that referenced
this issue
Apr 24, 2022
Closed
copybara-service bot
pushed a commit
that referenced
this issue
Sep 15, 2023
#2709 PiperOrigin-RevId: 565736512
copybara-service bot
pushed a commit
that referenced
this issue
Sep 15, 2023
#2709 PiperOrigin-RevId: 565736512
copybara-service bot
pushed a commit
that referenced
this issue
Sep 15, 2023
#2709 PiperOrigin-RevId: 565736512
copybara-service bot
pushed a commit
that referenced
this issue
Sep 15, 2023
#2709 PiperOrigin-RevId: 565802684
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is in error-prone 2.10.0.
If I use a new-style
switch
statement with adefault
case,MissingDefault
will usually complain that the default case doesn't have a comment. I think the intended behavior is that it's only supposed to do that if the default case does nothing and exits the switch, but it's giving the warnings for switches that do have code in the default case.Even if you add a comment to the default case to try to stop the warning, it usually doesn't recognize that a comment is there unless it's in a very specific location. See examples below.
Only one of those switches makes it through cleanly; the other five get an unexpected warning:
The text was updated successfully, but these errors were encountered: