View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="HiddenField">
5         <property name="ignoreAbstractMethods" value="true"/>
6       </module>
7     </module>
8   </module>
9   */
10  package com.puppycrawl.tools.checkstyle.checks.coding.hiddenfield;
11  
12  // xdoc section -- start
13  class Example7 {
14  
15    private String field;
16    private String testField;
17  
18    Example7(int field) { // violation, ''field' hides a field'
19      this.field = Integer.toString(field);
20    }
21    void method(String param) {
22      String field = param; // violation, ''field' hides a field'
23    }
24    void setTestField(String testField) { // violation, 'testField' hides a field'
25      this.field = field;
26    }
27    Example7 setField(String field) { // violation, ''field' hides a field'
28      this.field = field;
29      return null;
30    }
31    abstract class Inner {
32      abstract int method(String field); // OK, because ignoreAbstractMethods is true
33    }
34  }
35  // xdoc section -- end