InappropriateJavadocBlockTagsOnPackage

Since Checkstyle 14.1.0

Description

Checks that Javadoc block tags for package definitions do not contain tags that are semantically invalid for packages.

Package definitions do not have return types or throw declarations. Therefore, @return and @throws/@exception Javadoc block tags used in their Javadoc comments are considered inappropriate and should be removed or replaced with proper documentation.

Parent is com.puppycrawl.tools.checkstyle.TreeWalker

Violation Message Keys:

  • javadoc.inappropriate.tag

Properties

name description type default value since
violateExecutionOnNonTightHtml Control when to print violations if the Javadoc being examined by this check violates the tight html rules defined at Tight-HTML Rules. boolean false 14.1.0

Examples

To configure the check to report inappropriate type Javadoc block tags:


<module name="Checker">
  <module name="TreeWalker">
    <module name="InappropriateJavadocBlockTagsOnPackage"/>
  </module>
</module>

Example:


/**
 * Invalid Javadoc comment
 *
 * @param value This doesn't exist
 * @return
 */
package com.puppycrawl.tools.checkstyle.checks.javadoc.inappropriatejavadocblocktagsonpackage;
// 2 violations above:
// 'Invalid '@param' tag for 'package'.'
// 'Invalid '@return' tag for 'package'.'

To configure the check to report inappropriate type Javadoc block tags:


<module name="Checker">
  <module name="TreeWalker">
    <module name="InappropriateJavadocBlockTagsOnPackage"/>
  </module>
</module>

Example:


/**
 * Valid Javadoc comment
 *
 * @author Unknown
 * @version 1.0
 */
package com.puppycrawl.tools.checkstyle.checks.javadoc.inappropriatejavadocblocktagsonpackage;

Example of Usage

Violation Messages

All messages can be customized if the default message doesn't suit you. Please see the documentation to learn how to.

Fully Qualified Name

com.puppycrawl.tools.checkstyle.checks.javadoc.InappropriateJavadocBlockTagsOnPackageCheck

Use this fully qualified class name in configuration when an exact class reference is required.

Parent Module

TreeWalker