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