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 case 25:
267 i++;
268 break;
269
270 case 26:
271 switch (j) {
272 case 1:
273 continue;
274 case 2:
275 break;
276 default:
277 return;
278 }
279
280 default:
281
282 i++;
283
284 }
285 }
286 }
287
288
289 void methodFallThruCc(int i, int j, boolean cond) {
290 while (true) {
291 switch (i) {
292 case 0:
293 i++;
294
295 case 1:
296 i++;
297
298 case 2:
299 {
300 i++;
301 }
302
303 case 3:
304 i++;
305 case 4:
306 break;
307 case 5:
308 i++;
309
310 }
311 }
312 }
313
314
315 void methodFallThruC(int i, int j, boolean cond) {
316 while (true) {
317 switch (i) {
318 case 0:
319 i++;
320
321 case 1:
322 i++;
323
324 case 2:
325 i++;
326 case 3:
327 break;
328 case 4:
329 i++;
330
331 }
332 }
333 }
334
335
336 void methodFallThruC2(int i, int j, boolean cond) {
337 while (true) {
338 switch (i) {
339 case 0:
340 i++;
341
342 case 1:
343 i++;
344
345 case 2:
346 i++;
347 case 3:
348 break;
349 case 4:
350 i++;
351
352 }
353 }
354 }
355
356
357 void methodFallThruOtherWords(int i, int j, boolean cond) {
358 while (true) {
359 switch (i) {
360 case 0:
361 i++;
362
363 case 1:
364 i++;
365
366 case 2:
367 i++;
368 case 3:
369 break;
370 case 4:
371 i++;
372
373 }
374 }
375 }
376
377
378 void methodFallThruCustomWords(int i, int j, boolean cond) {
379 while (true) {
380 switch (i) {
381 case 0:
382 i++;
383
384 case 1:
385 i++;
386
387 case 2:
388 i++;
389 case 3:
390
391 break;
392 case 4:
393 i++;
394
395 }
396 }
397 }
398
399 void methodFallThruLastCaseGroup(int i, int j, boolean cond) {
400 while (true) {
401 switch (i) {
402 case 0:
403 i++;
404 }
405 switch (i) {
406 case 0:
407 i++;
408
409 }
410 switch (i) {
411 case 0:
412 i++;
413
414 }
415 }
416 }
417
418 void method1472228(int i) {
419 switch (i) {
420 case 2:
421
422 break;
423 default:
424 }
425 }
426
427
428 void methodFallThruWithDash(int i, int j, boolean cond) {
429 while (true) {
430 switch (i) {
431 case 0:
432 i++;
433 case 1:
434 i++;
435 case 2:
436 i++;
437 case 3:
438 i++;
439 case 4:
440 i++;
441 case 5:
442 i++;
443 case 6:
444 i++;
445 case 7:
446 i++;
447 case 8:
448 i++;
449 case 9:
450 i++;
451 case 10:
452 i++;
453 case 11:
454 i++;
455 case 12:
456 i++;
457 case 13:
458 i++;
459 case 14:
460 i++;
461 case 15:
462 i++;
463 case 16:
464 i++;
465 default:
466 throw new RuntimeException();
467 }
468 }
469 }
470 }