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