1
2
3
4
5
6
7
8
9
10
11
12
13 package com.puppycrawl.tools.checkstyle.checks.regexp.regexpsingleline;
14
15 import java.awt.*;
16 import java.io.ByteArrayOutputStream;
17 import java.io.File;
18
19
20
21
22
23 class InputRegexpSinglelineSemantic
24 {
25
26 static {
27 Boolean x = new Boolean(true);
28 }
29
30
31 {
32 Boolean x = new Boolean(true);
33 Boolean[] y = new Boolean[]{Boolean.TRUE, Boolean.FALSE};
34 }
35
36
37 Boolean getBoolean()
38 {
39 return new Boolean(true);
40 }
41
42 void otherInstantiations()
43 {
44
45 Object o1 = new InputBraces();
46 Object o2 = new InputModifier();
47
48 ByteArrayOutputStream s = new ByteArrayOutputStream();
49 File f = new File("/tmp");
50
51 Dimension dim = new Dimension();
52 Color col = new Color(0, 0, 0);
53 }
54
55 void exHandlerTest()
56 {
57 try {
58 ;
59 }
60 catch (IllegalStateException emptyCatchIsAlwaysAnError) {
61 }
62 catch (NullPointerException ex) {
63
64
65 }
66 catch (ArrayIndexOutOfBoundsException ex) {
67 ;
68
69
70 }
71 catch (NegativeArraySizeException ex) {
72 {
73 }
74
75 }
76 catch (UnsupportedOperationException handledException) {
77 System.out.println(handledException.getMessage());
78 }
79 catch (SecurityException ex) { }
80 catch (StringIndexOutOfBoundsException ex) {}
81 catch (IllegalArgumentException ex) { }
82
83 try {
84 }
85 finally {
86 }
87 try {
88
89 }
90 finally {
91
92 }
93 try {
94 ;
95 }
96 finally {
97 ;
98 }
99 }
100
101
102 private static final long IGNORE = 666l + 666L;
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124 public class EqualsVsHashCode1
125 {
126 public boolean equals(int a)
127 {
128 return a == 1;
129 }
130 }
131
132 public class EqualsVsHashCode2
133 {
134 public boolean equals(String a)
135 {
136 return true;
137 }
138 }
139
140 public class EqualsVsHashCode3
141 {
142 public boolean equals(Object a)
143 {
144 return true;
145 }
146
147 public int hashCode()
148 {
149 return 0;
150 }
151 }
152
153 public class EqualsVsHashCode4
154 {
155
156 ByteArrayOutputStream bos1 = new ByteArrayOutputStream()
157 {
158 public boolean equals(Object a)
159 {
160 return true;
161 }
162
163 public int hashCode()
164 {
165 return 0;
166 }
167 };
168
169 ByteArrayOutputStream bos2 = new ByteArrayOutputStream()
170 {
171 public boolean equals(Object a)
172 {
173 return true;
174 }
175 };
176 }
177
178 public void triggerEmptyBlockWithoutBlock()
179 {
180
181 if (true)
182 return;
183 }
184
185
186 {
187 }
188
189 public class EqualsVsHashCode5
190 {
191 public <A> boolean equals(int a)
192 {
193 return a == 1;
194 }
195 }
196
197 public class EqualsVsHashCode6
198 {
199 public <A> boolean equals(Comparable<A> a)
200 {
201 return true;
202 }
203 }
204
205 private class InputBraces {
206
207 }
208
209 private class InputModifier {
210
211 }
212
213 synchronized void foo() {
214 synchronized (this) {}
215 synchronized (Class.class) {
216 synchronized (new Object()) {
217
218 }
219 }
220 }
221
222
223 static {
224
225 int a = 0;}
226
227 static {
228
229 }
230 }