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
A BugChecker 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 a SuggestedFix object.

Author:
hanuszczak@google.com (Ɓukasz Hanuszczak)
See Also: