Tuesday, May 05, 2009

Javadoc tool with @exclude tag

The standard javadoc utility shipped with JDK doesn't provide an option to exclude some public methods from public API documentation. Currently we can filter only at file level (either all methods from all classes in the file or none).
Javadoc specification proposes a new tag called '@exclude' for this purpose - any method which @exclude tag shall be excluded from javadoc documentation. However this has not been implemented yet.
Here is a modified javadoc utility which can implements @exclude tag - any method with @exclude tag will be excluded from javadoc.
Usage:
1) download the javadoc.jar
2) create a file with list of source files which contain the methods to be documented
eg: inputs.txt
---------------------------------------------
c:\src\com\abc\spi\Abc.java
c:\src\com\abc\util\Xyz.java
----------------------------------------------
3) invoke javadoc as follows
javadoc -docletpath -d -doclet com.sun.tools.doclets.standard.Standard1 @
Please note that name of the file has been renamed to Standard1.

3 comments:

Mani said...

This came in handy for something quick that I had to do. If you can post your source to your blog or the javadoc website (where they list all the thirdparty customizations) it'll be useful to more people.

Mani said...

THANK YOU!!!

Unknown said...

Hi
I know I am a bit late, but a noted a particular behavior on using the jar.

For methods which return something like List<>, [List of String, for example]
without the doclet the output for return type is displayed as List<> [String]

But on using the doclet, output is displayed as simply
List [without any information on what type of List it returns]

Can u please give a hint on how to solve this or provide a workaround??

Thanks
Astha