1
2
3
4
5
6
7
8
9
10 package com.puppycrawl.tools.checkstyle.checks.blocks.needbraces;
11
12 class InputNeedBracesTestIt
13 {
14
15 boolean condition()
16 {
17 return false;
18 }
19
20
21 void testDoWhile()
22 {
23
24 do {
25 testDoWhile();
26 }
27 while (condition());
28
29
30 do testDoWhile(); while (condition());
31 }
32
33
34 void testWhile()
35 {
36
37 while (condition()) {
38 testWhile();
39 }
40
41
42 while(condition());
43 while (condition())
44 testWhile();
45 while (condition())
46 if (condition())
47 testWhile();
48 }
49
50
51 void testFor()
52 {
53
54 for (int i = 1; i < 5; i++) {
55 testFor();
56 }
57
58
59 for(int i = 1;i < 5;i++);
60 for (int i = 1; i < 5; i++)
61 testFor();
62 for (int i = 1; i < 5;
63 i++)
64 if (i > 2)
65 testFor();
66 }
67
68
69 public void testIf()
70 {
71
72 if (condition()) {
73 testIf();
74 }
75 else if (condition()) {
76 testIf();
77 }
78 else {
79 testIf();
80 }
81
82
83 if (condition());
84 if (condition())
85 testIf();
86 if (condition())
87 testIf();
88 else
89 testIf();
90 if (condition())
91 testIf();
92 else {
93 testIf();
94 }
95 if (condition()) {
96 testIf();
97 }
98 else
99 testIf();
100 if (condition())
101 if (condition())
102 testIf();
103
104 if (condition())
105 while (condition()) testWhile();
106 if (condition())
107 do testDoWhile(); while (condition());
108 if (condition())
109 for (int i = 0; i < 1; i++) testFor();
110 int a = 0;
111 switch (a) {default: {}}
112 }
113
114 void whitespaceAfterSemi()
115 {
116
117 int i = 1;int j = 2;
118
119
120 for (;;) {
121 }
122 }
123
124
125 public InputNeedBracesTestIt() {}
126
127
128 public void emptyImplementation() {}
129 }