1 /*xml 2 <module name="Checker"> 3 <module name="TreeWalker"> 4 <module name="RequireThis"> 5 <property name="validateOnlyOverlapping" value="false"/> 6 <property name="checkMethods" value="false"/> 7 </module> 8 </module> 9 </module> 10 */ 11 package com.puppycrawl.tools.checkstyle.checks.coding.requirethis; 12 13 // xdoc section -- start 14 class Example2 { 15 int field1,field2,field3; 16 17 Example2(int field1) { 18 this.field1 = field1; 19 field2 = 0; // violation, reference to instance variable "field2" requires "this" 20 foo(5); // OK, checkMethods is false 21 } 22 23 void method2(int i) { 24 foo(i); // OK, checkMethods is false 25 } 26 27 void foo(int field3) { 28 // violation below, reference to instance variable "field3" requires "this" 29 field3 = field3; 30 } 31 } 32 // xdoc section -- end