Class 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: (Liam Miller-Cushon)
See Also:
Serialized Form
  • Constructor Details

    • AbstractLockMethodChecker

      public AbstractLockMethodChecker()
  • Method Details

    • getLockExpressions

      protected abstract<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

      protected abstract String buildMessage​(String unhandled)
      Builds the error message, given the list of locks that were not handled.
    • matchMethod

      public Description matchMethod​(com.sun.source.tree.MethodTree tree, VisitorState state)
      Specified by:
      matchMethod in interface BugChecker.MethodTreeMatcher