View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="FallThrough"/>
5     </module>
6   </module>
7   
8   
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.coding.fallthrough;
12  
13  // xdoc section -- start
14  class Example1 {
15    public void foo() throws Exception {
16      int i = 0;
17      while (i >= 0) {
18        switch (i) {
19          case 1:
20            i++;
21            /* block */ /* fallthru */ // comment
22          case 2: // ok, ReliefPattern is present in above line.
23            i++;
24            break;
25          case 3:
26            i++;
27            return;
28          case 4:
29            i++;
30            throw new Exception();
31          case 5:
32            i++; // no break by design
33          case 6: // violation 'Fall\ through from previous branch of the switch'
34          case 7:
35            i++;
36            continue;
37          case 11:
38            i++;
39        }
40      }
41    }
42  }
43  // xdoc section -- end