Inspectopedia Help

Equality check can be used instead of elvis for nullable boolean check

Reports 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() }

Inspection Details

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Kotlin, 241.16690-IJ

Last modified: 29 April 2024