How to preserve binary compatibility when adding p...
# getting-started
m
How to preserve binary compatibility when adding parameters with default values to function? In this sample
Copy code
interface X {
    fun a(name: String = "Mary", newParam: Int = 100500)

    @Deprecated(message = "Only for binary compatibility", level = ERROR)
    fun a(name: String = "Mary") = a(name, 100500)
}

fun main() {
    val x: X = ...
    x.a("Jane") // error
}
compiler choses legacy-method making impossible to get rid of it in next versions. UPD. Solved by using
DeprecationLevel.HIDDEN
.