The methods “getFoo” and “setFoo” for propertyare generated exactly for java interop. So you write only
class Foo() {
var foo: Int = 0
}
in Kotlin and you use it as
``
from Java.
If you want your custom getters and setters (not just return value and set value) you use the following syntax:
var foo: Int = 0
get() = $foo
private set(value: Int) {
doSomethingSpecial()
$foo = value
}
There is a very old request to forbig declaring functions with the same JVM signature (KT-1).
I’ve created another one specifically for your case (KT-4287).