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