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