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
An abstract check for resources that must be closed; used by
StreamResourceLeak
and
MustBeClosedChecker
.- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Error Prone's fix application logic doesn't like it when a fix suggests multiple identical insertions at the same position.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<R,
P>, BugChecker.SwitchTreeMatcher, BugChecker.SynchronizedTreeMatcher, BugChecker.ThrowTreeMatcher, BugChecker.TryTreeMatcher, BugChecker.TypeCastTreeMatcher, BugChecker.TypeParameterTreeMatcher, BugChecker.UnaryTreeMatcher, BugChecker.UnionTypeTreeMatcher, BugChecker.VariableTreeMatcher, BugChecker.WhileLoopTreeMatcher, BugChecker.WildcardTreeMatcher -
Field Summary
Modifier and TypeFieldDescriptionprotected static final Matcher
<com.sun.source.tree.Tree> Matches trees annotated withMustBeClosed
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
exemptChange
(com.sun.source.tree.ExpressionTree tree, VisitorState state) protected Optional
<AbstractMustBeClosedChecker.Change> fix
(com.sun.source.tree.ExpressionTree tree, VisitorState state, com.google.errorprone.bugpatterns.AbstractMustBeClosedChecker.NameSuggester suggester) 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 matchingmatcher
, emitting them as a single fix.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, isSuppressed, isSuppressed, linkUrl, message, supportsSuppressWarnings, suppressedByAnyOf, suppressedRegions
-
Field Details
-
HAS_MUST_BE_CLOSED_ANNOTATION
Matches trees annotated withMustBeClosed
.
-
-
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 matchingmatcher
, 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)
-