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

前端 未结 1 1795
日久生厌
日久生厌 2021-02-11 13:50
/**
 * Gets the meatball icon for a nincompoop.
 * 
 * 

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

1条回答
  •  长发绾君心
    2021-02-11 13:56

    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)
提交回复
热议问题