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 acceptFoo foo
and one calls the other, that the caller passesfoo
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:
- [email protected] (Chris Povirk)
- 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 ChainingConstructorIgnoresParameter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Description
matchCompilationUnit(CompilationUnitTree tree, VisitorState state)
Description
matchMethod(MethodTree tree, VisitorState state)
Description
matchMethodInvocation(MethodInvocationTree tree, 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, 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
-
matchCompilationUnit
public Description matchCompilationUnit(CompilationUnitTree tree, VisitorState state)
- Specified by:
matchCompilationUnit
in interfaceBugChecker.CompilationUnitTreeMatcher
-
matchMethodInvocation
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state)
- Specified by:
matchMethodInvocation
in interfaceBugChecker.MethodInvocationTreeMatcher
-
matchMethod
public Description matchMethod(MethodTree tree, VisitorState state)
- Specified by:
matchMethod
in interfaceBugChecker.MethodTreeMatcher
-
-