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