In kotlin xxx.kt:
@file:JvmName("Utils")
fun staticFunc()
In java xxx.java:
Utils.staticFunc()
But in java we can't see comment of class Utils because class Utils is not exist(actually it is xxx.kt), How to comment xxx.kt let java user can see comment of class Utils?
This is not supported. The Utils class does not exist from the Kotlin point of view, it's only produced for JVM interop, so there is no way to provide documentation for it.
If you need to provide documentation to Java callers, use an object instead:
/**
* My utility functions.
*/
object Utils {
fun staticFunc() { ... }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With