Reputation: 71
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?
Upvotes: 3
Views: 151
Reputation: 97148
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() { ... }
}
Upvotes: 4