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