Description
Compiler version
Scala 3.3.0
Minimized code
Reproduction is at https://github.com/mdedetrich/scaladoc-api-mappings-java-enum-bug
import java.nio.file.OpenOption
import java.nio.file.StandardOpenOption.{CREATE, TRUNCATE_EXISTING, WRITE}
class ScaladocJavaEnumBug {
/**
* the underlying behavior when writing the file. If [[java.nio.file.StandardOpenOption.SYNC]]
* @param options
*/
def myFunc(options: Set[OpenOption] = Set(WRITE, TRUNCATE_EXISTING, CREATE)): Unit = {}
}
Expectation
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 2 bug is here scala/bug#12807