I am involved in a project in which public API documentation is a clear deliverable. In order to ensure that the release meets this requirement, I'd like to ensure that the the release target in my Ant build file fails if documentation coverage is too low.
As a minimum, each identifier with public or protected access should have appropriate Javadoc tags and a description. For example, public methods should have a @param
tag for each parameter, a @return
tag if the return type is not void
, a @throws
tag for each exception, and a single line description.
I currently have JUnit code coverage reports and failure conditions using Cobertura, so something similar to that for documentation would be perfect. However, if the detection of a failure condition is not available, a report be a reasonable substitute.
The documentation must be in Javadoc format. No other format -- including Doxygen -- is acceptable.
Javadoc is a documentation tool which defines a standard format for such comments, and which can generate HTML files to view the documentation from a web broswer. (As an example, see Oracle's Javadoc documentation for the Java libraries at http://download.oracle.com/javase/6/docs/api/.)
Javadoc is a tool for generating API documentation in HTML format from doc comments in source code. It can be downloaded only as part of the Java 2 SDK. To see documentation generated by the Javadoc tool, go to J2SE 1.5. 0 API Documentation.
A @throws tag should be included for any checked exceptions (declared in the throws clause), as illustrated below, and also for any unchecked exceptions that the caller might reasonably want to catch, with the exception of NullPointerException . Errors should not be documented as they are unpredictable.
Step 1 − Open eclipse, select the option Project →Generate Javadoc. Step 2 − Select the javadoc.exe file from the bin folder of java installation directory, select the destination folder for the generated java doc and select Next. finish button.
Checkstyle can do that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With