mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
38 lines
1.2 KiB
HTML
38 lines
1.2 KiB
HTML
<html>
|
|
<body>
|
|
Reports fields that are not used in the <code>toString()</code> method of a class.
|
|
<p>Helps discover fields added after the <code>toString()</code> method was last updated.
|
|
The quick-fix regenerates the <code>toString()</code> method.</p>
|
|
<p>
|
|
In the <b>Generate | toString()</b> dialog, it is possible to exclude fields from this check.
|
|
This inspection will also check for problems with getter methods if the <em>Enable getters in code generation</em> option is enabled there.
|
|
<p>Example:</p>
|
|
<pre><code>
|
|
<b>public class</b> Relevant {
|
|
<b>private</b> String name; // not used in toString()
|
|
<b>private int</b> index;
|
|
<b>private int</b> length;
|
|
|
|
@Override
|
|
<b>public</b> String toString() {
|
|
<b>return</b> "Relevant{" + "index=" + index +
|
|
", length=" + length + '}';
|
|
}
|
|
}
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
<b>public class</b> Relevant {
|
|
<b>private</b> String name;
|
|
<b>private int</b> index;
|
|
<b>private int</b> length;
|
|
|
|
@Override
|
|
<b>public</b> String toString() {
|
|
<b>return</b> "Relevant{" + "name='" + name + '\'' +
|
|
", index=" + index + ", length=" + length + '}';
|
|
}
|
|
}
|
|
</code></pre>
|
|
</body>
|
|
</html> |