Package com.google.errorprone.matchers
Class Description
- java.lang.Object
-
- com.google.errorprone.matchers.Description
-
public class Description extends Object
Simple data object containing the information captured about an AST match. Can be printed in a UI, or output in structured format for use by tools.- Author:
- [email protected] (Alex Eagle)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Description.Builder
Builder forDescription
s.
-
Field Summary
Fields Modifier and Type Field Description String
checkName
The name of the check that produced the match.com.google.common.collect.ImmutableList<Fix>
fixes
A list of fixes to suggest in an error message or use in automated refactoring.static Description
NO_MATCH
Describes the sentinel value of the case where the match failed.com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition
position
The position of the match.BugPattern.SeverityLevel
severity
Is this a warning, error, etc.?
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Description
applySeverityOverride(BugPattern.SeverityLevel severity)
Internal-only.static Description.Builder
builder(com.sun.source.tree.Tree node, String name, String link, BugPattern.SeverityLevel severity, String message)
Returns a new builder forDescription
s.static Description.Builder
builder(com.sun.tools.javac.tree.JCTree tree, String name, String link, BugPattern.SeverityLevel severity, String message)
Returns a new builder forDescription
s.static Description.Builder
builder(com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition position, String name, String link, BugPattern.SeverityLevel severity, String message)
Returns a new builder forDescription
s.String
getLink()
Returns a link associated with this finding or null if there is no link.String
getMessage()
Returns the message to be printed by the compiler when a match is found in interactive use.String
getMessageWithoutCheckName()
Returns the message, not including the check name but including the link.String
getRawMessage()
Returns the raw message, not including a link or check name.
-
-
-
Field Detail
-
NO_MATCH
public static final Description NO_MATCH
Describes the sentinel value of the case where the match failed.
-
position
public final com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition position
The position of the match.
-
checkName
public final String checkName
The name of the check that produced the match.
-
fixes
public final com.google.common.collect.ImmutableList<Fix> fixes
A list of fixes to suggest in an error message or use in automated refactoring. Fixes are in order of decreasing preference, from most preferred to least preferred.
-
severity
public final BugPattern.SeverityLevel severity
Is this a warning, error, etc.?
-
-
Method Detail
-
getMessage
public String getMessage()
Returns the message to be printed by the compiler when a match is found in interactive use. Includes the name of the check and a link for more information.
-
getLink
@Nullable public String getLink()
Returns a link associated with this finding or null if there is no link.
-
getRawMessage
public String getRawMessage()
Returns the raw message, not including a link or check name.
-
getMessageWithoutCheckName
public String getMessageWithoutCheckName()
Returns the message, not including the check name but including the link.
-
applySeverityOverride
@CheckReturnValue public Description applySeverityOverride(BugPattern.SeverityLevel severity)
Internal-only. Has no effect if applied to a Description within a BugChecker.
-
builder
public static Description.Builder builder(com.sun.source.tree.Tree node, String name, @Nullable String link, BugPattern.SeverityLevel severity, String message)
Returns a new builder forDescription
s.
-
builder
public static Description.Builder builder(com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition position, String name, @Nullable String link, BugPattern.SeverityLevel severity, String message)
Returns a new builder forDescription
s.
-
builder
public static Description.Builder builder(com.sun.tools.javac.tree.JCTree tree, String name, @Nullable String link, BugPattern.SeverityLevel severity, String message)
Returns a new builder forDescription
s.
-
-