Usually, we can write the following code in kotlin:
val hasValue : Boolean
@JvmName("hasValue") get() = true
This will generate the method hasValue()
instead of getHasValue()
for Java interop.
However, in an interface, this gives me a compile error:
val hasValue : Boolean
@JvmName("hasValue") get
The same goes for the following declaration in an abstract class:
abstract val hasValue : Boolean
@JvmName("hasValue") get
So here is my question: How can I tell the kotlin compiler to use hasValue()
instead of getHasValue()
for getters (and setters) of properties in a kotlin interfaces?