Sunday October 22, 2006
Joseph D. Darcy's Sun WeblogJoseph D. Darcy's Sun Weblog Javadoc Tip: @code and @literal When writing my javadoc, I like to have keywords and class names appear as code text in the generated HTML. I also have occasion to use "<" and ">" in javadoc, either for their mathematical meaning or for writing type variables in code. In the past I've used
or
to implement the former markup and suffer through
to write "Outer<S>.Innter<T>".
Fortunately as of JDK 5, the @code and @literal javadoc tags often provide a more concise and readable way to achieve these effects.
Text inside the
and
Even for just putting text into the code font, "{@code }" takes fewer characters than "<tt></tt>", eight versus nine. Not having to escape "<" and ">" is much shorter and greatly more readable.
In new code, I almost exclusively use |
Calendar
RSS Feeds
All /Annotation Processing /General /Java /JavaOne /Numerics /OpenJDK SearchLinks
NavigationReferersToday's Page Hits: 644 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||