Scala构造函数InheritDoc的继承?

时间:2016-08-09 02:06:59

标签: scala inheritance scaladoc

我正在为我的异常类编写一些文档,并且从scaladoc发出以下警告:

  

BarException类的注释包含@inheritdoc,但没有父注释可用于继承。

阅读this Java question之后,我必须想象这是因为我想继承构造函数方法的文档,而不仅仅是一个普通的方法:

/** Base Exception
 *
 *  @param msg A message describing this exception
 *  @param cause The exception which is the underlying cause to this FooException, null if this is the underlying cause
 */
abstract class FooException(val msg: String, val cause: Throwable) extends RuntimeException(msg, cause)

/** The bar exception specific docs, expect msg & cause to be given same docs as FooException
 *  @inheritdoc
 */
case class BarException(override val msg: String, override val cause: Throwable) extends FooException(msg, cause)

Parent Documentation Screenshot Child Documentation Screenshot

我知道没有覆盖构造函数,因此没有任何东西可以继承。但是,那就是说,如果我查看父FooException生成的文档,我看到构造函数不仅按预期记录了参数,还记录了msg和{{1}的字段也记录在案。这似乎意味着scaladoc采用了cause并将其应用于@param的字段,并将其用作方法参数文档

由于我必须在FooException的case类构造函数中override,我希望scaladoc能够理解有些内容被覆盖,因此需要继承文档,但这不是&n在这种情况下。我已查看了scala tags wiki,但未发现有关此行为的任何信息或如何使文档从父类中的属性继承到子项。

如果我将类更改为使用BarException,那么我可以将文档继承到子项的字段,但我必须重复自己:

def

有没有在抽象类中不使用/** Base Exception * * @param msg A message describing this exception * @param cause The exception which is the underlying cause to this FooException, null if this is the underlying cause */ abstract class FooException(msg: String, cause: Throwable) extends RuntimeException(msg, cause) { /** A message describing this exceptionxx */ def msg: String /** The exception which is the underlying cause to this FooException, null if this is the underlying cause */ def cause: Throwable } 格式,只是将文档继承给scaladoc已经为父类的生成属性生成的子文件?

0 个答案:

没有答案