Inspectopedia Help

Call to default 'toString()'

Reports calls to toString() that use the default implementation from java.lang.Object.

The default implementation is rarely intended but may be used by accident.

Calls to toString() on objects with java.lang.Object, interface or abstract class type are ignored by this inspection.

Example:

class Bar { void foo1(Bar bar) { String s = bar.toString(); // warning /* ... */ } void foo2(Object obj) { String s = obj.toString(); // no warning here /* ... */ } }

Inspection options

Option

Type

Default

Ignore when annotated via @NonNls

Checkbox

false

Ignore for constructor arguments of Throwable subclasses

Checkbox

false

Ignore for assert statement description arguments

Checkbox

false

Ignore inside toString() methods

Checkbox

false

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023