Class ArrayToString
java.lang.Object
com.google.errorprone.bugpatterns.BugChecker
com.google.errorprone.bugpatterns.AbstractToString
com.google.errorprone.bugpatterns.ArrayToString
- All Implemented Interfaces:
BugChecker.BinaryTreeMatcher, BugChecker.CompoundAssignmentTreeMatcher, BugChecker.MemberReferenceTreeMatcher, BugChecker.MethodInvocationTreeMatcher, Suppressible, Serializable
- Author:
- adgar@google.com (Mike Edgar), cushon@google.com (Liam Miller-Cushon)
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class BugChecker
BugChecker.AnnotatedTypeTreeMatcher, BugChecker.AnnotationTreeMatcher, BugChecker.ArrayAccessTreeMatcher, BugChecker.ArrayTypeTreeMatcher, BugChecker.AssertTreeMatcher, BugChecker.AssignmentTreeMatcher, BugChecker.BinaryTreeMatcher, BugChecker.BindingPatternTreeMatcher, BugChecker.BlockTreeMatcher, BugChecker.BreakTreeMatcher, BugChecker.CaseTreeMatcher, BugChecker.CatchTreeMatcher, BugChecker.ClassTreeMatcher, BugChecker.CompilationUnitTreeMatcher, BugChecker.CompoundAssignmentTreeMatcher, BugChecker.ConditionalExpressionTreeMatcher, BugChecker.ConstantCaseLabelTreeMatcher, BugChecker.ContinueTreeMatcher, BugChecker.DeconstructionPatternTreeMatcher, BugChecker.DefaultCaseLabelTreeMatcher, BugChecker.DoWhileLoopTreeMatcher, BugChecker.EmptyStatementTreeMatcher, BugChecker.EnhancedForLoopTreeMatcher, BugChecker.ExportsTreeMatcher, 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.ModuleTreeMatcher, BugChecker.NewArrayTreeMatcher, BugChecker.NewClassTreeMatcher, BugChecker.OpensTreeMatcher, BugChecker.PackageTreeMatcher, BugChecker.ParameterizedTypeTreeMatcher, BugChecker.ParenthesizedTreeMatcher, BugChecker.PatternCaseLabelTreeMatcher, BugChecker.PrimitiveTypeTreeMatcher, BugChecker.ProvidesTreeMatcher, BugChecker.RequiresTreeMatcher, BugChecker.ReturnTreeMatcher, BugChecker.SuppressibleTreePathScanner<R,P>, BugChecker.SwitchExpressionTreeMatcher, BugChecker.SwitchTreeMatcher, BugChecker.SynchronizedTreeMatcher, BugChecker.ThrowTreeMatcher, BugChecker.TryTreeMatcher, BugChecker.TypeCastTreeMatcher, BugChecker.TypeParameterTreeMatcher, BugChecker.UnaryTreeMatcher, BugChecker.UnionTypeTreeMatcher, BugChecker.UsesTreeMatcher, BugChecker.VariableTreeMatcher, BugChecker.WhileLoopTreeMatcher, BugChecker.WildcardTreeMatcher, BugChecker.YieldTreeMatcher -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanallowableToStringKind(com.google.errorprone.bugpatterns.AbstractToString.ToStringKind toStringKind) Whether this kind of toString call is allowable for this check.implicitToStringFix(ExpressionTree stringifiedExpr, VisitorState state) Constructs a fix for an implicit toString call, e.g. from string concatenation or from passing an argument toprintlnorStringBuilder.append.memberReferenceFix(MemberReferenceTree tree, com.sun.tools.javac.code.Type receiverType, VisitorState state) Constructs a fix for a method reference totoString(), e.g.toStringFix(Tree toStringCall, ExpressionTree stringifiedExpr, VisitorState state) Constructs a fix for an explicit toString call, e.g. fromObject.toString()orString.valueOf().protected TypePredicateThe type to match on.Methods inherited from class AbstractToString
descriptionMessageForDefaultMatch, matchBinary, matchCompoundAssignment, matchMemberReference, matchMethodInvocationMethods inherited from class BugChecker
allNames, buildDescription, buildDescription, buildDescription, buildDescription, canonicalName, customSuppressionAnnotations, defaultSeverity, describeMatch, describeMatch, describeMatch, describeMatch, describeMatch, describeMatch, describeMatch, describeMatch, disableable, equals, hashCode, isSuppressed, isSuppressed, linkUrl, message, supportsSuppressWarnings, suppressedByAnyOf, suppressedRegionsMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Suppressible
allNames, canonicalName, customSuppressionAnnotations, supportsSuppressWarnings, suppressedByAnyOf
-
Method Details
-
typePredicate
Description copied from class:AbstractToStringThe type to match on.- Specified by:
typePredicatein classAbstractToString
-
implicitToStringFix
Description copied from class:AbstractToStringConstructs a fix for an implicit toString call, e.g. from string concatenation or from passing an argument toprintlnorStringBuilder.append.- Specified by:
implicitToStringFixin classAbstractToString- Parameters:
stringifiedExpr- the tree node for the expression being converted to a String
-
allowableToStringKind
protected boolean allowableToStringKind(com.google.errorprone.bugpatterns.AbstractToString.ToStringKind toStringKind) Description copied from class:AbstractToStringWhether this kind of toString call is allowable for this check.- Overrides:
allowableToStringKindin classAbstractToString
-
toStringFix
protected Optional<Fix> toStringFix(Tree toStringCall, ExpressionTree stringifiedExpr, VisitorState state) Description copied from class:AbstractToStringConstructs a fix for an explicit toString call, e.g. fromObject.toString()orString.valueOf().- Specified by:
toStringFixin classAbstractToString- Parameters:
toStringCall- theMethodInvocationTreecorresponding to the explicit string conversion: eitherx.toString()orString.valueOf(x)stringifiedExpr- theExpressionTreethat is being converted to a string (the receiverxinx.toString(), or the argumentxinString.valueOf(x))
-
memberReferenceFix
protected Optional<Fix> memberReferenceFix(MemberReferenceTree tree, com.sun.tools.javac.code.Type receiverType, VisitorState state) Description copied from class:AbstractToStringConstructs a fix for a method reference totoString(), e.g.Object::toString.- Overrides:
memberReferenceFixin classAbstractToString- Parameters:
receiverType- the type of the objecttoString()will be called on
-