Inspectopedia Help

StringBuilder constructor call with 'char' argument

Reports calls to StringBuffer and StringBuilder constructors with char as the argument. In this case, char is silently cast to an integer and interpreted as the initial capacity of the buffer.

Example:

new StringBuilder('(').append("1").append(')');

After the quick-fix is applied:

new StringBuilder("(").append("1").append(')');

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023