Inspectopedia Help

Redundant setter parameter type

Reports explicitly specified parameter types in property setters.

Setter parameter type always matches the property type, so it's not required to be explicit. The 'Remove explicit type specification' quick-fix allows amending the code accordingly.


fun process(x: Int) {} var x: Int = 0 set(value: Int) = process(value) // <== 'Int' specification can be safely omitted

After the quick-fix is applied:

fun process(x: Int) {} var x: Int = 0 set(value) = process(value)

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Kotlin, @snapshot@

Last modified: 13 July 2023