scala / bug

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

Scaladoc ApiMappings produces incorrect hyperlinks on Java enums #12807

Open mdedetrich opened 1 year ago

mdedetrich commented 1 year ago

Reproduction steps

See https://github.com/mdedetrich/scaladoc-api-mappings-java-enum-bug

Problem

If you have a project that uses apiMappings in sbt (i.e. doc / autoAPIMappings := true) and you happen to have a scaladoc that points to a Java Enum value type, i.e. the underlying behavior when writing the file. If [[java.nio.file.StandardOpenOption.SYNC]] then scaladoc will add a $ at the end of the enum type (in this example it would be StandardOpenOption$) causing a broken link.

It appears that for some reason scaladoc is incorrectly treating this as a Scala object (which have the $ identifier at the end).

Note that although the actual base URL of https://docs.oracle.com/en/java/javase/11/docs/api/java.base/ is derived from https://github.com/ThoughtWorksInc/sbt-api-mappings, this shouldn't matter since it just sets apiMappings which doesn't contain any logic, i.e. the plugin only specifics the base URL and that is it.

Scala 3 bug is here https://github.com/lampepfl/dotty/issues/17973