View Javadoc
1   /*
2   FallThrough
3   checkLastCaseGroup = true
4   reliefPattern = (default)falls?[ -]?thr(u|ough)
5   
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.coding.fallthrough;
10  
11  public class InputFallThrough7 {
12  
13          public void method4() {
14          int c;
15          switch (5) {
16              case 5:
17              case 4:
18              case 3:
19                  c = 4;
20              // fall through
21              case 2: // violation 'Fall .* from the last branch of the switch statement'
22              case 1:
23              default:
24                  c = 9;
25          }
26      }
27  
28      public void method() {
29          int c;
30          switch (5) {
31              case 5:
32              case 4:
33              case 3:
34                  c = 4;
35                  break;
36              case 2: // violation 'Fall .* from the last branch of the switch statement'
37              case 1:
38              default:
39                  c = 9;
40          }
41      }
42  
43      public void method2() {
44          int c;
45          switch (5) {
46              case 5:
47              case 4:
48              case 3:
49                  c = 4;
50              case 2: // 2 violations
51              case 1:
52              default:
53                  c = 9;
54          }
55      }
56  
57      public void method3() {
58          int c;
59          switch (5) {
60              case 5:
61              case 4:
62              case 3:
63                  c = 4;
64              case 2: // violation 'Fall\ through from previous branch of the switch statement'
65              case 1:
66              default:
67                  c = 9;
68                  break;
69          }
70      }
71  
72      public void method5() {
73          int c;
74          switch (5) {
75              case 5:
76              case 4:
77              case 3:
78                  c = 4;
79              // fall through
80              case 2:
81              case 1:
82              default:
83                  c = 9;
84                  break;
85          }
86      }
87  
88      public void method6() {
89          int c;
90          switch (5) {
91              case 5:
92              case 4:
93              case 3:
94                  c = 4;
95                  break;
96              case 2:
97              case 1:
98              default:
99                  c = 9;
100                 break;
101         }
102     }
103 
104     public void method7() {
105         int c;
106         switch (5) {
107             case 4:
108             case 3:
109                 c = 4;
110                 // // fall through - sometimes get both fields
111             case 2: // violation 'Fall .* from the last branch of the switch statement'
112             case 1:
113             default:
114                 c = 9;
115         }
116     }
117 }