methods without needing to add the noise of an extra annotation?
Rob Elliot
05/17/2021, 8:04 AM
I suppose if you were writing a mixed Java/Kotlin module you might want to call an
internal
Kotlin member from Java… though I’ve always thought that a pretty odd thing to do.
i
Ilmir Usmanov [JB]
05/17/2021, 10:06 AM
The reason is simple:
synthetic
is for synthetic declarations and some tools, most notably IntelliJ debugger usually skip them.
There is another way to hide Kotlin internal functions from Java, which does not affect tools so much -
@JvmName
with a dash in new name.
r
Rob Elliot
05/17/2021, 10:08 AM
I was really hoping to avoid extra annotations. But perhaps it’s simpler to just say that anyone calling a method with
$library
at the end of the name from Java is responsible for their own pain when I rename / delete it!