Annotation Type BugPattern
@
SuppressWarnings, and to generate the documentation that we host on our web site.- Author:
- eaftan@google.com (Eddie Aftandilian)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic 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
Modifier and TypeRequired ElementDescriptionA short summary of the problem that this checker detects. -
Optional Element Summary
Modifier and TypeOptional ElementDescriptionString[]
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 futureThe 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.String[]
A list of Stringly-typed tags to apply to this check.
-
Element Details
-
name
String nameA 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[] altNamesAlternate identifiers for this bug, which may also be used in @SuppressWarnings.- Default:
{}
-
linkType
BugPattern.LinkType linkTypeThe type of link to generate in the compiler error message.- Default:
AUTOGENERATED
-
link
-
tags
String[] tagsA 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 summaryA 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 explanationA 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
BugPattern.SeverityLevel severity -
disableable
boolean disableableTrue if the check can be disabled using command-line flags.- Default:
true
-
suppressionAnnotations
Class<? extends Annotation>[] suppressionAnnotationsA 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 documentSuppressionGenerate 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.this is a no-op that will be removed in the future- Default:
true
-