Reputation: 2144
How this Kotlin function should be called from Java?
fun `some random function name`(){
}
Upvotes: 2
Views: 715
Reputation: 147991
Java provides no character escaping in identifiers. You can only do that using Java reflection:
Kotlin:
class MyClass {
fun `some random function name`() { }
}
Java:
MyClass c = new MyClass();
c.getClass().getMethod("some random function name").invoke(c);
Or cache the Method
returned from the getMethod()
call. Or use method handles.
Upvotes: 6