Kotlin extension functions are compiled for JVM methods that take the receiver as the first parameter. If your extension function is declared at the top level, for example, in a file called file.kt :
package foo fun String.getSomething(): String { return "something" }
Then in Java you can call the static method from the corresponding class:
import foo.FileKt; ... String someString = "blabla"; FileKt.getSomething(someString);
source share