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

59 lines
1.2 KiB
HTML

<html>
<body>
Reports usage of static members that is not qualified
with the class name.
<p>
This is legal if the static member is in
the same class, but may be confusing.
</p>
<p><b>Example:</b></p>
<pre><code>
class Foo {
static void foo() {}
static int x;
void bar() {
foo();
System.out.println(x);
}
static void baz() { foo(); }
}
</code></pre>
<p>After the quick-fix is applied:</p>
<pre><code>
class Foo {
static void foo() {}
static int x;
void bar() {
Foo.foo();
System.out.println(Foo.x);
}
static void baz() { Foo.foo(); }
}
</code></pre>
<!-- tooltip end -->
<p>Use the inspection settings to toggle the reporting for the following items:</p>
<ul>
<li>
<p>
static fields access<br>
<code>void bar() { System.out.println(x); }</code>
</p>
</li>
<li>
<p>
calls to static methods<br>
<code>void bar() { foo(); }</code><br>
<code>static void baz() { foo(); }</code>
</p>
</li>
</ul>
<p>
You can also configure the inspection to only report static member usage from a non-static context.
In the above example, <code>static void baz() { foo(); }</code> will not be reported.
</p>
</body>
</html>