Skip to content

Commit

Permalink
Latest docs on successful build 6426 auto-pushed to gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
copybara-service[bot] committed Jul 19, 2024
1 parent e2a862d commit e8de612
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bugpattern/TraditionalSwitchExpression.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ To make changes, edit the @BugPattern annotation or the explanation in docs/bugp
-->


## The problem
The newer arrow (`->`) syntax for switches is preferred to the older colon (`:`)
syntax. The main reason for continuing to use the colon syntax in switch
*statements* is that it allows fall-through from one statement group to the
next. But in a switch *expression*, fall-through would only be useful if the
code that falls through has side effects. Burying side effects inside a switch
expression makes code hard to understand.

## Suppression
Suppress false positives by adding the suppression annotation `@SuppressWarnings("TraditionalSwitchExpression")` to the enclosing element.

0 comments on commit e8de612

Please sign in to comment.