Hi guys, I have a Kotlin module, packaged as a jar...
# getting-started
l
Hi guys, I have a Kotlin module, packaged as a jar, that I use from a Java project I want to have a method that is visible from my Kotlin classes but not from the java project. From what I read on the doc (https://kotlinlang.org/docs/reference/visibility-modifiers.html) I thought that
internal
would do the trick but the internal function is visible from java, as : myInternalFunc$my_module_name. What am I missing ? 🤔 Mmmm read the doc a bit more and saw that internal is mapped to public in java with some name mangling. Do you know another way to do what I want to do ?
y
there is no way to make a method invisible to the JVM but callable from Kotlin
d
Doesn't
@JvmSynthetic
accomplish this?
k
Synthetic targets become inaccessible for Java sources at compile time while still being accessible for Kotlin sources.
🤔