Annotation Type BugPattern


@Retention(RUNTIME) public @interface BugPattern
Describes a bug pattern detected by error-prone. Used to generate compiler error messages, for @SuppressWarnings, and to generate the documentation that we host on our web site.
Author:
eaftan@google.com (Eddie Aftandilian)
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    The type of link to generate in the compiler error message.
    static enum 
    The severity of the diagnostic.
    static final class 
    A collection of standardized tags that can be applied to BugPatterns.
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
     
    A short summary of the problem that this checker detects.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Alternate identifiers for this bug, which may also be used in @SuppressWarnings.
    boolean
    True if the check can be disabled using command-line flags.
    boolean
    Generate an explanation of how to suppress the check.
    A longer explanation of the problem that this checker detects.
    boolean
    Deprecated.
    this is a no-op that will be removed in the future
    The link URL to use if linkType() is LinkType.CUSTOM.
    The type of link to generate in the compiler error message.
    A unique identifier for this bug, used for @SuppressWarnings and in the compiler error message.
    Class<? extends Annotation>[]
    A set of annotation types that can be used to suppress the check.
    A list of Stringly-typed tags to apply to this check.
  • Element Details

    • name

      String name
      A unique identifier for this bug, used for @SuppressWarnings and in the compiler error message.

      If this is not specified (or specified as an empty string), the class name of the check will be used instead.

      Default:
      ""
    • altNames

      String[] altNames
      Alternate identifiers for this bug, which may also be used in @SuppressWarnings.
      Default:
      {}
    • linkType

      The type of link to generate in the compiler error message.
      Default:
      AUTOGENERATED
    • link

      String link
      The link URL to use if linkType() is LinkType.CUSTOM.
      Default:
      ""
    • tags

      String[] tags
      A list of Stringly-typed tags to apply to this check. These tags can be consumed by tools aggregating Error Prone checks (for example: a git pre-commit hook could clean up Java source by finding any checks tagged "Style", run an Error Prone compile over the code with those checks enabled, collect the fixes suggested and apply them).

      To allow for sharing of tags across systems, a number of standard tags are available as static constants in BugPattern.StandardTags. It is strongly encouraged to extract any custom tags used in annotation property to constants that are shared by your codebase.

      Default:
      {}
    • summary

      String summary
      A short summary of the problem that this checker detects. Used for the default compiler error message and for the short description in the generated docs. Should not end with a period, to match javac warning/error style.

      Markdown syntax is not allowed for this element.

    • explanation

      String explanation
      A longer explanation of the problem that this checker detects. Used as the main content in the generated documentation for this checker.

      Markdown syntax is allowed for this element.

      Default:
      ""
    • severity

    • disableable

      boolean disableable
      True if the check can be disabled using command-line flags.
      Default:
      true
    • suppressionAnnotations

      Class<? extends Annotation>[] suppressionAnnotations
      A set of annotation types that can be used to suppress the check.

      Includes only SuppressWarnings by default.

      To make a check unsuppressible, set suppressionAnnotations to empty. Note that unsuppressible checks may still be disabled using command line flags (see disableable()).

      Default:
      {java.lang.SuppressWarnings.class}
    • documentSuppression

      boolean documentSuppression
      Generate an explanation of how to suppress the check.

      This should only be disabled if the check has a non-standard suppression mechanism that requires additional explanation. For example, SuppressWarnings cannot be applied to packages, so checks that operate at the package level need special treatment.

      Default:
      true
    • generateExamplesFromTestCases

      @Deprecated boolean generateExamplesFromTestCases
      Deprecated.
      this is a no-op that will be removed in the future
      Default:
      true