Class AbstractLockMethodChecker
java.lang.Object
com.google.errorprone.bugpatterns.BugChecker
com.google.errorprone.bugpatterns.threadsafety.AbstractLockMethodChecker
- All Implemented Interfaces:
BugChecker.MethodTreeMatcher
,Suppressible
,Serializable
- Direct Known Subclasses:
LockMethodChecker
,UnlockMethodChecker
public abstract class AbstractLockMethodChecker extends BugChecker implements BugChecker.MethodTreeMatcher
Abstract implementation of checkers for
@LockMethod
and@UnlockMethod
.- Author:
- cushon@google.com (Liam Miller-Cushon)
- 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,B>, 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 AbstractLockMethodChecker()
-
Method Summary
Modifier and Type Method Description protected abstract String
buildMessage(String unhandled)
Builds the error message, given the list of locks that were not handled.protected abstract Set<GuardedByExpression>
getActual(com.sun.source.tree.MethodTree tree, VisitorState state)
Searches the method body for locks that are acquired/released.protected abstract com.google.common.collect.ImmutableList<String>
getLockExpressions(com.sun.source.tree.MethodTree tree)
Returns the lock expressions in the@LockMethod
/@UnlockMethod
annotation, if any.protected abstract Set<GuardedByExpression>
getUnwanted(com.sun.source.tree.MethodTree tree, VisitorState state)
Searches the method body for the incorrect lock operation (e.g.Description
matchMethod(com.sun.source.tree.MethodTree 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, severity, supportsSuppressWarnings, suppressedByAnyOf
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
-
Constructor Details
-
AbstractLockMethodChecker
public AbstractLockMethodChecker()
-
-
Method Details
-
getLockExpressions
protected abstract com.google.common.collect.ImmutableList<String> getLockExpressions(com.sun.source.tree.MethodTree tree)Returns the lock expressions in the@LockMethod
/@UnlockMethod
annotation, if any. -
getActual
protected abstract Set<GuardedByExpression> getActual(com.sun.source.tree.MethodTree tree, VisitorState state)Searches the method body for locks that are acquired/released. -
getUnwanted
protected abstract Set<GuardedByExpression> getUnwanted(com.sun.source.tree.MethodTree tree, VisitorState state)Searches the method body for the incorrect lock operation (e.g. releasing a lock in@LockMethod
, or acquiring a lock in@UnlockMethod
). -
buildMessage
Builds the error message, given the list of locks that were not handled. -
matchMethod
- Specified by:
matchMethod
in interfaceBugChecker.MethodTreeMatcher
-