Files
openide/java/java-impl/resources/inspectionDescriptions/FieldHidesSuperclassField.html
Leonid Shalupov 40795fe787 IJI-2422: community/java: move resources under resources root
GitOrigin-RevId: 8b2b63fc6db476ca0c2cfe5cadd84db6c4236d0f
2025-02-05 04:43:28 +00:00

35 lines
1.1 KiB
HTML

<html>
<body>
Reports fields in a derived class that are named identically a field of a superclass.
Java fields cannot be overridden in derived classes,
so the field in the derived class will hide the field from the superclass.
<p>
As a result of such naming, you may accidentally use the field of the derived class
where the identically named field of a base class is intended.
</p>
<p>A quick-fix is suggested to rename the field in the derived class.</p>
<p><b>Example:</b></p>
<pre><code>class Parent {
Parent parent;
}
class Child extends Parent {
Child parent;
}
</code></pre>
<!-- tooltip end -->
<p>
You can configure the following options for this inspection:
</p>
<ol>
<li>
<strong>Ignore non-accessible fields</strong> - indicates whether this inspection should report all name clashes,
or only clashes with fields which are visible from the subclass.
</li>
<li>
<strong>Ignore static fields hiding static fields</strong> - ignore <code>static</code> fields
which hide <code>static</code> fields in base classes.
</li>
</ol>
</body>
</html>