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

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>