I seem to have found my way to a weird error message. I'm storing a password, and I have a comment that says
/** A password hash is stored as `"algorithm$iterations$salt$hash"`
* with the number of iterations optional for some algorithms
When I tried to create a distribution jar for my project, I got this warning:
Variable iterations undefined in comment for...
I tracked the warning down to the trait package scala.tools.nsc.ast.DocComments
, where I discovered it is apparently possible to put variables of some sort in ScalaDoc. Unfortunately, Googling for "variables in Scaladoc" or "ScalaDoc dollar sign" returns nothing useful.
Does anyone know what feature I'm using incorrectly and how I can include a dollar sign in a ScalaDoc comment without getting a warning?
I'd start with "$$", as a guess. Then I'd try backslash to escape it, which is the answer.
The standard lib is replete with these macros. (For instance, in
immutable.MapLike
,for the usage
$Coll
, for inherited doc.)You'd think
StringInterpolator
would show how to include a dollar.That's from a sample sanity build for pull requests.
All those errors are from the class doc, not member doc, so maybe that is a hint; or maybe it just stops complaining at that point.
The tool emits a wonderful primer in its output, but not to your problem:
Update 1: Guess what, that guess seems to work. It no longer complains about
$ROOT
in this output:Now I'll go for
$TESTDIR
.Wow, this is really empowering. Thanks for the question!
First let me just go check if the scaladoc actually includes the
$ROOT
word in its html output.Update 2: You know what? Just never mind. This is the result, ha:
Update 3: Actually,
\$
backslash escape works fine. Actual on-screen live output: