1 package com.google.checkstyle.test.chapter4formatting.rule412nonemptyblocks;
2
3 class InputFormattedRightCurlyOther {
4
5
6
7
8
9 int foo() throws InterruptedException {
10 int x = 1;
11 int a = 2;
12 while (true) {
13 try {
14 if (x > 0) {
15 break;
16 } else if (x < 0) {
17
18 ;
19 } else {
20 break;
21 }
22 switch (a) {
23 case 0:
24 break;
25 default:
26 break;
27 }
28 } catch (Exception e) {
29 break;
30 }
31 }
32
33 synchronized (this) {
34 do {
35 x = 2;
36 } while (x == 2);
37 }
38
39 this.wait(666);
40
41 for (int k = 0; k < 1; k++) {
42 String innerBlockVariable = "";
43 }
44
45 if (System.currentTimeMillis() > 1000) {
46 return 1;
47 } else {
48 return 2;
49 }
50 }
51
52 static {
53 int x = 1;
54 }
55
56 public enum GreetingsEnum {
57 HELLO,
58 GOODBYE
59 }
60
61 void method2() {
62 boolean flag = true;
63 if (flag) {
64 System.identityHashCode("heh");
65 flag = !flag;
66 }
67 System.identityHashCode("Xe-xe");
68
69 if (flag) {
70 System.identityHashCode("some foo");
71 }
72 }
73 }
74
75
76
77
78 class FooCtorAlone2 {
79
80 int test;
81
82 public FooCtorAlone2() {
83 test = 1;
84 }
85 }
86
87
88 class FooMethodAlone2 {
89
90 public void fooMethod() {
91 int i = 1;
92 }
93 }
94
95
96
97
98 class FooInnerAlone2 {
99
100 class InnerFoo {
101 public void fooInnerMethod() {}
102 }
103 }
104
105
106 class EnumContainerAlone2 {
107 private enum Suit {
108 CLUBS,
109 HEARTS,
110 SPADES,
111 DIAMONDS
112 }
113 }
114
115
116 class WithArraysAlone2 {
117 String[] ss = {""};
118 String[] empty = {};
119 String[] s1 = {
120 "foo", "foo",
121 };
122 String[] s2 = {
123 "foo", "foo",
124 };
125 String[] s3 = {
126 "foo", "foo",
127 };
128 String[] s4 = {"foo", "foo"};
129 }
130
131
132 class Interface2 {
133 public @interface TestAnnotation {}
134
135 public @interface TestAnnotation1 {
136 String someValue();
137 }
138
139 public @interface TestAnnotation2 {
140 String someValue();
141 }
142
143 public @interface TestAnnotation3 {
144 String someValue();
145 }
146
147 public @interface TestAnnotation4 {
148 String someValue();
149 }
150 }
151
152
153 enum TestEnum222 {}
154
155
156 enum TestEnum12 {
157 SOME_VALUE;
158 }
159
160
161 enum TestEnum22 {
162 SOME_VALUE;
163 }
164
165
166 enum TestEnum32 {
167 SOME_VALUE;
168 }
169
170
171 enum TestEnum42 {
172 SOME_VALUE;
173 }