1 package com.google.checkstyle.test.chapter4formatting.rule4861blockcommentstyle;
2
3
4 public class InputCommentsIndentationInSwitchBlock {
5
6 private static void fooSwitch() {
7 switch ("") {
8 case "0":
9 case "1":
10
11 foo1();
12 break;
13 case "2":
14
15
16 foo1();
17
18 break;
19 case "3":
20
21
22
23 foo1();
24
25 break;
26 case "5":
27
28 foo1();
29
30 break;
31 case "6":
32 int k = 7;
33
34 case "7":
35
36 if (true) { }
37
38 break;
39 case "8":
40 break;
41 case "9":
42 foo1();
43
44 case "10": {
45 if (true) { }
46 }
47
48 case "11": {
49 }
50
51 case "28": {
52 }
53
54 case "12": {
55
56
57 int i;
58 }
59 break;
60 case "13": {
61
62 }
63 break;
64 case "14": {
65
66
67 }
68 break;
69 case "15": {
70
71 foo1();
72
73 }
74 break;
75 case "16": {
76 int a;
77 }
78
79 case "17": {
80 int a;
81 }
82
83
84 break;
85 case "18": {
86 System.lineSeparator();
87 }
88 break;
89 case "19":
90
91 case "20":
92
93 case "21":
94 default:
95
96 break;
97 }
98 }
99
100 private static void foo1() {
101 if (true) {
102 switch (1) {
103 case 0:
104
105 case 1:
106
107
108 int b = 10;
109 break;
110 default:
111
112 }
113 }
114 }
115
116
117 public void fooDotInCaseBlock() {
118 int i = 0;
119 String s = "";
120
121 switch (i) {
122 case -2:
123
124 i++;
125 break;
126 case 0:
127
128 s.indexOf("ignore");
129 break;
130 case -1:
131
132
133 s.indexOf("no way");
134
135 break;
136 case 1:
137 case 2:
138 i--;
139 break;
140 case 3: {
141 }
142
143 default:
144 }
145
146 String breaks =
147 ""
148
149
150 + "</table>"
151
152 + ""
153
154 ;
155 }
156
157
158 public void foo2() {
159 int a = 1;
160 switch (a) {
161 case 1:
162 default:
163
164 }
165
166 }
167
168
169 public void foo3() {
170 int a = 1;
171 switch (a) {
172 case 1:
173 default:
174
175
176 }
177 }
178
179
180 public void foo4() {
181 int a = 1;
182 switch (a) {
183 case 1:
184
185 int b;
186
187 break;
188 default:
189 }
190 }
191
192
193 public void foo5() {
194 int a = 1;
195 switch (a) {
196 case 1:
197 int b;
198
199 break;
200 default:
201 }
202 }
203
204
205 public void foo6() {
206 int a = 1;
207 switch (a) {
208 case 1:
209 int b;
210
211 break;
212 default:
213 }
214 }
215
216
217 public void foo7() {
218 int a = 2;
219 String s = "";
220 switch (a) {
221
222
223
224 case 1:
225 case 2:
226
227
228 foo1();
229
230 break;
231 case 3:
232
233
234
235
236 case 4:
237
238 case 5:
239
240
241
242 s.toString().toString().toString();
243
244
245
246 break;
247 default:
248 }
249 }
250
251
252 public void foo8() {
253 int a = 2;
254 String s = "";
255 switch (a) {
256
257
258
259 case 1:
260 case 2:
261
262
263 foo1();
264
265 break;
266 case 3:
267
268
269 s.toString().toString().toString();
270
271
272 break;
273 case 4:
274
275 default:
276 }
277 }
278
279
280 public void foo9() {
281 int a = 5;
282 switch (a) {
283 case 1:
284 case 2:
285
286 default:
287 }
288 }
289
290
291 public void foo10() {
292 int a = 5;
293 switch (a) {
294 case 1:
295 default:
296
297 }
298 }
299
300
301 public void foo11() {
302 int a = 5;
303 switch (a) {
304 case 1:
305 case 2:
306
307 default:
308 }
309 }
310
311
312 public void foo12() {
313 int a = 5;
314 switch (a) {
315
316 case 1:
317 default:
318 }
319 }
320 }