Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 @ 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.

like image 788
TxAG98 Avatar asked May 22 '14 16:05

TxAG98


2 Answers

One way is to use:

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

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

like image 163
assylias Avatar answered Oct 22 '22 06:10

assylias


This is a known bug. The link to the corresponding bug is:

https://bugs.openjdk.java.net/browse/JDK-8130754

As of 2016-10-07 there is no scheduled version for a fix.

like image 36
Ingo Kegel Avatar answered Oct 22 '22 05:10

Ingo Kegel