| <html> |
| <body> |
| Reports field accesses of a super class where a local variable, parameter or field of the same name is available |
| in the surrounding class. In this case a cursory reader of the code may think that a variable in the surrounding class is |
| accessed, when in fact a field from the super class is accessed. To make the intent of the code more clear it is recommended to add a |
| <b>this</b> qualifier to the field access call. |
| <p>Example: |
| <pre><code> |
| <b>class</b> X { |
| <b>protected</b> String s; |
| } |
| <b>class</b> Y { |
| <b>void</b> foo(String s) { |
| <b>new</b> X() {{ |
| System.out.println(s); // here the field is accessed not the parameter |
| }}; |
| } |
| } |
| </code></pre> |
| <!-- tooltip end --> |
| <p> |
| </body> |
| </html> |