mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
28 lines
858 B
HTML
28 lines
858 B
HTML
<html>
|
|
<body>
|
|
Reports empty string operands in string concatenations.
|
|
Concatenation with the empty string can be used to convert
|
|
non-<code>String</code> objects or primitives into <code>String</code>s,
|
|
but it can be clearer to use a <code>String.valueOf()</code> method call.
|
|
<p>
|
|
A quick-fix is suggested to simplify the concatenation.
|
|
</p>
|
|
<p><b>Example:</b></p>
|
|
<pre><code>
|
|
void foo(int x, int y) {
|
|
String s = "" + x + " ; " + y;
|
|
}
|
|
</code></pre>
|
|
<p>After the quick-fix is applied:</p>
|
|
<pre><code>
|
|
void foo(int x, int y) {
|
|
String s = x + " ; " + y;
|
|
}
|
|
</code></pre>
|
|
<!-- tooltip end -->
|
|
<p>
|
|
Use the <b>Report only where empty strings can be removed without other changes</b>
|
|
option to ignore cases cases where removing the empty string
|
|
will require adding a <code>String.valueOf()</code> conversion of another operand.
|
|
</body>
|
|
</html> |