Implicit numeric conversion
Reports implicit conversion between numeric types.
Implicit numeric conversion is not a problem in itself but, if unexpected, may cause difficulties when tracing bugs.
Example:
After the quick-fix is applied:
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.
ImplicitNumericConversion- 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.
Configure the inspection:
Use the Ignore widening conversions option to ignore implicit conversion that cannot result in data loss (for example,
int->long).Use the Ignore conversions from and to 'char' option to ignore conversion from and to
char. The inspection will still report conversion from and to floating-point numbers.Use the Ignore conversion from constants and literals to make the inspection ignore conversion from literals and compile-time constants.
Inspection options
Here you can find the description of settings available for the Implicit numeric conversion inspection, and the reference of their default values.
- Ignore widening conversions
Default value:
Not selected- Ignore conversions from and to 'char'
Default value:
Not selected- Ignore conversions from constants and literals
Default value:
Not selected
Suppressing Inspection
You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:
More detailed instructions as well as other ways and options that you have can be found in the product documentation:
Inspection Details | |
|---|---|
By default bundled with: |