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:
- [email protected] (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 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 AbstractLockMethodChecker()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods 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(MethodTree tree, VisitorState state)
Searches the method body for locks that are acquired/released.protected abstract com.google.common.collect.ImmutableList<String>
getLockExpressions(MethodTree tree)
Returns the lock expressions in the@LockMethod
/@UnlockMethod
annotation, if any.protected abstract Set<GuardedByExpression>
getUnwanted(MethodTree tree, VisitorState state)
Searches the method body for the incorrect lock operation (e.g.Description
matchMethod(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, 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
-
getLockExpressions
protected abstract com.google.common.collect.ImmutableList<String> getLockExpressions(MethodTree tree)
Returns the lock expressions in the@LockMethod
/@UnlockMethod
annotation, if any.
-
getActual
protected abstract Set<GuardedByExpression> getActual(MethodTree tree, VisitorState state)
Searches the method body for locks that are acquired/released.
-
getUnwanted
protected abstract Set<GuardedByExpression> getUnwanted(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
protected abstract String buildMessage(String unhandled)
Builds the error message, given the list of locks that were not handled.
-
matchMethod
public Description matchMethod(MethodTree tree, VisitorState state)
- Specified by:
matchMethod
in interfaceBugChecker.MethodTreeMatcher
-
-