mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
32 lines
1.0 KiB
HTML
32 lines
1.0 KiB
HTML
<html>
|
|
<body>
|
|
Reports local variables named identically to a field of a surrounding class.
|
|
As a result of such naming, you may accidentally use the variable where the identically named field is intended.
|
|
<p>A quick-fix is suggested to rename the variable.</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
public class Foo {
|
|
public Object foo;
|
|
|
|
void bar() {
|
|
Object o = new Object() {
|
|
void baz() {
|
|
Object foo; // Local variable 'foo' hides field in class 'Foo'
|
|
}
|
|
};
|
|
}
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>
|
|
You can configure the following options for this inspection:
|
|
</p>
|
|
<ol>
|
|
<li><strong>Ignore non-accessible fields</strong> - ignore local variables named identically to superclass fields
|
|
that are not visible (for example, because they are private).</li>
|
|
<li><strong>Ignore local variables in a static context hiding non-static fields</strong> -
|
|
for example when the local variable is inside a static method or inside a method which is inside a static inner class.
|
|
</li>
|
|
</ol>
|
|
</body>
|
|
</html> |