8

オーバーロードの使用時に ScalaDoc がメソッド リンクを受け入れないという問題が発生しています。

スタンドアロンの例: File project/build.properties:

sbt.version=0.13.2

ファイルbuild.sbt:

scalaVersion := "2.11.0"

ファイルsrc/main/scala/Foo.scala:

package foobar

/** @see [[Bar#foo]]
  * @see [[Bar#bar]]
  */
case class Foo()

abstract class Bar {
  def foo: Int

  def bar: Foo
  def bar(x: Option[Int]): Foo
}

を実行するsbt docと、[[Bar#foo]]リンクは問題ありませんが、[[Bar#bar]]リンクが受け入れられません。

[warn] .../src/main/scala/Foo.scala:3: The link target "Bar#bar" is ambiguous. 
       Several members fit the target:
[warn] (x: Option[Int]): foobar.Foo in class Bar [chosen]
[warn] : foobar.Foo in class Bar
[warn] 
[warn] 
[warn] Quick crash course on using Scaladoc links
[warn] ==========================================
[warn] Disambiguating terms and types: Prefix terms with '$' and types with '!' in case both names are in use:
[warn]  - [[scala.collection.immutable.List!.apply class List's apply method]] and
[warn]  - [[scala.collection.immutable.List$.apply object List's apply method]]
[warn] Disambiguating overloaded members: If a term is overloaded, you can indicate the first part of its signature followed by *:
[warn]  - [[[scala.collection.immutable.List$.fill[A](Int)(⇒A):List[A]* Fill with a single parameter]]]
[warn]  - [[[scala.collection.immutable.List$.fill[A](Int,Int)(⇒A):List[List[A]]* Fill with a two parameters]]]
[warn] Notes:
[warn]  - you can use any number of matching square brackets to avoid interference with the signature
[warn]  - you can use \\. to escape dots in prefixes (don't forget to use * at the end to match the signature!)
[warn]  - you can use \\# to escape hashes, otherwise they will be considered as delimiters, like dots.
[warn] /** @see [[Bar#foo]]
[warn] ^
[warn] one warning found

「クラッシュコース」を使用して、あらゆる種類のことを試しました。

[[Bar#bar:Foo*]]
[[Bar!.bar:Foo*]]
[[foobar.Bar!.bar:foobar.Foo*]]

これはどれも機能しません。他のオーバーロードされたバリアントを使用しない:

[[Bar#bar(Option[Int])]]
[[Bar#bar(Option[Int]):Foo]]
[[Bar!.bar(Option[Int]):Foo*]]

それで、(いつものように...) scala-doc が完全に壊れているか、何か間違ったことをしていますか?

4

2 に答える 2

1

私はそれを試しました:

package foobar

/** @see [[Bar#foo]]
  * @see [[Bar!.bar*]]
  * @see [[[Bar!.bar(x:Option[Int])*]]]
  */
case class Foo()

abstract class Bar {
  def foo: Int

  def bar: Foo
  def bar(x: Option[Int]): Foo
}

同じ警告が表示されますが、両方のバー メソッドへのリンクを含むドキュメントが生成されます。

したがって、scala-doc は完全に壊れているわけではないと思います...少し面倒です。

于 2015-01-11T02:51:55.900 に答える