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