'@Deferred' result is unused
Reports function calls with the Deferred
result type if the return value is not used.
If the Deferred
return value is not used, the call site would not wait to complete this function.
Example:
fun calcEverythingAsync() = CompletableDeferred(42)
fun usage() {
calcEverythingAsync()
}
The quick-fix provides a variable with the Deferred
initializer:
fun calcEverythingAsync() = CompletableDeferred(42)
fun usage() {
val answer = calcEverythingAsync()
}
Inspection options
Option | Type | Default |
---|---|---|
Report only function calls from 'kotlinx.coroutines' | Checkbox | false |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Kotlin, @snapshot@ |
Last modified: 13 July 2023