public abstract class BugChecker extends Object implements Suppressible, Serializable
BugChecker
supplies a Scanner
implementation for this checker, making it easy to use a single checker. Subclasses should also
implement one or more of the *Matcher
interfaces in this class to declare which tree node
types to match against.Constructor and Description |
---|
BugChecker() |
Modifier and Type | Method and Description |
---|---|
Set<String> |
allNames()
Returns all of the name strings that this checker should respect as part of a
@SuppressWarnings annotation. |
Description.Builder |
buildDescription(com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition position)
Returns a Description builder, which allows you to customize the diagnostic with a custom
message or multiple fixes.
|
Description.Builder |
buildDescription(com.sun.tools.javac.tree.JCTree tree)
Returns a Description builder, which allows you to customize the diagnostic with a custom
message or multiple fixes.
|
Description.Builder |
buildDescription(com.sun.source.tree.Tree node)
Returns a Description builder, which allows you to customize the diagnostic with a custom
message or multiple fixes.
|
String |
canonicalName()
The canonical name of the check.
|
Set<Class<? extends Annotation>> |
customSuppressionAnnotations()
Returns the custom suppression annotations for this checker, if custom suppression is used.
|
BugPattern.SeverityLevel |
defaultSeverity() |
protected Description |
describeMatch(com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition position,
Fix fix)
Helper to create a Description for the common case where there is a fix.
|
protected Description |
describeMatch(com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition position,
Optional<? extends Fix> fix)
Deprecated.
prefer referring to empty fixes using
SuggestedFix.emptyFix() . |
protected Description |
describeMatch(com.sun.tools.javac.tree.JCTree node,
Fix fix)
Helper to create a Description for the common case where there is a fix.
|
protected Description |
describeMatch(com.sun.source.tree.Tree node)
Helper to create a Description for the common case where there is no fix.
|
protected Description |
describeMatch(com.sun.source.tree.Tree node,
Fix fix)
Helper to create a Description for the common case where there is a fix.
|
protected Description |
describeMatch(com.sun.source.tree.Tree node,
Optional<? extends Fix> fix)
Deprecated.
prefer referring to empty fixes using
SuggestedFix.emptyFix() . |
boolean |
disableable() |
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
isSuppressed(com.sun.tools.javac.code.Symbol symbol)
Returns true if the given symbol is annotated with a
@SuppressWarnings that disables
this bug checker. |
boolean |
isSuppressed(com.sun.source.tree.Tree tree)
Returns true if the given tree is annotated with a
@SuppressWarnings that disables this
bug checker. |
String |
linkUrl() |
String |
message() |
BugPattern.SeverityLevel |
severity(Map<String,BugPattern.SeverityLevel> severities) |
boolean |
supportsSuppressWarnings()
Returns true if this checker can be suppressed using
@SuppressWarnings . |
boolean |
suppressedByAnyOf(Set<com.sun.tools.javac.util.Name> annotations,
VisitorState s) |
@CheckReturnValue protected Description describeMatch(com.sun.source.tree.Tree node, Fix fix)
@CheckReturnValue protected Description describeMatch(com.sun.tools.javac.tree.JCTree node, Fix fix)
@CheckReturnValue protected Description describeMatch(com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition position, Fix fix)
@CheckReturnValue protected Description describeMatch(com.sun.source.tree.Tree node)
@CheckReturnValue @Deprecated protected Description describeMatch(com.sun.source.tree.Tree node, Optional<? extends Fix> fix)
SuggestedFix.emptyFix()
.Optional
fix.@CheckReturnValue @Deprecated protected Description describeMatch(com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition position, Optional<? extends Fix> fix)
SuggestedFix.emptyFix()
.Optional
fix.@CheckReturnValue public Description.Builder buildDescription(com.sun.source.tree.Tree node)
@CheckReturnValue public Description.Builder buildDescription(com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition position)
@CheckReturnValue public Description.Builder buildDescription(com.sun.tools.javac.tree.JCTree tree)
public String canonicalName()
Suppressible
canonicalName
in interface Suppressible
public Set<String> allNames()
Suppressible
@SuppressWarnings
annotation.allNames
in interface Suppressible
public String message()
public BugPattern.SeverityLevel defaultSeverity()
public BugPattern.SeverityLevel severity(Map<String,BugPattern.SeverityLevel> severities)
public String linkUrl()
public boolean supportsSuppressWarnings()
Suppressible
@SuppressWarnings
.supportsSuppressWarnings
in interface Suppressible
public boolean disableable()
public Set<Class<? extends Annotation>> customSuppressionAnnotations()
Suppressible
customSuppressionAnnotations
in interface Suppressible
public boolean suppressedByAnyOf(Set<com.sun.tools.javac.util.Name> annotations, VisitorState s)
suppressedByAnyOf
in interface Suppressible
public boolean isSuppressed(com.sun.source.tree.Tree tree)
@SuppressWarnings
that disables this
bug checker.public boolean isSuppressed(com.sun.tools.javac.code.Symbol symbol)
@SuppressWarnings
that disables
this bug checker.Copyright © 2021 Google LLC. All rights reserved.