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

24 lines
681 B
HTML

<html>
<body>
Reports pattern variables named identically to a field of a surrounding class.
As a result of such naming, you may accidentally use the pattern variable when using the identically named field is intended.
<p>
A quick-fix is suggested to rename the variable.
<p><b>Example:</b></p>
<pre><code>
class Pointless {
Point p = new Point();
public void test(Object a) {
if (a instanceof Point p) {
System.out.print("a is a point (" + p.x + ", " + p.y + ')');
} else {
System.out.print("p is a point (" + p.x + ", " + p.y + ')');
}
}
}
</code></pre>
<!-- tooltip end -->
<p><small>New in 2022.2</small></p>
</body>
</html>