Class InconsistentOverloads
- java.lang.Object
-
- com.google.errorprone.bugpatterns.BugChecker
-
- com.google.errorprone.bugpatterns.overloading.InconsistentOverloads
-
- All Implemented Interfaces:
BugChecker.ClassTreeMatcher
,Suppressible
,Serializable
public final class InconsistentOverloads extends BugChecker implements BugChecker.ClassTreeMatcher
ABugChecker
that detects inconsistently overloaded methods in Java classes.The bug checker works in several stages. First, it group the class methods by name. Then each group is processed separately (and violations are reported on per-group basis).
The group is processed by building a
ParameterTrie
. This trie is an archetype built from methods of lower arity used to determine ordering of methods of higher arity. After ordering of arguments of particular method has been determined (using the archetype) it is then added to the trie and serves as basis for methods of even higher arity.If the determined ordering is different the original parameter ordering a
ParameterOrderingViolation
is reported. It is essentially a list of expected parameter and list of actual parameters then used to build aSuggestedFix
object.- Author:
- [email protected] (Ćukasz Hanuszczak)
- See Also:
- Serialized Form
-
-
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<A extends Object,B extends Object>, BugChecker.SwitchTreeMatcher, BugChecker.SynchronizedTreeMatcher, BugChecker.ThrowTreeMatcher, BugChecker.TryTreeMatcher, BugChecker.TypeCastTreeMatcher, BugChecker.TypeParameterTreeMatcher, BugChecker.UnaryTreeMatcher, BugChecker.UnionTypeTreeMatcher, BugChecker.VariableTreeMatcher, BugChecker.WhileLoopTreeMatcher, BugChecker.WildcardTreeMatcher
-
-
Constructor Summary
Constructors Constructor Description InconsistentOverloads()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Description
matchClass(com.sun.source.tree.ClassTree classTree, VisitorState state)
-
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 Detail
-
matchClass
public Description matchClass(com.sun.source.tree.ClassTree classTree, VisitorState state)
- Specified by:
matchClass
in interfaceBugChecker.ClassTreeMatcher
-
-