在 Kotlin 文档 (KDoc) 中,是否可以 link 到特定的重载方法?
In Kotlin documentation (KDoc), is it possible to link to a specific overloaded method?
考虑此 Kotlin class:
的 class 评论
/**
* 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) { }
}
我希望第二个 link 指向第二个函数(具有两个参数的函数)。
这在 Kotlin 文档语言中可行吗?
刚刚找到这个答案:
Note that KDoc does not have any syntax for resolving overloaded members in links. Since the Kotlin documentation generation tool puts the documentation for all overloads of a function on the same page, identifying a specific overloaded function is not required for the link to work.
来自https://kotlinlang.org/docs/reference/kotlin-doc.html
...但是我不太明白其中的道理
在文档与代码分开阅读的上下文中,这听起来很有意义,但大多数时候当我阅读或使用注释时,它在 IDE UI.
考虑此 Kotlin class:
的 class 评论/**
* 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) { }
}
我希望第二个 link 指向第二个函数(具有两个参数的函数)。
这在 Kotlin 文档语言中可行吗?
刚刚找到这个答案:
Note that KDoc does not have any syntax for resolving overloaded members in links. Since the Kotlin documentation generation tool puts the documentation for all overloads of a function on the same page, identifying a specific overloaded function is not required for the link to work.
来自https://kotlinlang.org/docs/reference/kotlin-doc.html
...但是我不太明白其中的道理
在文档与代码分开阅读的上下文中,这听起来很有意义,但大多数时候当我阅读或使用注释时,它在 IDE UI.