1

I'm trying to document an annotated interface and include a sample of how it's used in the javadoc. e.g.

/** * Here's an example usage: * * <PRE> * @IFaceAnnotation(value="") * public interface IFace { * * @MethodAnnotation("") * public String Method(); * } * </PRE> */ 

However, Javadoc treats my annotations as javadoc instructions (like @param etc.) and as a result only prints:

Here's an example usage:

In the generated documentation. The only way i've been able to stop this is by adding an extra char before the annotation e.g.

/** * Here's an example usage: * * <PRE> * \@IFaceAnnotation(value="") * public interface IFace { * * \@MethodAnnotation("") * public String Method(); * } * </PRE> */ 

but this looks a bit messy.

Just wondered if anyone had any suggestions, Thanks.

4 Answers 4

2

You can use '&#064;' instead of the @, but thats even more ugly.

Sign up to request clarification or add additional context in comments.

Comments

2

You could also use {@literal @}. No nasty escape characters.

/** * Here's an example usage: * * <PRE> * {@literal @}IFaceAnnotation(value="") * public interface IFace { * * {@literal @}MethodAnnotation("") * public String Method(); * } * </PRE> */ 

Comments

0

Have you tried wrapping it in the {@code} notation?

1 Comment

That alone doesn't help!
0

For the record, the correct and complete answer is:

/** * Here's an example usage: * * <pre> * {@code} * &#064;IFaceAnnotation(value="") * public interface IFace { * * &#064;MethodAnnotation("") * public String Method(); * } * </pre> */ 

which results in

enter image description here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.