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.
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description BugPattern.SeverityLevel
severity
java.lang.String
summary
A short summary of the problem that this checker detects.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description java.lang.String[]
altNames
Alternate identifiers for this bug, which may also be used in @SuppressWarnings.boolean
disableable
True if the check can be disabled using command-line flags.boolean
documentSuppression
Generate an explanation of how to suppress the check.java.lang.String
explanation
A longer explanation of the problem that this checker detects.boolean
generateExamplesFromTestCases
Deprecated.this is a no-op that will be removed in the futurejava.lang.String
link
The link URL to use if linkType() is LinkType.CUSTOM.BugPattern.LinkType
linkType
The type of link to generate in the compiler error message.java.lang.String
name
A unique identifier for this bug, used for @SuppressWarnings and in the compiler error message.java.lang.Class<? extends java.lang.annotation.Annotation>[]
suppressionAnnotations
A set of annotation types that can be used to suppress the check.java.lang.String[]
tags
A list of Stringly-typed tags to apply to this check.
-
-
-
Element Detail
-
summary
java.lang.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.
-
-
-
severity
BugPattern.SeverityLevel severity
-
-
-
linkType
BugPattern.LinkType linkType
The type of link to generate in the compiler error message.- Default:
- com.google.errorprone.BugPattern.LinkType.AUTOGENERATED
-
-
-
tags
java.lang.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:
- {}
-
-
-
suppressionAnnotations
java.lang.Class<? extends java.lang.annotation.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 (seedisableable()
).- 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
-
-