File: FallThrough.md

package info (click to toggle)
error-prone-java 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 15,076 kB
  • sloc: java: 171,398; xml: 1,459; sh: 34; makefile: 7
file content (24 lines) | stat: -rw-r--r-- 657 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
The [Google Java Style Guide ยง4.8.4.2][style] requires that within a switch
block, each statement group either terminates abruptly (with a `break`,
`continue`, `return` or `throw` statement), or is marked with a comment to
indicate that execution will or might continue into the next statement group.
This special comment is not required in the last statement group of the switch
block.

Example:

```java
switch (input) {
  case 1:
  case 2:
    prepareOneOrTwo();
    // fall through
  case 3:
    handleOneTwoOrThree();
    break;
  default:
    handleLargeNumber(input);
}
```

[style]: https://google.github.io/styleguide/javaguide.html#s4.8.4-switch