Constant conditions
Reports non-trivial conditions and values that are statically known to be always true, false, null or zero. While sometimes intended, often this is a sign of logical error in the program. Additionally, reports never reachable when
branches and some expressions that are statically known to fail always.
Examples:
Uncheck the "Warn when constant is stored in variable" option to avoid reporting of variables having constant values not in conditions.
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.
KotlinConstantConditions- 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.
New in 2021.3
Inspection options
Here you can find the description of settings available for the Constant conditions inspection, and the reference of their default values.
- Warn when constant is stored in variable
Default: Selected
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Kotlin, 243.23126-IJ |