Class SymbolToString
java.lang.Object
com.google.errorprone.bugpatterns.BugChecker
com.google.errorprone.bugpatterns.AbstractToString
com.google.errorprone.bugpatterns.SymbolToString
- All Implemented Interfaces:
BugChecker.BinaryTreeMatcher
,BugChecker.CompoundAssignmentTreeMatcher
,BugChecker.MethodInvocationTreeMatcher
,Suppressible
,Serializable
Flags
javax.lang.model.element.Element#toString
usage in BugChecker
s.- Author:
- bhagwani@google.com (Sumit Bhagwani)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.errorprone.bugpatterns.BugChecker
BugChecker.AnnotatedTypeTreeMatcher, BugChecker.AnnotationTreeMatcher, BugChecker.ArrayAccessTreeMatcher, BugChecker.ArrayTypeTreeMatcher, BugChecker.AssertTreeMatcher, BugChecker.AssignmentTreeMatcher, BugChecker.BinaryTreeMatcher, BugChecker.BlockTreeMatcher, BugChecker.BreakTreeMatcher, BugChecker.CaseTreeMatcher, BugChecker.CatchTreeMatcher, BugChecker.ClassTreeMatcher, BugChecker.CompilationUnitTreeMatcher, BugChecker.CompoundAssignmentTreeMatcher, BugChecker.ConditionalExpressionTreeMatcher, BugChecker.ContinueTreeMatcher, BugChecker.DoWhileLoopTreeMatcher, BugChecker.EmptyStatementTreeMatcher, BugChecker.EnhancedForLoopTreeMatcher, BugChecker.ExpressionStatementTreeMatcher, BugChecker.ForLoopTreeMatcher, BugChecker.IdentifierTreeMatcher, BugChecker.IfTreeMatcher, BugChecker.ImportTreeMatcher, BugChecker.InstanceOfTreeMatcher, BugChecker.IntersectionTypeTreeMatcher, BugChecker.LabeledStatementTreeMatcher, BugChecker.LambdaExpressionTreeMatcher, BugChecker.LiteralTreeMatcher, BugChecker.MemberReferenceTreeMatcher, BugChecker.MemberSelectTreeMatcher, BugChecker.MethodInvocationTreeMatcher, BugChecker.MethodTreeMatcher, BugChecker.ModifiersTreeMatcher, BugChecker.NewArrayTreeMatcher, BugChecker.NewClassTreeMatcher, BugChecker.ParameterizedTypeTreeMatcher, BugChecker.ParenthesizedTreeMatcher, BugChecker.PrimitiveTypeTreeMatcher, BugChecker.ReturnTreeMatcher, BugChecker.SuppressibleTreePathScanner<R,
P>, BugChecker.SwitchTreeMatcher, BugChecker.SynchronizedTreeMatcher, BugChecker.ThrowTreeMatcher, BugChecker.TryTreeMatcher, BugChecker.TypeCastTreeMatcher, BugChecker.TypeParameterTreeMatcher, BugChecker.UnaryTreeMatcher, BugChecker.UnionTypeTreeMatcher, BugChecker.VariableTreeMatcher, BugChecker.WhileLoopTreeMatcher, BugChecker.WildcardTreeMatcher -
Method Summary
Modifier and TypeMethodDescriptiondescriptionMessageForDefaultMatch
(com.sun.tools.javac.code.Type type, VisitorState state) Adds the description message for match on the type without fixes.implicitToStringFix
(com.sun.source.tree.ExpressionTree tree, VisitorState state) Constructs a fix for an implicit toString call, e.g.toStringFix
(com.sun.source.tree.Tree parent, com.sun.source.tree.ExpressionTree tree, VisitorState state) Constructs a fix for an explicit toString call, e.g.protected TypePredicate
The type to match on.Methods inherited from class com.google.errorprone.bugpatterns.AbstractToString
allowableToStringKind, matchBinary, matchCompoundAssignment, matchMethodInvocation
Methods inherited from class com.google.errorprone.bugpatterns.BugChecker
allNames, buildDescription, buildDescription, buildDescription, canonicalName, customSuppressionAnnotations, defaultSeverity, describeMatch, describeMatch, describeMatch, describeMatch, describeMatch, describeMatch, disableable, equals, hashCode, isSuppressed, isSuppressed, isSuppressed, isSuppressed, linkUrl, message, supportsSuppressWarnings, suppressedByAnyOf, suppressedRegions
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.google.errorprone.matchers.Suppressible
allNames, canonicalName, customSuppressionAnnotations, supportsSuppressWarnings, suppressedByAnyOf
-
Method Details
-
typePredicate
Description copied from class:AbstractToString
The type to match on.- Specified by:
typePredicate
in classAbstractToString
-
descriptionMessageForDefaultMatch
protected Optional<String> descriptionMessageForDefaultMatch(com.sun.tools.javac.code.Type type, VisitorState state) Description copied from class:AbstractToString
Adds the description message for match on the type without fixes.- Overrides:
descriptionMessageForDefaultMatch
in classAbstractToString
-
implicitToStringFix
protected Optional<Fix> implicitToStringFix(com.sun.source.tree.ExpressionTree tree, VisitorState state) Description copied from class:AbstractToString
Constructs a fix for an implicit toString call, e.g. from string concatenation or from passing an argument toprintln
orStringBuilder.append
.- Specified by:
implicitToStringFix
in classAbstractToString
- Parameters:
tree
- the tree node for the expression being converted to a String
-
toStringFix
protected Optional<Fix> toStringFix(com.sun.source.tree.Tree parent, com.sun.source.tree.ExpressionTree tree, VisitorState state) Description copied from class:AbstractToString
Constructs a fix for an explicit toString call, e.g. fromObject.toString()
orString.valueOf()
.- Specified by:
toStringFix
in classAbstractToString
- Parameters:
parent
- the expression's parent (e.g.String.valueOf(expression)
)
-