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