1 package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks;
2
3 class InputLeftCurlyBraces
4 {
5
6 boolean condition()
7 {
8 return false;
9 }
10
11
12 void testDoWhile()
13 {
14
15 do {
16 testDoWhile();
17 }
18 while (condition());
19
20
21 do testDoWhile(); while (condition());
22 }
23
24
25 void testWhile()
26 {
27
28 while (condition()) {
29 testWhile();
30 }
31
32
33 while(condition());
34 while (condition())
35 testWhile();
36 while (condition())
37 if (condition())
38 testWhile();
39 }
40
41
42 void testFor()
43 {
44
45 for (int i = 1; i < 5; i++) {
46 testFor();
47 }
48
49
50 for(int i = 1;i < 5;i++);
51 for (int i = 1; i < 5; i++)
52 testFor();
53 for (int i = 1; i < 5;
54 i++)
55 if (i > 2)
56 testFor();
57 }
58
59
60 public void testIf()
61 {
62
63 if (condition()) {
64 testIf();
65 }
66 else if (condition()) {
67 testIf();
68 }
69 else {
70 testIf();
71 }
72
73
74 if (condition());
75 if (condition())
76 testIf();
77 if (condition())
78 testIf();
79 else
80 testIf();
81 if (condition())
82 testIf();
83 else {
84 testIf();
85 }
86 if (condition()) {
87 testIf();
88 }
89 else
90 testIf();
91 if (condition())
92 if (condition())
93 testIf();
94 }
95
96 void whitespaceAfterSemi()
97 {
98
99 int i = 1;int j = 2;
100
101
102 for (;;) {
103 }
104 }
105
106
107 public InputLeftCurlyBraces() {}
108
109
110 public void emptyImplementation() {}
111 }
112
113 class EnumContainerLeft {
114 private enum Suit { CLUBS, HEARTS, SPADES, DIAMONDS }
115 }
116
117 class WithArraysLeft {
118 String[] s = {""};
119 String[] empty = {};
120 String[] s1 = {
121 "foo", "foo",
122 };
123 String[] s2 =
124 {
125 "foo", "foo",
126 };
127 String[] s3 =
128 {
129 "foo",
130 "foo",
131 };
132 String[] s4 =
133 {"foo", "foo"};
134 }