Running an extension function in another instance

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) {

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?

Nevermind, figured it out. Had to do:

fun test(a: A) { { "yote".retrieveLength() }