How do I inherit Scaladoc from the Scala standard library?

If I understand correctly, the Scaladoc method should automatically inherit the Scaladoc of the parent method, which it overrides. This seems to be true for a local set of classes, but not when extended from the Scala standard library (and, presumably, any external dependency?).

class LocalParent { /** * some documentation */ def foo = ??? } class DocumentedChild extends LocalParent class UndocumentedChild extends Iterator[Int] { def hasNext = ??? def next = ??? } 

Is there a way to inherit Scaladoc? Or am I doing something wrong?

In addition, I use sbt doc , not scaladoc .

+7
inheritance scala documentation sbt
source share
2 answers

Here I use (SBT 0.13):

 scalacOptions in (Compile, doc) ++= Seq("-diagrams", "-diagrams-max-classes", "20", "-external-urls:java=http://docs.oracle.com/javase/6/docs/api/," + "scala=http://www.scala-lang.org/api/current/") 

Addendum 1:

In order to solve the problem of standard classes of subclass libraries when overriding methods and wanting to comment on documentation on an overridden method, participants can comment on the inheritance documentation tag:

 /** @inheritdoc */ override def foo(bar: String): Int = bar.length 

Addendum 2:

A more modern form of this functionality is documented on this SBT 0.13 documentation page .

+6
source share

This is a lot easier these days. Just add

 autoAPIMappings := true 

to your SBT settings. ( build.sbt or project/Build.scala )

Tested with SBT version 0.13.5 and Scala 2.11.7, but it should fully return to 2.10.2, in the SBT documentation

This should work for any managed dependencies that indicate where their documentation lives. If it does not work for some dependencies, see other options .

+2
source share

All Articles