mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
22 lines
793 B
HTML
22 lines
793 B
HTML
<html>
|
|
<body>
|
|
Reports <code>getClass()</code> methods that are called on a <code>java.lang.Class</code> instance.
|
|
<p>This is usually a mistake as the result is always equivalent to <code>Class.class</code>.
|
|
If it's a mistake, then it's better to remove the <code>getClass()</code> call and use the qualifier directly.
|
|
If the behavior is intended, then it's better to write <code>Class.class</code> explicitly to avoid confusion.</p>
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
void test(Class<?> clazz) {
|
|
String name = clazz.getClass().getName();
|
|
}
|
|
</code></pre>
|
|
<p>After one of the possible quick-fixes is applied:</p>
|
|
<pre><code>
|
|
void test(Class<?> clazz) {
|
|
String name = clazz.getName();
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p><small>New in 2018.2</small></p>
|
|
</body>
|
|
</html> |