It is most likely a bug, occurring only in some cases: SI-4922 Omitted default argument values . I upgraded to Scala 2.10.1. and it's working fine.
How to make scaladoc show default parameter values?
-
24-03-2022 - |
Question
I have many methods like
def foo(..., ..., runFinalizer: Boolean = true)
(implicit finalizer: Finalizer): Result = ...
But when I run scaladoc (using sbt), it doesn't document that runFinalizer
has the default value. This is quite problematic, because users will set the parameter to false
very rarely, and the generated documentation doesn't show it can be omitted.
So far, I have two solutions, neither one completely satisfactory:
- Document the fact that
runFinalizer
can be omitted inside its@param
block. It helps, but results in duplicating such a sentence in many places in the documentation, and it's possible for users to overlook it. - Create two variants of the method, one with
runFinalizers
(with no default value) and one without. But this would unnecessarily double the number of methods and clutter both code and the documentation.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow