Right now, if I have the following Kotlin code:
class A {
fun String.retrieveLength = length
}
In Java I’m able to do the following:
void test(A a) {
a.retrieveLength("yote");
}
doing the same thing in Kotlin, however, yields a compile time error.
fun test(a: A) {
a.retrieveLength("yote") // error
}
I can’t find a way to reference this method in Kotlin, inside test
. Is this simply a limitation that Kotlin has, but not when interoping with Java?