Java

Java

Made by DeepSource

toString invoked on a string value is useless JAVA-S0064

Performance
Major

Calling String.toString is a redundant operation. Just use the string directly.

Examples

Problematic Code

String b = "abc".toString();

Recommended

String b = "abc";

Exceptions

There are some exceptions to this, such as within generated code where such statements are likely to appear. Consider adding these files to the exclude_files or exclude_patterns to reduce false positives.

References