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