Inspectopedia Help

Redundant nullable return type

Reports functions and variables with nullable return type which never return or become null.

Example:

fun greeting(user: String): String? = "Hello, $user!"

After the quick-fix is applied:

fun greeting(user: String): String = "Hello, $user!"

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Kotlin, @snapshot@

Last modified: 13 July 2023