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