Trying to escape the "@" symbol in a {@code} block within a javadoc comment with Netbeans 8.0

escaping, java, java-8, javadoc, netbeans

Solution

One way is to use:

<pre> <code>
   {@literal @}
</code> </pre>

instead of an `{@code ...}` block. See this example around line 86.

Problem

I'm trying to insert a {@code } annotation in a Javadoc comment using Netbeans 8.0 and it's not working properly. I've seen other questions on this from before (i.e., How can you escape the @ character in javadoc?) but the html escape `&#64;` and `{@literal @}` both don't seem to work. My comment looks like this (using both methods for sake of the example): ``` /** * blah blah blah * <p> * For example: * <pre> * {@code * {@literal @}begin_specification * ... * &#64;end_specification * } * </pre> */ ``` I can hit `Run -> Generate Javadoc` and everything runs fine with no errors but I see this when I look at the resulting output in a browser: ``` {@literal @}begin_specification ... &#64;end_specification ``` Which isn't the desired result... Any suggestions/ideas? I'm fairly new to Java but have used things like Doxygen in C/C++ in the past. Am I doing something wrong here? I'm using NetBeans 8.0 (Build 201403101706) with Java 1.8.0_05 x64.

Original source

Related problems