I am using CheckStyle, FindBugs, and PMD to validate my Java code. I have fixed almost all the bugs caught by these tools.
I am not able to understand how to write "package comment" which is a bug caught by checkstyle. I have gone through the documentation of CheckStyle, but I don't understand it.
Could someone help me in writing a package level comment in Java?
By using a package.html file for your comments. Please see this document: How to Write Doc Comments for the Javadoc Tool.
You have to make a
package.html
page located within the package. You can read about the contents and structure of this file on the How to Write Doc Comments for the Javadoc Tool page.Package-level javadoc comments are placed in a file named
package-info.java
inside the package directory. It contains the comment and a package declaration:This is documented here: Package Comment Files
There are two ways of adding package level documentation using javadoc:
More details and examples are here. Which one to use: Javadoc: package.html or package-info.java
package-info.java
in your package to documentThe following link provides more information: http://docs.oracle.com/javase/specs/jls/se5.0/html/packages.html
Package wide annotations will also be declared at package-info.java
Greetz, GHad
Google found this as the first hit:
http://www.oracle.com/technetwork/java/javase/documentation/index-137868.html#packagecomments
You just create a file named package.html in each package.