Class AbstractMustBeClosedChecker

java.lang.Object
com.google.errorprone.bugpatterns.BugChecker
com.google.errorprone.bugpatterns.AbstractMustBeClosedChecker
All Implemented Interfaces:
Suppressible, Serializable
Direct Known Subclasses:
MustBeClosedChecker, StreamResourceLeak

public abstract class AbstractMustBeClosedChecker
extends BugChecker
An abstract check for resources that must be closed; used by StreamResourceLeak and MustBeClosedChecker.
See Also:
Serialized Form
  • Field Details

    • HAS_MUST_BE_CLOSED_ANNOTATION

      protected static final Matcher<com.sun.source.tree.Tree> HAS_MUST_BE_CLOSED_ANNOTATION
      Matches trees annotated with MustBeClosed.
  • Constructor Details

    • AbstractMustBeClosedChecker

      public AbstractMustBeClosedChecker()
  • Method Details

    • scanEntireMethodFor

      protected Description scanEntireMethodFor​(Matcher<? super com.sun.source.tree.ExpressionTree> matcher, com.sun.source.tree.MethodTree tree, VisitorState state)
      Scans a method body for invocations matching matcher, emitting them as a single fix.
    • exemptChange

      @ForOverride protected boolean exemptChange​(com.sun.source.tree.ExpressionTree tree, VisitorState state)
    • fix

      protected Optional<AbstractMustBeClosedChecker.Change> fix​(com.sun.source.tree.ExpressionTree tree, VisitorState state, com.google.errorprone.bugpatterns.AbstractMustBeClosedChecker.NameSuggester suggester)