1
2
3
4
5
6
7
8
9
10
11 package com.puppycrawl.tools.checkstyle.checks.blocks.rightcurly;
12
13 public class InputRightCurlyTestAloneOrSingleline {
14
15 public boolean equals(Object other) { boolean flag = true; return flag; }
16
17 public int hashCode()
18 {
19 int a = 10;
20 return 1;
21 }
22
23 private void foo()
24 { int var1 = 5; var2 = 6; }
25
26 private void foo1() { return; }
27
28 private String foo2() { return toString();
29 }
30
31 private void foo3() { ; return; }
32
33 private int var1;
34 private int var2;
35 public InputRightCurlyTestAloneOrSingleline() { this.var1 = 1; }
36 public InputRightCurlyTestAloneOrSingleline(int v1, int v2) { this.var1 = v1; this.var2 = v2; }
37
38 private void foo4() { ;; }
39
40 private void foo5() { ; }
41
42 private void foo6() { }
43
44 private void foo12() {
45 try { int i = 5; int b = 10; }
46 catch (Exception e) { }
47 }
48
49 private void foo13() {
50 for (int i = 0; i < 10; i++) { int a = 5; int b = 6; }
51
52 do
53 {
54 var1 = 2;
55 }
56 while (var2 == 2);
57 }
58
59 static { int a; int b; }
60
61 { int c; int d;}
62
63 private void foo14() {
64 if (var1 > 0) {
65 return;
66 }
67 }
68
69 private void foo15() {
70 class A { int a; } var1++;
71 class B { }
72 if(true) {
73
74 }
75 else;
76 }
77
78 private void foo16() {
79 if (true) { return; } else { }
80 if (false) {
81 }
82 }
83
84 void f17() { int var1 = 5; var2 = 6; } private void f18() {int var1 = 5; var2 = 6; }
85
86 private void foo19() {int var1 = 5;
87 var2 = 6;}
88
89 private String foo20() {
90 do { var2 ++; }
91 while (var2 < 15);
92
93 while (var1 < 10) { var1++; }
94
95 do { var2++; var1++; } while (var2 < 15); return ""+0xCAFEBABE;
96 }
97
98 private void foo21() {
99 new Object() { @Override protected void finalize() { "".toString(); }};
100 }
101
102 void foo22() {
103 long startTime = System.nanoTime();
104 try {
105 int a = 5;
106 toString();
107 } catch (Exception e) {
108 throw new RuntimeException(e);
109 } finally { toString(); }
110 }
111
112 void doDoubleBraceInitialization() {
113 java.util.Map<String, String> map = new java.util.LinkedHashMap<String, String>() {{
114 put("Hello", "World");
115 put("first", "second");
116 put("polygene", "lubricants");
117 put("alpha", "betical");
118 }};
119
120 Thread t = new Thread() {@Override public void run() {super.run();}};
121
122 new Object() { @Override protected void finalize() { "".toString(); } { int a = 5; }};
123
124 new Object() { @Override protected void finalize() { "".toString(); } int b = 10; };
125
126 new Object() { protected void finalize() { hashCode(); } { int c = 5; } int d = 8; };
127
128 java.util.Map<String, String> map2 = new java.util.LinkedHashMap<String, String>() {{
129 put("Hello", "World");
130 put("first", "second");
131 put("polygene", "lubricants");
132 put("alpha", "betical");}
133 };
134
135 java.util.Map<String, String> map3 = new java.util.LinkedHashMap<String, String>() {{
136 put("Hello", "World");
137 put("first", "second");
138 put("polygene", "lubricants");
139 put("alpha", "betical");}};
140
141 java.util.Map<String, String> map4 = new java.util.LinkedHashMap<String, String>() {{
142 put("Hello", "World");
143 put("first", "second");
144 put("polygene", "lubricants");
145 put("alpha", "betical");
146 }
147 };
148
149 foo23(new java.util.HashSet<String>() {{
150 add("XZ13s");
151 add("AB21/X");
152 add("YYLEX");
153 add("AR5E");
154 }});
155
156 foo23(new java.util.HashSet<String>() {{
157 add("XZ13s");
158 add("AB21/X");
159 add("YYLEX");
160 add("AR5E");
161 }});}
162
163
164 void foo23(java.util.HashSet<String> set) {
165 }
166
167 void foo25() {
168 for (int i = 0; i < 10; i++) {
169 System.identityHashCode("Hello, world!");
170 }}
171
172 void foo26() {
173 for (int i = 0; i < 10; i++) {
174 System.identityHashCode("Hello, world!");}}
175
176 void foo27() {
177 for (int i = 0; i < 10; i++) {for (int j = 0; j < 15; j++) {int a;}}}
178
179 private java.util.ArrayList<Integer> foo28(int delta) {
180 return new java.util.ArrayList<Integer>() {
181 @Override public int size() { return Math.max(0, super.size() + 1);};
182 };
183 }
184
185 private void foo29() {
186 boolean flag = true;
187 if (flag) {
188 System.identityHashCode("heh");
189 flag = !flag; } String.
190 CASE_INSENSITIVE_ORDER.equals("Xe-xe");
191 }
192
193 void foo30() {
194 if (true) {
195 getClass();}
196
197 for (int i = 0; i == 0; i++) {
198 getClass();}
199
200 while (true) {
201 getClass();}
202 }
203
204 public void emptyBlocks() {
205 try {
206
207 } catch (RuntimeException e) {
208 new Object();
209 } catch (Exception e) {
210
211 } catch (Throwable e) {
212 } finally {
213
214 }
215
216 do {
217 } while (true);
218 }
219
220 public void codeAfterLastRightCurly() {
221 while (new Object().equals(new Object())) {
222 };
223 for (int i = 0; i < 1; i++) { };
224 }
225
226 public @interface TestAnnotation {}
227
228 public @interface TestAnnotation1{ String value(); }
229
230 public @interface TestAnnotation2 {
231 String value();}
232
233 public @interface TestAnnotation3 {
234 String value();
235 }
236
237 public @interface TestAnnottation4 { String value();
238 }
239
240 interface Interface1
241 {
242 int i = 1;
243 public void meth1(); }
244
245 interface Interface2
246 { int i = 1; public void meth1(); }
247
248 private void foo28() {
249 if (true) { return; } else { } if (false) {
250 }
251 }
252 }