考虑这个 Kotlin 类的类注释:
/**
* This class has two methods, one that takes one parameters ([foo]),
* and another one that takes two parameters ([foo]).
**/
class Clazz {
/* Foo with one. */
fun foo(a: Int) { }
/* Foo with two. */
fun foo(a: Int, b: Int) { }
}
Run Code Online (Sandbox Code Playgroud)
我希望第二个链接指向第二个函数(带有两个参数的函数)。
这在 Kotlin 文档语言中是可能的吗?
刚刚找到这个答案:
请注意,KDoc 没有任何语法来解析链接中的重载成员。由于 Kotlin 文档生成工具将函数所有重载的文档放在同一页面上,因此链接工作不需要识别特定的重载函数。
来自https://kotlinlang.org/docs/reference/kotlin-doc.html
……但我真的不明白其中的道理。
在文档与代码分开阅读的上下文中,这听起来很有意义,但大多数情况下,当我阅读或使用评论时,它是在 IDE UI 中。
| 归档时间: |
|
| 查看次数: |
497 次 |
| 最近记录: |