How do you escape curly braces in javadoc inline tags, such as the {@code} tag

前端 未结 1 732
死守一世寂寞
死守一世寂寞 2021-02-11 13:49
/**
 * Gets the meatball icon for a nincompoop.
 * 
 * 

* Example: {@code nincompoop=\"${person}\" />}

1条回答
  •  灰色年华
    2021-02-11 14:10

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

    {person} == ${person}
    

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

    <custom:meatball color="<%= Meatball.RED %> nincompoop="${person}" />
    

    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 } and friends.

    0 讨论(0)
提交回复
热议问题