views:

867

answers:

3
/**
 * Gets the meatball icon for a nincompoop.
 * 
 * <p>
 * Example: {@code <custom:meatball color="<%= Meatball.RED %> nincompoop="${person}" />}
 * 
 * @author King Cong
 * 
 */

The "${person}" part breaks the doc comment because it uses curly braces.

Thanks in advance, LES

+7  A: 

Try using HTML escapes:

$&#123;person&#125; == ${person}
John Feminella
Sad that that is the best answer.
Kevin Peterson
It's rather annoying, isn't it? I wish there were a better way.
John Feminella
A: 

For whatever reason, this does not work for me. Within the code tag, the escape sequences are not processed, and show up as literal & # 123; & # 125;

+1  A: 

Not so much an answer as a workaround, but if you replace {@code ...} with the old version <code>...</code> it will render curly braces how you expect.

<code>{person} == ${person}</code>

Unfortunately, this breaks angle brackets, so to the original question you need to escape these:

<code>&lt;custom:meatball color="&lt;%= Meatball.RED %&gt; nincompoop="${person}" /&gt;</code>

You can even cheat here by getting Notepad++ to do that for you, with the handy TextFX -> convert -> Encode HTML (&<>").

This does at least have the benefit that everything renders nicely both in the generated Javadoc and in Eclipse in the Javadoc view, which doesn't appear to understand &#125; and friends.

Joe Kearney