View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="RequireThis">
5         <property name="validateOnlyOverlapping" value="false"/>
6         <property name="checkFields" 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 Example3 {
15    int field1,field2,field3;
16  
17    Example3(int field1) {
18      this.field1 = field1;
19      field2 = 0;
20      foo(5); // violation, method call "foo(5)" requires "this"
21    }
22  
23    void method2(int i) {
24      foo(i); // violation, 'Method call to 'foo' needs "this.".'
25    }
26  
27    void foo(int field3) {
28  
29      field3 = field3;
30    }
31  }
32  // xdoc section -- end