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.


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

After the quick-fix is applied:

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

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Java, 241.16690

Last modified: 29 April 2024