是否可以从父类型继承scaladoc并添加自定义通知?
例如:
trait Parent {
/** Add arbitrary number of key-value pairs to entity. */
def addFields(fields: (String, String)*): this.type
}
class Child extends Parent {
/**
* {@inheritdoc }
*
* @note Previously existing keys would be overwritten
*/
def addFields(fields: (String, String)*): this.type = ???
}我希望得到以下scaladoc输出:
class Child extends Parent {
/**
* Add arbitrary number of key-value pairs to entity.
*
* @note Previously existing keys would be overwritten
*/
def addFields(fields: (String, String)*): this.type = ???
}发布于 2020-11-01 19:16:54
实际上,您已经掌握了解决方案。与java不同的是,你不需要用大括号来包装@inheritdoc。因此,以下代码将创建所需的输出:
trait Parent {
/** Add arbitrary number of key-value pairs to entity. */
def addFields(fields: (String, String)*): this.type
}
class Child extends Parent {
/**
* @inheritdoc
*
* @note Previously existing keys would be overwritten
*/
override def addFields(fields: (String, String)*): this.type = ???
}I've attached a screenshot to show the final result.
更多信息可以在Generate API documentation上由sbt和SCALADOC FOR LIBRARY AUTHORS阅读。
https://stackoverflow.com/questions/64067738
复制相似问题