在Kotlin文档(KDoc)中,可以链接到特定的重载方法吗? [英] In Kotlin documentation (KDoc), is it possible to link to a specific overloaded method?
问题描述
考虑此Kotlin类的 类注释 :
Consider the class comment of this Kotlin 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) { }
}
我希望第二个链接指向第二个函数(具有两个参数的那个).
I'd like the second link to point to the 2nd function ( the one with the two parameters ).
使用Kotlin文档语言可以做到这一点吗?
Is this possible in the Kotlin documentation language?
推荐答案
刚刚找到了这个答案:
请注意,KDoc没有用于解析链接中重载成员的任何语法.由于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
...但是我不太了解原因.
... but I don't really understand the reasoning.
在文档与代码分开阅读的情况下,这样的声音是有意义的,但是大多数情况下,当我阅读或使用注释时,它们都在IDE UI中.
Sounds like this makes sense in the context where docs are read separately from code, but most of the time when I read or use comments it's in the IDE UI.
这篇关于在Kotlin文档(KDoc)中,可以链接到特定的重载方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!