mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
40 lines
930 B
HTML
40 lines
930 B
HTML
<html>
|
|
<body>
|
|
Reports method calls whose target is another method call.
|
|
The quick-fix suggests to introduce a local variable.
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
class X {
|
|
int foo(File f) {
|
|
return f.getName().length();
|
|
}
|
|
}
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
class X {
|
|
int foo(File f) {
|
|
final String name = f.getName();
|
|
return name.length();
|
|
}
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>Use the inspection options to toggle warnings for the following cases:</p>
|
|
<ul>
|
|
<li>
|
|
<p>
|
|
chained method calls in field initializers,
|
|
for instance, <code>private final int i = new Random().nextInt();</code>
|
|
</p>
|
|
</li>
|
|
<li>
|
|
<p>
|
|
chained method calls operating on the same type,
|
|
for instance, <code>new StringBuilder().append("x: ").append(new X()).append("y: ").append(new Y()).toString();</code>.
|
|
</p>
|
|
</li>
|
|
</ul>
|
|
|
|
</body>
|
|
</html> |