Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add package level comments in Javadoc? [duplicate]

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?

like image 663
Anil Kumar.C Avatar asked Sep 06 '10 11:09

Anil Kumar.C


People also ask

How do you write comments in Javadoc?

Writing Javadoc Comments In general, Javadoc comments are any multi-line comments (" /** ... */ ") that are placed before class, field, or method declarations. They must begin with a slash and two stars, and they can include special tags to describe characteristics like method parameters or return values.

What does @SEE mean in Javadoc?

We can use the @see and @link tag multiple times in a class, package, or method. The @see tag declares references that point to an external link, class, or method. The @link tag can also be used multiple times for declaring inline links or in contrast with other block tags.

What is the difference between Javadoc and comments?

Javadoc comments are more focused on the parameters of the methods, what your method will return depending on the parameters you give to your methods. Block comments are internal comments, comments you write for people maintaining your code.


1 Answers

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:

/**  * Provides the classes necessary to create an applet and the classes an applet uses   * to communicate with its applet context.   * <p>  * The applet framework involves two entities:   * the applet and the applet context. An applet is an embeddable window (see the   * {@link java.awt.Panel} class) with a few extra methods that the applet context   * can use to initialize, start, and stop the applet.  *  * @since 1.0  * @see java.awt  */ package java.lang.applet; 

This is documented here: Package Comment Files

like image 64
Michael Borgwardt Avatar answered Oct 10 '22 20:10

Michael Borgwardt