Class ChainingConstructorIgnoresParameter

java.lang.Object
com.google.errorprone.bugpatterns.BugChecker
com.google.errorprone.bugpatterns.ChainingConstructorIgnoresParameter
All Implemented Interfaces:
BugChecker.CompilationUnitTreeMatcher, BugChecker.MethodInvocationTreeMatcher, BugChecker.MethodTreeMatcher, Suppressible, Serializable

public final class ChainingConstructorIgnoresParameter extends BugChecker implements BugChecker.CompilationUnitTreeMatcher, BugChecker.MethodInvocationTreeMatcher, BugChecker.MethodTreeMatcher
Checks, if two constructors in a class both accept Foo foo and one calls the other, that the caller passes foo as a parameter. The goal is to catch copy-paste errors:
  MissileLauncher(Location target, boolean askForConfirmation) {
    ...
  }
  MissileLauncher(Location target) {
    this(target, false);
  }
  MissileLauncher(boolean askForConfirmation) {
    this(TEST_TARGET, false); // should be askForConfirmation
  }
Author:
cpovirk@google.com (Chris Povirk)
See Also: