If you are like me, you like using javadoc tool to generate source documentations for your Java projects. You need to choose between package.html and package-info.java both of which are not well accepted by today's Java IDE's IMO. For example, both NetBeans and Intellij IDEA treat package-info.java with a grump. But anyway, today's tip is about how to make javadoc behave when you want to document the use of your annotations.

It was a disappointment (like, D'oh, c'mon, Javadoc!) when javadoc refused to treat @Option (Option was an annotation type I was documenting) as an annotation even in a <pre> section of package.html . Instead, it kept on treating a Javadoc tag!

Finally, lightning struck and I used the HTML character entity for '@', which is ASCII 64 and hence "@". Thus, the use of annotation should be:

  & # 64 ; Option (....)  
  volatile private String x;
Of course, you should remove the spaces between '&', '#', '64' and ';' to get the '@'. It's non-intuitive, but it works! Do you have any better suggestion?
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by bloggerkedar