1
2
3
4
5
6
7
8
9
10
11
12
13 package com.puppycrawl.tools.checkstyle.checks.coding.hiddenfield;
14
15
16
17
18
19
20
21
22
23
24 class InputHiddenField1
25 {
26 private int hidden = 0;
27
28 public InputHiddenField1()
29 {
30 int hidden = 0;
31 }
32
33 public InputHiddenField1(int hidden)
34 {
35 }
36
37 public void shadow()
38 {
39 int hidden = 0;
40 }
41
42 public void shadowFor()
43 {
44 for (int hidden = 0; hidden < 1; hidden++) {
45
46 }
47 }
48
49 public void shadowParam(int hidden)
50 {
51 }
52
53 public class Inner
54 {
55 private int innerHidden = 0;
56
57 public Inner()
58 {
59 int innerHidden = 0;
60 }
61
62 public Inner(int innerHidden)
63 {
64 }
65
66 private void innerShadow()
67 {
68 int innerHidden = 0;
69 int hidden = 0;
70 }
71
72 private void innerShadowFor()
73 {
74 for (int innerHidden = 0; innerHidden < 1; innerHidden++) {
75
76 }
77
78 for (int hidden = 0; hidden < 1; hidden++) {
79 }
80 }
81
82 private void shadowParam(
83 int innerHidden,
84 int hidden
85 )
86 {
87 }
88
89 {
90 int innerHidden = 0;
91 int hidden = 0;
92 }
93 }
94
95 {
96 int hidden = 0;
97 }
98 }
99
100 interface NothingHidden1
101 {
102 public static int notHidden = 0;
103
104
105 public void noShadow(int notHidden);
106 }
107
108
109 class PropertySetter11
110 {
111 private int prop;
112
113
114 public void setProp(int prop)
115 {
116 this.prop = prop;
117 }
118
119
120 public void setprop(int prop)
121 {
122 this.prop = prop;
123 }
124
125
126 public void setProp(int prop, int extra)
127 {
128 this.prop = prop;
129 }
130 }
131
132
133 class PropertySetter21
134 {
135 private int prop;
136
137
138 public int setProp(int prop)
139 {
140 this.prop = prop;
141 return 0;
142 }
143 }
144
145
146 class StaticFields1
147 {
148 private static int hidden;
149
150 public static void staticMethod()
151 {
152 int hidden;
153 }
154
155 public void method()
156 {
157 int hidden;
158 }
159
160 static
161 {
162 int hidden;
163 }
164
165 {
166 int hidden;
167 }
168 }
169
170
171 class StaticMethods1
172 {
173 private int notHidden;
174
175 public static void method()
176 {
177
178 int notHidden;
179 }
180
181 static
182 {
183
184 int notHidden;
185 }
186
187 private int x;
188 private static int y;
189 static class Inner {
190 void useX(int x) {
191 x++;
192 }
193 void useY(int y) {
194 y++;
195 }
196 }
197 }
198
199 enum HiddenEnum11
200 {
201 A(129),
202 B(283),
203 C(1212)
204 {
205
206
207
208
209 int hidden;
210
211 public void doSomething()
212 {
213
214 int hidden = 0;
215 }
216 };
217
218 int hidden;
219 static int hiddenStatic;
220
221
222
223
224 HiddenEnum11(int hidden)
225 {
226 }
227
228 public void doSomething()
229 {
230
231 int hidden = 0;
232 }
233
234 public static void doSomethingStatic()
235 {
236
237 int hiddenStatic = 0;
238 }
239 }
240
241
242 abstract class InputHiddenFieldBug10845121 {
243 String x;
244 public abstract void methodA(String x);
245 }
246
247 class Bug33709461 {
248 private int xAxis;
249
250 public void setxAxis(int xAxis) {
251 this.xAxis = xAxis;
252 }
253 }
254
255
256 class PropertySetter31
257 {
258 private int prop;
259
260
261
262
263
264
265
266
267 public PropertySetter31 setProp(int prop)
268 {
269 this.prop = prop;
270 return this;
271 }
272 }
273
274
275 enum PropertySetter41 {
276 INSTANCE;
277
278 private int prop;
279 private int prop2;
280
281 public void setProp(int prop) {
282 this.prop = prop;
283 }
284
285
286
287
288
289
290
291
292 public PropertySetter41 setProp2(int prop2)
293 {
294 this.prop2 = prop2;
295 return this;
296 }
297 }
298
299
300 class OneLetterField1
301 {
302 int i;
303
304 void setI(int i)
305 {
306 this.i = i;
307 }
308 enum Inner {}
309 }
310
311 class DuplicateFieldFromPreviousClass1
312 {
313 public void method() {
314 int i = 0;
315 }
316 }
317
318 class NestedEnum1 {
319 enum Test { A, B, C; int i; }
320
321 void method(int i) {}
322 }