1 package com.google.checkstyle.test.chapter4formatting.rule4842fallthrough;
2
3
4 public class InputFallThrough {
5 void method(int i, int j, boolean cond) {
6 while (true) {
7 switch (i) {
8 case 0:
9 case 1:
10 i++;
11 break;
12 case 2:
13 i++;
14 case 3:
15 i++;
16 break;
17 case 4:
18 return;
19 case 5:
20 throw new RuntimeException("");
21 case 6:
22 continue;
23 case 7:
24 {
25 break;
26 }
27 case 8:
28 {
29 return;
30 }
31 case 9:
32 {
33 throw new RuntimeException("");
34 }
35 case 10:
36 {
37 continue;
38 }
39 case 11:
40 {
41 i++;
42 }
43 case 12:
44 if (false) {
45 break;
46 } else {
47 break;
48 }
49 case 13:
50 if (true) {
51 return;
52 }
53 case 14:
54 if (true) {
55 return;
56 } else {
57
58 }
59 case 15:
60 do {
61 System.identityHashCode("something");
62 return;
63 } while (true);
64 case 16:
65 for (int j1 = 0; j1 < 10; j1++) {
66 System.identityHashCode("something");
67 return;
68 }
69 case 17:
70 while (true) {
71 throw new RuntimeException("");
72 }
73 case 18:
74 while (cond) {
75 break;
76 }
77 case 19:
78 try {
79 i++;
80 break;
81 } catch (RuntimeException e) {
82 break;
83 } catch (Error e) {
84 return;
85 }
86 case 20:
87 try {
88 i++;
89 break;
90 } catch (RuntimeException e) {
91
92 } catch (Error e) {
93 return;
94 }
95 case 21:
96 try {
97 i++;
98 } catch (RuntimeException e) {
99 i--;
100 } finally {
101 break;
102 }
103 case 22:
104 try {
105 i++;
106 break;
107 } catch (RuntimeException e) {
108 i--;
109 break;
110 } finally {
111 i++;
112 }
113 case 23:
114 switch (j) {
115 case 1:
116 continue;
117 case 2:
118 return;
119 default:
120 return;
121 }
122 case 24:
123 switch (j) {
124 case 1:
125 continue;
126 case 2:
127 break;
128 default:
129 return;
130 }
131 default:
132
133 i++;
134 }
135 }
136 }
137
138
139 void methodFallThru(int i, int j, boolean cond) {
140 while (true) {
141 switch (i) {
142 case -1:
143
144 case 0:
145 case 1:
146 i++;
147 break;
148 case 2:
149 i++;
150
151 case 3:
152 i++;
153 break;
154 case 4:
155 return;
156 case 5:
157 throw new RuntimeException("");
158 case 6:
159 continue;
160 case 7:
161 {
162 break;
163 }
164 case 8:
165 {
166 return;
167 }
168 case 9:
169 {
170 throw new RuntimeException("");
171 }
172 case 10:
173 {
174 continue;
175 }
176 case 11:
177 {
178 i++;
179 }
180
181 case 12:
182 if (false) {
183 break;
184 } else {
185 break;
186 }
187 case 13:
188 if (true) {
189 return;
190 }
191 case 14:
192 if (true) {
193 return;
194 } else {
195
196 }
197
198 case 15:
199 do {
200 System.identityHashCode("something");
201 return;
202 } while (true);
203 case 16:
204 for (int j1 = 0; j1 < 10; j1++) {
205 System.identityHashCode("something");
206 return;
207 }
208 case 17:
209 while (cond) {
210 throw new RuntimeException("");
211 }
212 case 18:
213 while (cond) {
214 break;
215 }
216
217 case 19:
218 try {
219 i++;
220 break;
221 } catch (RuntimeException e) {
222 break;
223 } catch (Error e) {
224 return;
225 }
226 case 20:
227 try {
228 i++;
229 break;
230 } catch (RuntimeException e) {
231 return;
232 } catch (Error e) {
233 return;
234 }
235
236 case 21:
237 try {
238 i++;
239 } catch (RuntimeException e) {
240 i--;
241 } finally {
242 break;
243 }
244 case 22:
245 try {
246 i++;
247 break;
248 } catch (RuntimeException e) {
249 i--;
250 break;
251 } finally {
252 i++;
253 }
254
255 case 23:
256 switch (j) {
257 case 1:
258 continue;
259 case 2:
260 return;
261 default:
262 return;
263 }
264 case 24:
265 i++;
266
267 case 25:
268 i++;
269 break;
270
271 case 26:
272 switch (j) {
273 case 1:
274 continue;
275 case 2:
276 break;
277 default:
278 return;
279 }
280
281 default:
282
283 i++;
284
285 }
286 }
287 }
288
289
290 void methodFallThruCc(int i, int j, boolean cond) {
291 while (true) {
292 switch (i) {
293 case 0:
294 i++;
295
296 case 1:
297 i++;
298
299 case 2:
300 {
301 i++;
302 }
303
304 case 3:
305 i++;
306
307 case 4:
308 break;
309 case 5:
310 i++;
311
312 }
313 }
314 }
315
316
317 void methodFallThruC(int i, int j, boolean cond) {
318 while (true) {
319 switch (i) {
320 case 0:
321 i++;
322
323 case 1:
324 i++;
325
326 case 2:
327 i++;
328
329 case 3:
330 break;
331 case 4:
332 i++;
333
334 }
335 }
336 }
337
338
339 void methodFallThruC2(int i, int j, boolean cond) {
340 while (true) {
341 switch (i) {
342 case 0:
343 i++;
344
345 case 1:
346 i++;
347
348 case 2:
349 i++;
350
351 case 3:
352 break;
353 case 4:
354 i++;
355
356 }
357 }
358 }
359
360
361 void methodFallThruOtherWords(int i, int j, boolean cond) {
362 while (true) {
363 switch (i) {
364 case 0:
365 i++;
366
367 case 1:
368 i++;
369
370 case 2:
371 i++;
372
373 case 3:
374 break;
375 case 4:
376 i++;
377
378 }
379 }
380 }
381
382
383 void methodFallThruCustomWords(int i, int j, boolean cond) {
384 while (true) {
385 switch (i) {
386 case 0:
387 i++;
388
389 case 1:
390 i++;
391
392 case 2:
393 i++;
394 case 3:
395
396
397
398 break;
399 case 4:
400 i++;
401
402 }
403 }
404 }
405
406 void methodFallThruLastCaseGroup(int i, int j, boolean cond) {
407 while (true) {
408 switch (i) {
409 case 0:
410 i++;
411 }
412 switch (i) {
413 case 0:
414 i++;
415
416 }
417 switch (i) {
418 case 0:
419 i++;
420
421 }
422 }
423 }
424
425 void method1472228(int i) {
426 switch (i) {
427 case 2:
428
429 break;
430 default:
431 }
432 }
433
434
435 void methodFallThruWithDash(int i, int j, boolean cond) {
436 while (true) {
437 switch (i) {
438 case 0:
439 i++;
440 case 1:
441 i++;
442 case 2:
443 i++;
444 case 3:
445 i++;
446 case 4:
447 i++;
448 case 5:
449 i++;
450 case 6:
451 i++;
452 case 7:
453 i++;
454 case 8:
455 i++;
456 case 9:
457 i++;
458 case 10:
459 i++;
460 case 11:
461 i++;
462 case 12:
463 i++;
464 case 13:
465 i++;
466 case 14:
467 i++;
468 case 15:
469 i++;
470 case 16:
471 i++;
472 default:
473 throw new RuntimeException();
474 }
475 }
476 }
477 }