Scaladoc 继承通知

Scaladoc inherit with notice

是否可以从父类型继承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 = ???
}

其实你已经有了解决方案。与 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 by sbt and at SCALADOC FOR LIBRARY AUTHORS 阅读更多内容。