How do I inherit Scaladoc from Scala's standard library?

documentation, inheritance, sbt, scala

Solution

Here's what 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:

To address the issue of subclassing standard library classes while overriding methods and wanting the overridden method's documentation comment, members can be commented with the inherit documentation tag:

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

Addendum 2:

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

Problem

If I understand correctly, the Scaladoc of a method should automatically inherit the Scaladoc of the parent method it overrides. This seems to hold true for a local set of classes, but not when extending from Scala's 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 the Scaladoc? Or am I doing something wrong? Also, I'm using `sbt doc`, so not `scaladoc` directly.

Original source