scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
230 stars 21 forks source link

Scala doc should not require FQCN for build. #12884

Closed He-Pin closed 5 months ago

He-Pin commented 9 months ago

Reproduction steps

Scala version: 2.13

refs: https://github.com/apache/incubator-pekko/issues/353 refs: https://github.com/apache/incubator-pekko/pull/682

[error] /path/actor/src/main/scala/org/apache/pekko/actor/Scheduler.scala:16:18: Unused import
[error] Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part of the message>, cat=unused-imports, site=org.apache.pekko.actor
[error] import java.lang.IllegalArgumentException
[error]                  ^
[error] one error found
[error] (actor / Compile / compileIncremental) Compilation failed

&

   * @throws IllegalArgumentException if the given delays exceed the maximum
   * @throws java.lang.IllegalArgumentException if the given delays exceed the maximum

Problem

  1. scaladoc should support FQCN be imported
  2. the unused-imports should not be needed if it's been used in scaladoc.
som-snytt commented 9 months ago

Minimally:

import java.lang.IllegalArgumentException  // makes no difference

/** This class is classy. Use it.
 */
class C {
  /** f does stuff!
   *
   *  @throws IllegalArgumentException whenever
   */
  def f() = throw new IllegalArgumentException
}

The issue is that scaladoc needs the class name to be fully qualified; adding an import does not help.

I did not try various scaladoc options. dottydoc runs quietly but also links nothing.

SethTisue commented 5 months ago

duplicate of #3695