How to quote “*/” in JavaDocs

前端 未结 6 1790
甜味超标
甜味超标 2020-11-30 09:23

I have a need to include */ in my JavaDoc comment. The problem is that this is also the same sequence for closing a comment. What the proper way to quote/escape

6条回答
  •  青春惊慌失措
    2020-11-30 10:18

    Nobody mentioned {@literal}. This is another way to go:

    /**
     * Returns true if the specified string contains "*{@literal /}".
     */
    

    Unfortunately you cannot escape */ at a time. With some drawbacks, this also fixes:

    The only downside is that this isn't all that readable when viewing the code directly in a text editor.

提交回复
热议问题