## com.puppycrawl.tools.checkstyle.checks.annotation
Class PackageAnnotationCheck

    java.lang.Object
      com.puppycrawl.tools.checkstyle.api.AutomaticBean
          com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
              com.puppycrawl.tools.checkstyle.api.Check
                  com.puppycrawl.tools.checkstyle.checks.annotation.PackageAnnotationCheck

All Implemented Interfaces:
  Configurable, Contextualizable

    public class PackageAnnotationCheck

extends Check

This check makes sure that all package annotations are in the package-info.java file.

According to the Java JLS 3rd ed.

The JLS does not enforce the placement of package annotations. This placement may vary based on implementation. The JLS does highly recommend that all package annotations are placed in the package-info.java file. See Java Language specification, sections 7.4.1.1.

Author:
  Travis Schneeberger

Constructor Summary
`PackageAnnotationCheck()`

Method Summary
`int[]` `getAcceptableTokens()` The configurable token set.
`int[]` `getDefaultTokens()` Returns the default token a check is interested in.
`int[]` `getRequiredTokens()` The tokens that this check must be registered for.
`void` `visitToken(DetailAST aAST)` Called to process a token.

Methods inherited from class com.puppycrawl.tools.checkstyle.api.Check
`beginTree, destroy, finishTree, getClassLoader, getFileContents, getLines, getTabWidth, getTokenNames, init, leaveToken, log, log, setClassLoader, setFileContents, setMessages, setTabWidth, setTokens`

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AbstractViolationReporter
`getCustomMessages, getId, getMessageBundle, getSeverity, getSeverityLevel, log, setId, setSeverity`

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
`configure, contextualize, finishLocalSetup, getConfiguration, setupChild`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### PackageAnnotationCheck

    public PackageAnnotationCheck()

Method Detail

### getDefaultTokens

    public int[] getDefaultTokens()

  Returns the default token a check is interested in. Only used if the configuration for a check does not define the tokens.

  Specified by:
    `getDefaultTokens` in class `Check`
  Returns:
    the default tokens
  See Also:
    `TokenTypes`

### getRequiredTokens

    public int[] getRequiredTokens()

  The tokens that this check must be registered for.

  Overrides:
    `getRequiredTokens` in class `Check`
  Returns:
    the token set this must be registered for.
  See Also:
    `TokenTypes`

### getAcceptableTokens

    public int[] getAcceptableTokens()

  The configurable token set. Used to protect Checks against malicious users who specify an unacceptable token set in the configuration file. The default implementation returns the check's default tokens.

  Overrides:
    `getAcceptableTokens` in class `Check`
  Returns:
    the token set this check is designed for.
  See Also:
    `TokenTypes`

### visitToken

    public void visitToken(DetailAST aAST)

  Called to process a token.

  Overrides:
    `visitToken` in class `Check`
  Parameters:
    `aAST` - the token to process

Copyright © 2001-2011. All Rights Reserved.