Comment style for license headers in Java

It is recommended that you add a license header at the top of each file that contains copyright and licensing information (for example, GPL3 suggests adding this ), is there a standard comment style for use in the Java license header, or can I use whatever I like?

I know that License Maven Plugin suggests using Javadoc-style comments, and this is what I am using now, but I recently discovered that some projects use simple multi-line evaluations (only one *). Will such Javadoc comments create problems when using the Javadoc tool?

+4
source share
1 answer

You should use /* */, it seems standard on most open source Java projects. Javadoc should be used to describe Java classes, interfaces, constructors, methods, and fields.

However, if you want to use Javadoc, I think you can, and it will not be in your way if you place the import statement immediately after it. According to this comment posting documentation :

A common mistake is to place an import statement between a class comment and a class declaration. Avoid this as the Javadoc tool will ignore the class comment.

/**
* This is the class comment for the class Whatever.
*/

import com.sun;   // MISTAKE - Important not to put import statement here

public class Whatever {
}
+4
source

All Articles