0

I am in the process of converting my checkstyle version 4.0 configurations to version 5.0. Hence, I have added the following to replace older "PackageHtml",

<module name="JavadocPackage"> <metadata name="com.atlassw.tools.eclipse.checkstyle.lastEnabledSeverity" value="info"/> <property name="allowLegacy" value="true"/> <property name="severity" value="info"/> </module>

What happens is, I get a info message saying "Missing package-info.java" even though I have the following comments on top of my java file,

/* * File: Test.java * System: PF Tools * Module: com.research.usage * Author: jadaaih * Copyright: Jadaaih * Last modified by: jadaaih * Date: 2009-03-02 15:30:24 * Version: 1.1 * Description: * Preconditions: */

I am sorry the display is distorted, the comments have newline at the end.

Please advise on how to get rid of that checkstyle info message in Checkstyle 5.0 compliant with 4.0.

Michal Kordas
  • 10,475
  • 7
  • 58
  • 103
Abhishek
  • 6,862
  • 22
  • 62
  • 79

3 Answers3

0

In my case it was just missing the file package-info.java inside the particular package.

Since I use Eclipse, I have created it by creating a new package, ticking the box "Create package-info.java" and then moving the package-info.java into the package where I was getting the Checkstyle warning. If not using Eclipse then you can manually create a file called package-info.java.

The content of my package-info.java looks like

/**
 * 
 */
/**
 * @author Me
 *
 */

Cheers!

Puka
  • 61
  • 1
  • 1
0

The package-info.java is a separate java file that is used for package-level documentation. You can manually create one, it simply contains any information about the java files that your package is going to have. This information will be a part of the generated javadoc.

If you're using an IDE like eclipse or netbeans, you get an option while you create a new package, like this -

The package-creation wizard in eclipse, notice the "Create package-info.java" checkbox

The file looks like this-

/**
 * package description to be a part of java-doc
 */
/**
 * @author shashi
 *
 */
package com.checkstyle.test;
shashi009
  • 720
  • 6
  • 23
0

Browsing the documentation it looks to me that your metadata element is pointless. Perhaps it even provokes the checkstyle parser to ignore the JavadocPackage configuration.

Also, when the allowLegacy property is set (it's false by default), you specify that you want to use a package.html file. It is not allowed to have both a package.html and package-info.java files.

Edit:

I have just tested the above. It seems that the error is misleading. What it actually means is that a package.html file is missing :) Just add it and the warning will disappear.

driekken
  • 11,443
  • 4
  • 19
  • 10