Kotlin
Equality check can be used instead of elvis for nullable boolean check
Info
New
Last modified: 03 December 2024Reports cases when an equality check should be used instead of the elvis operator.
Example:
fun check(a: Boolean? == null) {
if (a ?: false) throw IllegalStateException()
}
After the quick-fix is applied:
fun check(a: Boolean? == null) {
if (a == true) throw IllegalStateException()
}
- 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.
NullableBooleanElvis
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Kotlin, 243.23126-IJ |
Thanks for your feedback!
Was this page helpful?