Package com.google.errorprone.matchers
A predicate DSL for matching javac AST nodes. This allows concise, readable declarative code for
describing a match, by composing generic-type-safe matchers on the inspected AST subtree.
-
Interface Summary Interface Description Matcher<T extends com.sun.source.tree.Tree> Define a predicate on aTree
, which also accesses the state of AST traversal.MultiMatcher<T extends com.sun.source.tree.Tree,N extends com.sun.source.tree.Tree> An matcher that applies a single matcher across multiple tree nodes.Suppressible -
Class Summary Class Description AbstractTypeMatcher<T extends com.sun.source.tree.Tree> Base class for type matchers.AnnotationDoesNotHaveArgument Matches an annotation that does not have a particular argument, possibly because the default value is being used.AnnotationHasArgumentWithValue AnnotationMatcher<T extends com.sun.source.tree.Tree> Matches if the given annotation matcher matches all of or any of the annotations on the tree node.AnnotationMatcherUtils Utilities for matching annotations.AnnotationType Asserts Matches assert statements which have a condition expression matched by the given matcher.ChildMultiMatcher<T extends com.sun.source.tree.Tree,N extends com.sun.source.tree.Tree> AMultiMatcher
that applies a matcher across multiple children of a single ancestor node.CompileTimeConstantExpressionMatcher A matcher for compile-time-constant expressions.CompoundAssignment Matcher for a compound-assignment operator expression.ConstructorOfClass Applies the given matcher to the constructor(s) of the given class.Contains A matcher that recursively inspects a tree, applying the given matcher to all levels of each tree and returningtrue
if any match is found.Description Simple data object containing the information captured about an AST match.Description.Builder Builder forDescription
s.Enclosing Adapt matchers to match against a parent node of a given type.Enclosing.Block<T extends com.sun.source.tree.Tree> Enclosing.BlockOrCase<T extends com.sun.source.tree.Tree> Enclosing.Class<T extends com.sun.source.tree.Tree> Enclosing.Method<T extends com.sun.source.tree.Tree> FieldMatchers Static utility methods for creatingMatcher
s for detecting references to fields.HasArguments Matches if the given matcher matches all of/any of the parameters to this method.HasIdentifier Matches if the given matcher matches all of the identifiers under this syntax tree.InjectMatchers Utility constants and matchers related to dependency injection.IsNonNullMatcher Matches expressions that can be statically determined to be non-null.IsSameType<T extends com.sun.source.tree.Tree> Matches an AST node if its erased type is the same as the given type, e.g.IsSubtypeOf<T extends com.sun.source.tree.Tree> JUnitMatchers Matchers for code patterns which appear to be JUnit-based tests.Matchers Static factory methods which make the DSL read more fluently.MethodHasParameters Matches if the given matcher matches all of/any of the parameters to this method.MethodInvocation Matches a method invocation based on a matcher for the method select (receiver + method identifier) and one for the arguments.MethodInvocationArgument Applies an Expression matcher to an argument of a MethodInvocation by position.MethodVisibility A matcher for method visibility (public, private, protected, or default).MultiMatcher.MultiMatchResult<N extends com.sun.source.tree.Tree> A result from the call ofMultiMatcher.multiMatchResult(Tree, VisitorState)
, containing information about whether it matched, and if so, what nodes matched.NullnessMatcher Matches an expression based on the result of the nullness dataflow analysis.Returns Matches areturn
statement whose returned expression is matched by the given matcher.StringLiteral TestNgMatchers Matchers for code patterns which appear to be TestNG-based tests.Throws Matches athrow
statement whose thrown expression is matched by the given matcher.UnusedReturnValueMatcher Matches expressions that invoke or reference a non-void method or constructor and which do not use their return value and are not in a context where non-use of the return value is allowed.WaitMatchers Matchers for method invocations related to Object.wait() and Condition.await(); -
Enum Summary Enum Description ChildMultiMatcher.MatchType MethodVisibility.Visibility The visibility of a member.UnusedReturnValueMatcher.AllowReason Enumeration of known reasons that an unused return value may be allowed because of the context in which the method is used.