Public API declaration with implicit return type
Reports public
and protected
functions and properties that have an implicit return type. For API stability reasons, it's recommended to specify such types explicitly.
Example:
fun publicFunctionWhichAbusesTypeInference() =
otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()
After the quick-fix is applied:
fun publicFunctionWhichAbusesTypeInference(): Api =
otherFunctionWithNotObviousReturnType() ?: yetAnotherFunctionWithNotObviousReturnType()
Inspection options
Option | Type | Default |
---|---|---|
Apply also to internal members | Checkbox | false |
Apply also to private members | Checkbox | false |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Kotlin, @snapshot@ |
Last modified: 13 July 2023