lightbend / genjavadoc

A compiler plugin for generating doc’able Java source from Scala source
Other
58 stars 32 forks source link

Problem handling a nested type with the same name as its enclosing type #225

Open rdesgroppes opened 4 years ago

rdesgroppes commented 4 years ago

I have an object definition MyName who has a nested object definition also named MyName. This seems to terminate the javadoc generation abruptly (javadoc exited with exit code 1).

Here's MyName.scala:

package my.namespace

/** Something about MyName.
  */
sealed trait MyName extends Product with Serializable {
  val value: Int
}

object MyName {
  def apply(value: Int): MyName = value match {
    case 1 => MyName
    case 2 => KnownName
    case _ => throw new IllegalArgumentException(s"$value is not a valid MyName")
  }

  def unapply(arg: MyName): Option[Int] = Some(arg.value)

  /** Something about MyName.MyName.
    */
  case object MyName extends MyName {
    override val value = 1
  }

  /** Something about MyName.KnownName.
    */
  case object KnownName extends MyName {
    override val value = 2
  }
}

sbt output:

[error] /unrelated/File.java:42:1:  error: cannot find symbol
[error]   /** unrelated comment. */
[error]                                                   ^  symbol:   variable MyName$
[error]   location: interface MyName
...
[info] 1 error
...
[warn] javadoc exited with exit code 1
raboof commented 4 years ago

does --ignore-source-errors (https://github.com/lightbend/genjavadoc/pull/216/files#diff-04c6e90faac2675aa89e2176d2eec7d8R170) help?

rdesgroppes commented 4 years ago

@raboof alas not available in java 8

baol commented 4 years ago

Even ignoring errors, the generated doc may not be correct.