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