Inspectopedia Help

Call to 'Number.toString()'

Reports toString() calls on objects of a class extending Number. Such calls are usually incorrect in an internationalized environment and some locale specific formatting should be used instead.

Example:

void print(Double d) { System.out.println(d.toString()); }

A possible way to fix this problem could be:

void print(Double d) { System.out.printf("%f%n", d); }

This formats the number using the default locale which is set during the startup of the JVM and is based on the host environment.

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

NumericToString
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Java | Internationalization

Availability

By default bundled with

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin

Java, 241.18072

Last modified: 18 June 2024