Uses of Interface
com.google.errorprone.matchers.Matcher

Packages that use Matcher
Package Description
com.google.errorprone.bugpatterns
Checks added to the java compiler which detect common bug patterns.
com.google.errorprone.bugpatterns.android  
com.google.errorprone.bugpatterns.inject.dagger
Bug patterns related to Dagger.
com.google.errorprone.matchers
A predicate DSL for matching javac AST nodes.
com.google.errorprone.matchers.method  
com.google.errorprone.util
Utility code.
  • Uses of Matcher in com.google.errorprone.bugpatterns

    Fields in com.google.errorprone.bugpatterns declared as Matcher
    Modifier and Type Field Description
    static Matcher<com.sun.source.tree.ExpressionTree> CatchFail.ASSERT_WITH_MESSAGE  
    static Matcher<com.sun.source.tree.BinaryTree> BadShiftAmount.BINARY_TREE_MATCHER  
    static Matcher<com.sun.source.tree.ExpressionTree> CollectorShouldNotUseState.COLLECTOR_OF_CALL  
    Matcher<com.sun.source.tree.Tree> CollectorShouldNotUseState.containsAnonymousClassUsingState  
    protected static Matcher<com.sun.source.tree.Tree> AbstractMustBeClosedChecker.HAS_MUST_BE_CLOSED_ANNOTATION
    Matches trees annotated with MustBeClosed.
    static Matcher<com.sun.source.tree.Tree> DeadException.MATCHER  
    static Matcher<com.sun.source.tree.ExpressionTree> ProtoBuilderReturnValueIgnored.MATCHER  
    static Matcher<com.sun.source.tree.ExpressionTree> StreamResourceLeak.MATCHER  
    static Matcher<com.sun.source.tree.Tree> PreferredInterfaceType.SHOULD_IGNORE  
    Methods in com.google.errorprone.bugpatterns that return Matcher
    Modifier and Type Method Description
    protected Matcher<com.sun.source.tree.MethodTree> JUnit4SetUpNotRun.methodMatcher()  
    protected Matcher<com.sun.source.tree.MethodTree> JUnit4TearDownNotRun.methodMatcher()  
    protected abstract Matcher<? super com.sun.source.tree.ExpressionTree> AbstractReturnValueIgnored.specializedMatcher()
    Match whatever additional conditions concrete subclasses want to match (a list of known side-effect-free methods, has a @CheckReturnValue annotation, etc.).
    Matcher<com.sun.source.tree.ExpressionTree> CheckReturnValue.specializedMatcher()
    Return a matcher for method invocations in which the method being called has the @CheckReturnValue annotation.
    Matcher<com.sun.source.tree.ExpressionTree> FutureReturnValueIgnored.specializedMatcher()  
    protected Matcher<? super com.sun.source.tree.ExpressionTree> IgnoredPureGetter.specializedMatcher()  
    Matcher<? super com.sun.source.tree.ExpressionTree> ProtoBuilderReturnValueIgnored.specializedMatcher()  
    Matcher<? super com.sun.source.tree.ExpressionTree> ReturnValueIgnored.specializedMatcher()  
    Matcher<? super com.sun.source.tree.ExpressionTree> RxReturnValueIgnored.specializedMatcher()  
    Methods in com.google.errorprone.bugpatterns with parameters of type Matcher
    Modifier and Type Method Description
    static AbstractMockChecker.TypeExtractor<com.sun.source.tree.MethodInvocationTree> AbstractMockChecker.extractClassArg​(Matcher<com.sun.source.tree.MethodInvocationTree> m)
    Produces an extractor which, if the tree matches, extracts the type of the first argument whose type is Class (preserving its <T> type parameter, if it has one}.
    static AbstractMockChecker.TypeExtractor<com.sun.source.tree.MethodInvocationTree> AbstractMockChecker.extractFirstArg​(Matcher<com.sun.source.tree.MethodInvocationTree> m)
    Produces an extractor which, if the tree matches, extracts the type of the first argument to the method invocation.
    static <T extends com.sun.source.tree.Tree>
    AbstractMockChecker.TypeExtractor<T>
    AbstractMockChecker.extractType​(Matcher<T> m)
    Produces an extractor which, if the tree matches, extracts the type of that tree, as given by ASTHelpers.getType(Tree).
    protected Description AbstractMustBeClosedChecker.scanEntireMethodFor​(Matcher<? super com.sun.source.tree.MethodInvocationTree> m, com.sun.source.tree.MethodTree tree, VisitorState state)
    Scans a method body for invocations matching m, and emitting them as a single fix.
    abstract StronglyType.Builder StronglyType.Builder.setFactoryMatcher​(Matcher<com.sun.source.tree.ExpressionTree> matcher)
    Set the matcher used to check if an expression is a factory creating a stronger type.
  • Uses of Matcher in com.google.errorprone.bugpatterns.android

    Methods in com.google.errorprone.bugpatterns.android that return Matcher
    Modifier and Type Method Description
    Matcher<? super com.sun.source.tree.ExpressionTree> RectIntersectReturnValueIgnored.specializedMatcher()  
  • Uses of Matcher in com.google.errorprone.bugpatterns.inject.dagger

    Methods in com.google.errorprone.bugpatterns.inject.dagger that return Matcher
    Modifier and Type Method Description
    static Matcher<com.sun.source.tree.Tree> DaggerAnnotations.isAnyModule()  
  • Uses of Matcher in com.google.errorprone.matchers

    Subinterfaces of Matcher in com.google.errorprone.matchers
    Modifier and Type Interface Description
    interface  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.
    Classes in com.google.errorprone.matchers that implement Matcher
    Modifier and Type Class Description
    class  AbstractTypeMatcher<T extends com.sun.source.tree.Tree>
    Base class for type matchers.
    class  AnnotationDoesNotHaveArgument
    Matches an annotation that does not have a particular argument, possibly because the default value is being used.
    class  AnnotationHasArgumentWithValue  
    class  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.
    class  AnnotationType  
    class  Asserts
    Matches assert statements which have a condition expression matched by the given matcher.
    class  ChildMultiMatcher<T extends com.sun.source.tree.Tree,​N extends com.sun.source.tree.Tree>
    A MultiMatcher that applies a matcher across multiple children of a single ancestor node.
    class  CompileTimeConstantExpressionMatcher
    A matcher for compile-time-constant expressions.
    class  CompoundAssignment
    Matcher for a compound-assignment operator expression.
    class  ConstructorOfClass
    Applies the given matcher to the constructor(s) of the given class.
    class  Contains
    A matcher that recursively inspects a tree, applying the given matcher to all levels of each tree and returning true if any match is found.
    static class  Enclosing.Block<T extends com.sun.source.tree.Tree>  
    static class  Enclosing.BlockOrCase<T extends com.sun.source.tree.Tree>  
    static class  Enclosing.Class<T extends com.sun.source.tree.Tree>  
    static class  Enclosing.Method<T extends com.sun.source.tree.Tree>  
    class  HasArguments
    Matches if the given matcher matches all of/any of the parameters to this method.
    class  HasIdentifier
    Matches if the given matcher matches all of the identifiers under this syntax tree.
    class  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.
    class  IsSubtypeOf<T extends com.sun.source.tree.Tree>  
    class  MethodHasParameters
    Matches if the given matcher matches all of/any of the parameters to this method.
    class  MethodInvocation
    Matches a method invocation based on a matcher for the method select (receiver + method identifier) and one for the arguments.
    class  MethodInvocationArgument
    Applies an Expression matcher to an argument of a MethodInvocation by position.
    class  MethodInvocationMethodSelect
    Adapts a matcher on MethodInvocationTree to match the MethodSelect of the MethodInvocation.
    class  MethodVisibility
    A matcher for method visibility (public, private, protected, or default).
    class  NullnessMatcher
    Matches an expression based on the result of the nullness dataflow analysis.
    class  Returns
    Matches a return statement whose returned expression is matched by the given matcher.
    class  StringLiteral  
    class  Throws
    Matches a throw statement whose thrown expression is matched by the given matcher.
    Fields in com.google.errorprone.matchers declared as Matcher
    Modifier and Type Field Description
    static Matcher<com.sun.source.tree.Tree> InjectMatchers.HAS_INJECT_ANNOTATION  
    static Matcher<com.sun.source.tree.MethodTree> JUnitMatchers.hasJUnit4AfterAnnotations  
    static Matcher<com.sun.source.tree.MethodTree> JUnitMatchers.hasJUnit4BeforeAnnotations  
    static Matcher<com.sun.source.tree.ClassTree> JUnitMatchers.hasJUnit4TestCases
    Match a class which has one or more methods with a JUnit 4 @Test annotation.
    static Matcher<com.sun.source.tree.Tree> InjectMatchers.INSIDE_GUICE_MODULE  
    static Matcher<com.sun.source.tree.AnnotationTree> InjectMatchers.IS_APPLICATION_OF_AT_INJECT  
    static Matcher<com.sun.source.tree.AnnotationTree> InjectMatchers.IS_APPLICATION_OF_GUICE_INJECT  
    static Matcher<com.sun.source.tree.AnnotationTree> InjectMatchers.IS_APPLICATION_OF_JAVAX_INJECT  
    static Matcher<com.sun.source.tree.AnnotationTree> InjectMatchers.IS_BINDING_ANNOTATION  
    static Matcher<com.sun.source.tree.ClassTree> InjectMatchers.IS_DAGGER_COMPONENT  
    static Matcher<com.sun.source.tree.ClassTree> InjectMatchers.IS_DAGGER_COMPONENT_OR_MODULE  
    static Matcher<com.sun.source.tree.Tree> Matchers.IS_INTERFACE  
    static Matcher<com.sun.source.tree.AnnotationTree> InjectMatchers.IS_SCOPING_ANNOTATION  
    static Matcher<com.sun.source.tree.ClassTree> JUnitMatchers.isAmbiguousJUnitVersion
    Matches classes which have attributes of both JUnit 3 and 4 classes.
    static Matcher<com.sun.source.tree.ClassTree> JUnitMatchers.isConcreteClassWithoutRunWith
    Match a class which appears to be missing a @RunWith annotation.
    static Matcher<com.sun.source.tree.MethodTree> JUnitMatchers.isJunit3TestCase
    Match a method which appears to be a JUnit 3 test case.
    static Matcher<com.sun.source.tree.ClassTree> JUnitMatchers.isJUnit3TestClass
    Match a class which appears to be a JUnit 3 test class.
    static Matcher<com.sun.source.tree.ClassTree> JUnitMatchers.isJUnit4TestClass
    Matches classes which have attributes of only JUnit4 test classes.
    static Matcher<com.sun.source.tree.ClassTree> JUnitMatchers.isTestCaseDescendant
    Matches a class that inherits from TestCase.
    static Matcher<com.sun.source.tree.MethodTree> JUnitMatchers.looksLikeJUnit3SetUp
    Match a method which appears to be a JUnit 3 setUp method
    static Matcher<com.sun.source.tree.MethodTree> JUnitMatchers.looksLikeJUnit3TearDown
    Match a method which appears to be a JUnit 3 tearDown method
    static Matcher<com.sun.source.tree.MethodTree> JUnitMatchers.looksLikeJUnit4After
    Matches a method which appears to be a JUnit4 @After method.
    static Matcher<com.sun.source.tree.MethodTree> JUnitMatchers.looksLikeJUnit4Before
    Matches a method which appears to be a JUnit4 @Before method.
    protected Matcher<T> Enclosing.EnclosingMatcher.matcher  
    protected Matcher<T> Enclosing.EnclosingMatcher.matcher  
    protected Matcher<T> Enclosing.EnclosingMatcher.matcher  
    protected Matcher<N> ChildMultiMatcher.nodeMatcher
    The matcher to apply to the subnodes in question.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.SERIALIZATION_METHODS
    Method signature of serialization methods.
    static Matcher<com.sun.source.tree.MethodTree> JUnitMatchers.TEST_CASE
    Matches a JUnit 3 or 4 test case.
    static Matcher<com.sun.source.tree.MethodInvocationTree> WaitMatchers.waitMethod
    Matches any wait/await method.
    static Matcher<com.sun.source.tree.MethodInvocationTree> WaitMatchers.waitMethodWithTimeout
    Matches wait/await methods that have a timeout.
    static Matcher<com.sun.source.tree.MethodTree> JUnitMatchers.wouldRunInJUnit4
    Matches a method annotated with @Test but not @Ignore.
    Methods in com.google.errorprone.matchers that return Matcher
    Modifier and Type Method Description
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.allOf​(Matcher<? super T>... matchers)
    Compose several matchers together, such that the composite matches an AST node iff all the given matchers do.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.allOf​(Iterable<? extends Matcher<? super T>> matchers)
    Compose several matchers together, such that the composite matches an AST node iff all the given matchers do.
    static Matcher<com.sun.source.tree.ExpressionTree> FieldMatchers.anyFieldInClass​(String className)  
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.anyOf​(Matcher<? super T>... matchers)  
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.anyOf​(Iterable<? extends Matcher<? super T>> matchers)
    Compose several matchers together, such that the composite matches an AST node if any of the given matchers do.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.anything()
    A matcher that matches any AST node.
    static Matcher<com.sun.source.tree.MethodInvocationTree> Matchers.argument​(int position, Matcher<com.sun.source.tree.ExpressionTree> argumentMatcher)  
    static Matcher<com.sun.source.tree.MethodInvocationTree> Matchers.argumentCount​(int argumentCount)  
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.assertEqualsInvocation()
    Matches calls to the method org.junit.Assert#assertEquals and corresponding methods in JUnit 3.x.
    static Matcher<com.sun.source.tree.AssertTree> Matchers.assertionWithCondition​(Matcher<com.sun.source.tree.ExpressionTree> conditionMatcher)
    Matches an assertion AST node if the given matcher matches its condition.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.assertNotEqualsInvocation()
    Matches calls to the method org.junit.Assert#assertNotEquals and corresponding methods in JUnit 3.x.
    static Matcher<com.sun.source.tree.StatementTree> Matchers.assertStatement​(Matcher<com.sun.source.tree.ExpressionTree> conditionMatcher)
    Matches an assert statement where the condition is matched by the passed conditionMatcher.
    static Matcher<com.sun.source.tree.AssignmentTree> Matchers.assignment​(Matcher<com.sun.source.tree.ExpressionTree> variableMatcher, Matcher<? super com.sun.source.tree.ExpressionTree> expressionMatcher)
    Matches an assignment operator AST node if both of the given matchers match.
    static Matcher<com.sun.source.tree.BinaryTree> Matchers.binaryTree​(Matcher<com.sun.source.tree.ExpressionTree> matcher1, Matcher<com.sun.source.tree.ExpressionTree> matcher2)
    Matches a binary tree if the given matchers match the operands in either order.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.booleanConstant​(boolean value)
    Matches the boolean constant (Boolean.TRUE or Boolean.FALSE) corresponding to the given value.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.booleanLiteral​(boolean value)  
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.classLiteral​(Matcher<? super com.sun.source.tree.ExpressionTree> classMatcher)  
    static Matcher<com.sun.source.tree.MethodTree> Matchers.constructorOfClass​(String className)
    Matches a constructor declaration in a specific enclosing class.
    static Matcher<com.sun.source.tree.Tree> Matchers.contains​(Matcher<com.sun.source.tree.Tree> treeMatcher)
    Applies the given matcher recursively to all descendants of an AST node, and matches if any matching descendant node is found.
    static <T extends com.sun.source.tree.Tree,​ V extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.contains​(Class<? extends V> clazz, Matcher<? super V> treeMatcher)
    Applies the given matcher recursively to all descendants of an AST node, and matches if any matching descendant node is found.
    static Matcher<com.sun.source.tree.StatementTree> Matchers.continueStatement()
    Matches a continue statement.
    static Matcher<com.sun.source.tree.AnnotationTree> Matchers.doesNotHaveArgument​(String argumentName)
    Matches an Annotation AST node if an argument to the annotation does not exist.
    static Matcher<com.sun.source.tree.Tree> Matchers.enclosingNode​(Matcher<com.sun.source.tree.Tree> matcher)
    Matches an AST node that is enclosed by some node that matches the given matcher.
    static Matcher<com.sun.source.tree.EnhancedForLoopTree> Matchers.enhancedForLoop​(Matcher<com.sun.source.tree.VariableTree> variableMatcher, Matcher<com.sun.source.tree.ExpressionTree> expressionMatcher, Matcher<com.sun.source.tree.StatementTree> statementMatcher)
    Matches an enhanced for loop if all the given matchers match.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.equalsMethodDeclaration()
    Matches Object.equals(java.lang.Object) method declaration.
    static Matcher<com.sun.source.tree.StatementTree> Matchers.expressionStatement​(Matcher<com.sun.source.tree.ExpressionTree> matcher)
    Matches an ExpressionStatementTree based on its ExpressionTree.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.hasAnnotation​(Class<? extends Annotation> inputClass)
    Determines whether an expression has an annotation of the given class.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.hasAnnotation​(String annotationClass)
    Determines whether an expression has an annotation of the given type.
    static Matcher<com.sun.source.tree.Tree> Matchers.hasAnnotation​(TypeMirror annotationMirror)
    Determines if an expression has an annotation referred to by the given mirror.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.hasAnnotationOnAnyOverriddenMethod​(String annotationClass)
    Matches if a method or any method it overrides has an annotation of the given type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.hasAnnotationWithSimpleName​(String simpleName)
    Determines whether an expression has an annotation with the given simple name.
    static Matcher<com.sun.source.tree.Tree> Matchers.hasAnyAnnotation​(Class<? extends Annotation>... annotations)  
    static Matcher<com.sun.source.tree.Tree> Matchers.hasAnyAnnotation​(List<? extends TypeMirror> mirrors)  
    static Matcher<com.sun.source.tree.AnnotationTree> Matchers.hasArgumentWithValue​(String argumentName, Matcher<com.sun.source.tree.ExpressionTree> valueMatcher)
    Matches an Annotation AST node if the argument to the annotation with the given name has a value which matches the given matcher.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.hashCodeMethodDeclaration()
    Matches hashCode method declaration.
    static Matcher<com.sun.source.tree.Tree> Matchers.hasIdentifier​(Matcher<com.sun.source.tree.IdentifierTree> nodeMatcher)
    Matches any AST that contains an identifier with a certain property.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    InjectMatchers.hasInjectAnnotation()  
    static Matcher<com.sun.source.tree.ClassTree> Matchers.hasMethod​(Matcher<com.sun.source.tree.MethodTree> methodMatcher)
    Matches a class in which at least one method matches the given methodMatcher.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.hasModifier​(Modifier modifier)
    Returns true if the Tree node has the expected Modifier.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    InjectMatchers.hasProvidesAnnotation()  
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.ignoreParens​(Matcher<com.sun.source.tree.ExpressionTree> innerMatcher)
    Ignores any number of parenthesis wrapping an expression and then applies the passed matcher to that expression.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.inLoop()
    Matches if the given tree is inside a loop.
    static <T extends com.sun.source.tree.ExpressionTree>
    Matcher<T>
    Matchers.instanceEqualsInvocation()
    Matches calls to the method Object.equals(Object) or any override of that method.
    static Matcher<com.sun.source.tree.ExpressionTree> FieldMatchers.instanceField​(String className, String fieldName)  
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.instanceHashCodeInvocation()
    Matches calls to the method Object.hashCode() or any override of that method.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.inSynchronized()
    Matches if this Tree is enclosed by either a synchronized block or a synchronized method.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.intLiteral​(int value)  
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isArrayType()
    Matches an AST node if its type is an array type.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.isBoxedPrimitiveType()
    Matches an AST node if its type is a boxed primitive type.
    static Matcher<com.sun.source.tree.ClassTree> Matchers.isDirectImplementationOf​(String clazz)
    Matches any node that is directly an implementation, but not extension, of the given Class.
    static Matcher<com.sun.source.tree.ClassTree> Matchers.isEnum()
    Matches if a ClassTree is an enum declaration.
    static Matcher<com.sun.source.tree.VariableTree> Matchers.isField()
    Matches if a VariableTree is a field declaration, as opposed to a local variable, enum constant, parameter to a method, etc.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isInstance​(Class<?> klass)
    Matches if an AST node is an instance of the given class.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.isInstanceField()
    Matches an AST node that represents a non-static field.
    static Matcher<com.sun.source.tree.ExpressionTree> JUnitMatchers.isJUnit4TestRunnerOfType​(Iterable<String> runnerTypes)
    Matches an argument of type Class<T>, where T is a subtype of one of the test runners listed in the TEST_RUNNERS field.
    static Matcher<com.sun.source.tree.StatementTree> Matchers.isLastStatementInBlock()
    Matches a statement AST node if the statement is the last statement in the block.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.isNonNull()
    Deprecated.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.isNonNullUsingDataflow()
    Matches if the expression is provably non-null.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.isNull()
    Deprecated.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.isNullUsingDataflow()
    Matches if the expression is provably null.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isPrimitiveArrayType()
    Matches an AST node if its type is a primitive array type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isPrimitiveOrBoxedPrimitiveType()
    Matches an AST node if its type is a primitive type, or a boxed version of a primitive type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isPrimitiveOrVoidType()
    Matches an AST node if its type is either a primitive type or a void type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isPrimitiveType()
    Matches an AST node if its type is a primitive type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isSame​(com.sun.source.tree.Tree t)
    Matches an AST node which is the same object reference as the given node.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isSameType​(Supplier<com.sun.tools.javac.code.Type> type)
    Matches an AST node if it has the same erased type as the given type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isSameType​(Class<?> clazz)
    Matches an AST node if it has the same erased type as the given class.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isSameType​(String typeString)
    Matches an AST node if it has the same erased type as the given type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isStatic()
    Matches an AST node that is static.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isSubtypeOf​(Supplier<com.sun.tools.javac.code.Type> type)
    Matches an AST node if its type is a subtype of the given type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isSubtypeOf​(Class<?> clazz)
    Matches an AST node if its type is a subtype of the given type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isSubtypeOf​(String typeStr)
    Matches an AST node if its type is a subtype of the given type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isTransient()
    Matches an AST node that is transient.
    static Matcher<com.sun.source.tree.AnnotationTree> Matchers.isType​(String annotationClassName)  
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.isVariable()
    Matches an AST node that represents a local variable or parameter.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.isVoidType()
    Matches an AST node if its type is a void type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.kindAnyOf​(Set<com.sun.source.tree.Tree.Kind> kinds)
    Matches an AST node of a given kind, for example, an Annotation or a switch block.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.kindIs​(com.sun.source.tree.Tree.Kind kind)
    Matches an AST node of a given kind, for example, an Annotation or a switch block.
    static Matcher<com.sun.source.tree.StatementTree> Matchers.matchExpressionReturn​(Matcher<com.sun.source.tree.ExpressionTree> expressionTreeMatcher)
    Matches the Tree if it returns an expression matching expressionTreeMatcher.
    static Matcher<com.sun.source.tree.BlockTree> Matchers.matchSingleStatementBlock​(Matcher<com.sun.source.tree.StatementTree> statementMatcher)
    Matches a BlockTree if it single statement block with statement matching statementMatcher.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodHasArity​(int arity)
    Matches if the method accepts the given number of arguments.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodHasParameters​(Matcher<com.sun.source.tree.VariableTree>... variableMatcher)
    Matches an AST node that represents a method declaration, based on the list of variableMatchers.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodHasParameters​(List<Matcher<com.sun.source.tree.VariableTree>> variableMatcher)
    Matches an AST node that represents a method declaration, based on the list of variableMatchers.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodHasVisibility​(MethodVisibility.Visibility visibility)  
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.methodInvocation​(Matcher<com.sun.source.tree.ExpressionTree> methodSelectMatcher)
    Matches an AST node if it is a method invocation and the method select matches methodSelectMatcher.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.methodInvocation​(Matcher<com.sun.source.tree.ExpressionTree> methodSelectMatcher, ChildMultiMatcher.MatchType matchType, Matcher<com.sun.source.tree.ExpressionTree> methodArgumentMatcher)
    Matches an AST node if it is a method invocation and the given matchers match.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodIsConstructor()  
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodIsNamed​(String methodName)
    Match a method declaration with a specific name.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodNameStartsWith​(String prefix)
    Match a method declaration that starts with a given string.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodReturns​(Matcher<? super com.sun.source.tree.Tree> returnTypeMatcher)  
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodReturns​(Supplier<com.sun.tools.javac.code.Type> returnType)  
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.methodReturnsNonNull()
    Matches a method invocation that is known to never return null.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodReturnsNonPrimitiveType()
    Match a method that returns a non-primitive type.
    static Matcher<com.sun.source.tree.MethodInvocationTree> Matchers.methodSelect​(Matcher<com.sun.source.tree.ExpressionTree> methodSelectMatcher)  
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodWithClassAndName​(String className, String methodName)
    Match a method declaration with a specific enclosing class and method name.
    static Matcher<com.sun.source.tree.ClassTree> Matchers.nestingKind​(NestingKind kind)
    Matches an class based on whether it is nested in another class or method.
    static <T extends com.sun.source.tree.StatementTree>
    Matcher<T>
    Matchers.nextStatement​(Matcher<com.sun.source.tree.StatementTree> matcher)
    Matches a statement AST node if the following statement in the enclosing block matches the given matcher.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.nonNullLiteral()
    Matches an AST node if it is a literal other than null.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.not​(Matcher<T> matcher)
    Matches an AST node iff it does not match the given matcher.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.nothing()
    A matcher that matches no AST node.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.nullLiteral()
    Matches an AST node if it is a null literal.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.packageMatches​(Pattern pattern)
    Matches an AST node whose compilation unit's package name matches the given pattern.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.packageStartsWith​(String prefix)
    Matches an AST node whose compilation unit starts with this prefix.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.parentNode​(Matcher<com.sun.source.tree.Tree> treeMatcher)
    Matches an AST node if its parent node is matched by the given matcher.
    static <T extends com.sun.source.tree.StatementTree>
    Matcher<T>
    Matchers.previousStatement​(Matcher<com.sun.source.tree.StatementTree> matcher)
    Matches a statement AST node if the previous statement in the enclosing block matches the given matcher.
    static Matcher<com.sun.source.tree.MethodInvocationTree> Matchers.receiverOfInvocation​(Matcher<com.sun.source.tree.ExpressionTree> expressionTreeMatcher)  
    static Matcher<? super com.sun.source.tree.MethodInvocationTree> Matchers.receiverSameAsArgument​(int argNum)
    Matches when the receiver of an instance method is the same reference as a particular argument to the method.
    static Matcher<com.sun.source.tree.StatementTree> Matchers.returnStatement​(Matcher<? super com.sun.source.tree.ExpressionTree> returnedMatcher)
    Matches a return statement where the returned expression is matched by the passed returnedMatcher.
    static Matcher<? super com.sun.source.tree.MethodInvocationTree> Matchers.sameArgument​(int index1, int index2)
    Matches a MethodInvocation when the arguments at the two given indices are both the same variable, as determined by ASTHelpers.sameVariable(com.sun.source.tree.ExpressionTree, com.sun.source.tree.ExpressionTree).
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.sameVariable​(com.sun.source.tree.ExpressionTree expr)
    Matches if this ExpressionTree refers to the same variable as the one passed into the matcher.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.singleStatementReturnMatcher​(Matcher<com.sun.source.tree.ExpressionTree> expressionTreeMatcher)
    Returns a matcher for MethodTree whose implementation contains a single return statement with expression matching the passed expressionTreeMatcher.
    static <T extends com.sun.source.tree.ExpressionTree>
    Matcher<T>
    Matchers.staticEqualsInvocation()
    Matches an invocation of a recognized static object equality method such as Objects.equals(java.lang.Object, java.lang.Object).
    static Matcher<com.sun.source.tree.ExpressionTree> FieldMatchers.staticField​(String className, String fieldName)  
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.staticFieldAccess()
    Matches an AST node which is an expression yielding the indicated static field access.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.stringLiteral​(String value)
    Matches a Literal AST node if it is a string literal with the given value.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.stringLiteral​(Pattern pattern)
    Matches a Literal AST node if it is a string literal which matches the given Pattern.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.symbolHasAnnotation​(Class<? extends Annotation> inputClass)
    Determines whether an expression refers to a symbol that has an annotation of the given type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.symbolHasAnnotation​(String annotationClass)
    Determines whether an expression refers to a symbol that has an annotation of the given type.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.symbolMatcher​(BiPredicate<com.sun.tools.javac.code.Symbol,​VisitorState> pred)
    Match a Tree based solely on the Symbol produced by ASTHelpers.getSymbol(Tree).
    static Matcher<com.sun.source.tree.StatementTree> Matchers.throwStatement​(Matcher<? super com.sun.source.tree.ExpressionTree> thrownMatcher)
    Matches a throw statement where the thrown item is matched by the passed thrownMatcher.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.toStringMethodDeclaration()
    Matches Object.toString() method declaration.
    static <S extends T,​ T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.toType​(Class<S> type, Matcher<? super S> matcher)
    Converts the given matcher to one that can be applied to any tree but is only executed when run on a tree of type and returns false for all other tree types.
    static Matcher<com.sun.source.tree.TypeCastTree> Matchers.typeCast​(Matcher<com.sun.source.tree.Tree> typeMatcher, Matcher<com.sun.source.tree.ExpressionTree> expressionMatcher)
    Matches a type cast AST node if both of the given matchers match.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.typePredicateMatcher​(TypePredicate pred)
    Match a Tree based solely on the type produced by ASTHelpers.getType(Tree).
    static Matcher<com.sun.source.tree.VariableTree> Matchers.variableInitializer​(Matcher<com.sun.source.tree.ExpressionTree> expressionTreeMatcher)
    Matches on the initializer of a VariableTree AST node.
    static Matcher<com.sun.source.tree.VariableTree> Matchers.variableType​(Matcher<com.sun.source.tree.Tree> treeMatcher)
    Matches on the type of a VariableTree AST node.
    Methods in com.google.errorprone.matchers with parameters of type Matcher
    Modifier and Type Method Description
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.allOf​(Matcher<? super T>... matchers)
    Compose several matchers together, such that the composite matches an AST node iff all the given matchers do.
    static <T extends com.sun.source.tree.Tree>
    MultiMatcher<T,​com.sun.source.tree.AnnotationTree>
    Matchers.annotations​(ChildMultiMatcher.MatchType matchType, Matcher<com.sun.source.tree.AnnotationTree> annotationMatcher)
    Matches if the given annotation matcher matches all of or any of the annotations on this tree node.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.anyOf​(Matcher<? super T>... matchers)  
    static Matcher<com.sun.source.tree.MethodInvocationTree> Matchers.argument​(int position, Matcher<com.sun.source.tree.ExpressionTree> argumentMatcher)  
    static Matcher<com.sun.source.tree.AssertTree> Matchers.assertionWithCondition​(Matcher<com.sun.source.tree.ExpressionTree> conditionMatcher)
    Matches an assertion AST node if the given matcher matches its condition.
    static Matcher<com.sun.source.tree.StatementTree> Matchers.assertStatement​(Matcher<com.sun.source.tree.ExpressionTree> conditionMatcher)
    Matches an assert statement where the condition is matched by the passed conditionMatcher.
    static Matcher<com.sun.source.tree.AssignmentTree> Matchers.assignment​(Matcher<com.sun.source.tree.ExpressionTree> variableMatcher, Matcher<? super com.sun.source.tree.ExpressionTree> expressionMatcher)
    Matches an assignment operator AST node if both of the given matchers match.
    static Matcher<com.sun.source.tree.BinaryTree> Matchers.binaryTree​(Matcher<com.sun.source.tree.ExpressionTree> matcher1, Matcher<com.sun.source.tree.ExpressionTree> matcher2)
    Matches a binary tree if the given matchers match the operands in either order.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.classLiteral​(Matcher<? super com.sun.source.tree.ExpressionTree> classMatcher)  
    static CompoundAssignment Matchers.compoundAssignment​(com.sun.source.tree.Tree.Kind operator, Matcher<com.sun.source.tree.ExpressionTree> leftOperandMatcher, Matcher<com.sun.source.tree.ExpressionTree> rightOperandMatcher)
    Matches a compound assignment operator AST node which matches a given left-operand matcher, a given right-operand matcher, and a specific compound assignment operator.
    static CompoundAssignment Matchers.compoundAssignment​(Set<com.sun.source.tree.Tree.Kind> operators, Matcher<com.sun.source.tree.ExpressionTree> receiverMatcher, Matcher<com.sun.source.tree.ExpressionTree> expressionMatcher)
    Matches a compound assignment operator AST node which matches a given left-operand matcher, a given right-operand matcher, and is one of a set of compound assignment operators.
    static MultiMatcher<com.sun.source.tree.ClassTree,​com.sun.source.tree.MethodTree> Matchers.constructor​(ChildMultiMatcher.MatchType matchType, Matcher<com.sun.source.tree.MethodTree> constructorMatcher)
    Matches a class in which any of/all of its constructors match the given constructorMatcher.
    static Matcher<com.sun.source.tree.Tree> Matchers.contains​(Matcher<com.sun.source.tree.Tree> treeMatcher)
    Applies the given matcher recursively to all descendants of an AST node, and matches if any matching descendant node is found.
    static <T extends com.sun.source.tree.Tree,​ V extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.contains​(Class<? extends V> clazz, Matcher<? super V> treeMatcher)
    Applies the given matcher recursively to all descendants of an AST node, and matches if any matching descendant node is found.
    static <T extends com.sun.source.tree.Tree>
    Enclosing.Block<T>
    Matchers.enclosingBlock​(Matcher<com.sun.source.tree.BlockTree> matcher)
    Matches an AST node which is enclosed by a block node that matches the given matcher.
    static <T extends com.sun.source.tree.Tree>
    Enclosing.Class<T>
    Matchers.enclosingClass​(Matcher<com.sun.source.tree.ClassTree> matcher)
    Matches an AST node which is enclosed by a class node that matches the given matcher.
    static <T extends com.sun.source.tree.Tree>
    Enclosing.Method<T>
    Matchers.enclosingMethod​(Matcher<com.sun.source.tree.MethodTree> matcher)
    Matches an AST node which is enclosed by a method node that matches the given matcher.
    static Matcher<com.sun.source.tree.Tree> Matchers.enclosingNode​(Matcher<com.sun.source.tree.Tree> matcher)
    Matches an AST node that is enclosed by some node that matches the given matcher.
    static Matcher<com.sun.source.tree.EnhancedForLoopTree> Matchers.enhancedForLoop​(Matcher<com.sun.source.tree.VariableTree> variableMatcher, Matcher<com.sun.source.tree.ExpressionTree> expressionMatcher, Matcher<com.sun.source.tree.StatementTree> statementMatcher)
    Matches an enhanced for loop if all the given matchers match.
    static Matcher<com.sun.source.tree.StatementTree> Matchers.expressionStatement​(Matcher<com.sun.source.tree.ExpressionTree> matcher)
    Matches an ExpressionStatementTree based on its ExpressionTree.
    static MultiMatcher<com.sun.source.tree.MethodInvocationTree,​com.sun.source.tree.ExpressionTree> Matchers.hasArguments​(ChildMultiMatcher.MatchType matchType, Matcher<com.sun.source.tree.ExpressionTree> argumentMatcher)
    Matches if the given matcher matches all of/any of the arguments to this method invocation.
    static Matcher<com.sun.source.tree.AnnotationTree> Matchers.hasArgumentWithValue​(String argumentName, Matcher<com.sun.source.tree.ExpressionTree> valueMatcher)
    Matches an Annotation AST node if the argument to the annotation with the given name has a value which matches the given matcher.
    static Matcher<com.sun.source.tree.Tree> Matchers.hasIdentifier​(Matcher<com.sun.source.tree.IdentifierTree> nodeMatcher)
    Matches any AST that contains an identifier with a certain property.
    static Matcher<com.sun.source.tree.ClassTree> Matchers.hasMethod​(Matcher<com.sun.source.tree.MethodTree> methodMatcher)
    Matches a class in which at least one method matches the given methodMatcher.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.ignoreParens​(Matcher<com.sun.source.tree.ExpressionTree> innerMatcher)
    Ignores any number of parenthesis wrapping an expression and then applies the passed matcher to that expression.
    static Matcher<com.sun.source.tree.StatementTree> Matchers.matchExpressionReturn​(Matcher<com.sun.source.tree.ExpressionTree> expressionTreeMatcher)
    Matches the Tree if it returns an expression matching expressionTreeMatcher.
    static Matcher<com.sun.source.tree.BlockTree> Matchers.matchSingleStatementBlock​(Matcher<com.sun.source.tree.StatementTree> statementMatcher)
    Matches a BlockTree if it single statement block with statement matching statementMatcher.
    static MultiMatcher<com.sun.source.tree.MethodTree,​com.sun.source.tree.VariableTree> Matchers.methodHasParameters​(ChildMultiMatcher.MatchType matchType, Matcher<com.sun.source.tree.VariableTree> parameterMatcher)
    Matches if the given matcher matches all of/any of the parameters to this method.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodHasParameters​(Matcher<com.sun.source.tree.VariableTree>... variableMatcher)
    Matches an AST node that represents a method declaration, based on the list of variableMatchers.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.methodInvocation​(Matcher<com.sun.source.tree.ExpressionTree> methodSelectMatcher)
    Matches an AST node if it is a method invocation and the method select matches methodSelectMatcher.
    static Matcher<com.sun.source.tree.ExpressionTree> Matchers.methodInvocation​(Matcher<com.sun.source.tree.ExpressionTree> methodSelectMatcher, ChildMultiMatcher.MatchType matchType, Matcher<com.sun.source.tree.ExpressionTree> methodArgumentMatcher)
    Matches an AST node if it is a method invocation and the given matchers match.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodReturns​(Matcher<? super com.sun.source.tree.Tree> returnTypeMatcher)  
    static Matcher<com.sun.source.tree.MethodInvocationTree> Matchers.methodSelect​(Matcher<com.sun.source.tree.ExpressionTree> methodSelectMatcher)  
    static <T extends com.sun.source.tree.StatementTree>
    Matcher<T>
    Matchers.nextStatement​(Matcher<com.sun.source.tree.StatementTree> matcher)
    Matches a statement AST node if the following statement in the enclosing block matches the given matcher.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.not​(Matcher<T> matcher)
    Matches an AST node iff it does not match the given matcher.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.parentNode​(Matcher<com.sun.source.tree.Tree> treeMatcher)
    Matches an AST node if its parent node is matched by the given matcher.
    static <T extends com.sun.source.tree.StatementTree>
    Matcher<T>
    Matchers.previousStatement​(Matcher<com.sun.source.tree.StatementTree> matcher)
    Matches a statement AST node if the previous statement in the enclosing block matches the given matcher.
    static Matcher<com.sun.source.tree.MethodInvocationTree> Matchers.receiverOfInvocation​(Matcher<com.sun.source.tree.ExpressionTree> expressionTreeMatcher)  
    static Matcher<com.sun.source.tree.StatementTree> Matchers.returnStatement​(Matcher<? super com.sun.source.tree.ExpressionTree> returnedMatcher)
    Matches a return statement where the returned expression is matched by the passed returnedMatcher.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.singleStatementReturnMatcher​(Matcher<com.sun.source.tree.ExpressionTree> expressionTreeMatcher)
    Returns a matcher for MethodTree whose implementation contains a single return statement with expression matching the passed expressionTreeMatcher.
    static Matcher<com.sun.source.tree.StatementTree> Matchers.throwStatement​(Matcher<? super com.sun.source.tree.ExpressionTree> thrownMatcher)
    Matches a throw statement where the thrown item is matched by the passed thrownMatcher.
    static <S extends T,​ T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.toType​(Class<S> type, Matcher<? super S> matcher)
    Converts the given matcher to one that can be applied to any tree but is only executed when run on a tree of type and returns false for all other tree types.
    static Matcher<com.sun.source.tree.TypeCastTree> Matchers.typeCast​(Matcher<com.sun.source.tree.Tree> typeMatcher, Matcher<com.sun.source.tree.ExpressionTree> expressionMatcher)
    Matches a type cast AST node if both of the given matchers match.
    static Matcher<com.sun.source.tree.VariableTree> Matchers.variableInitializer​(Matcher<com.sun.source.tree.ExpressionTree> expressionTreeMatcher)
    Matches on the initializer of a VariableTree AST node.
    static Matcher<com.sun.source.tree.VariableTree> Matchers.variableType​(Matcher<com.sun.source.tree.Tree> treeMatcher)
    Matches on the type of a VariableTree AST node.
    Method parameters in com.google.errorprone.matchers with type arguments of type Matcher
    Modifier and Type Method Description
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.allOf​(Iterable<? extends Matcher<? super T>> matchers)
    Compose several matchers together, such that the composite matches an AST node iff all the given matchers do.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    Matchers.anyOf​(Iterable<? extends Matcher<? super T>> matchers)
    Compose several matchers together, such that the composite matches an AST node if any of the given matchers do.
    static Matcher<com.sun.source.tree.MethodTree> Matchers.methodHasParameters​(List<Matcher<com.sun.source.tree.VariableTree>> variableMatcher)
    Matches an AST node that represents a method declaration, based on the list of variableMatchers.
    Constructors in com.google.errorprone.matchers with parameters of type Matcher
    Constructor Description
    AnnotationHasArgumentWithValue​(String element, Matcher<com.sun.source.tree.ExpressionTree> valueMatcher)  
    AnnotationMatcher​(ChildMultiMatcher.MatchType matchType, Matcher<com.sun.source.tree.AnnotationTree> nodeMatcher)  
    Asserts​(Matcher<com.sun.source.tree.ExpressionTree> expressionMatcher)  
    Block​(Matcher<com.sun.source.tree.BlockTree> matcher)  
    BlockOrCase​(Matcher<com.sun.source.tree.BlockTree> blockTreeMatcher, Matcher<com.sun.source.tree.CaseTree> caseTreeMatcher)  
    ChildMultiMatcher​(ChildMultiMatcher.MatchType matchType, Matcher<N> nodeMatcher)  
    Class​(Matcher<com.sun.source.tree.ClassTree> matcher)  
    CompoundAssignment​(Set<com.sun.source.tree.Tree.Kind> operators, Matcher<com.sun.source.tree.ExpressionTree> receiverMatcher, Matcher<com.sun.source.tree.ExpressionTree> expressionMatcher)
    Creates a new compound-assignment operator matcher, which matches a compound assignment expression with one of a set of operators and whose receiver and expression match the given matchers.
    ConstructorOfClass​(ChildMultiMatcher.MatchType matchType, Matcher<com.sun.source.tree.MethodTree> nodeMatcher)  
    Contains​(Matcher<com.sun.source.tree.Tree> matcher)  
    HasArguments​(ChildMultiMatcher.MatchType matchType, Matcher<com.sun.source.tree.ExpressionTree> nodeMatcher)  
    HasIdentifier​(Matcher<com.sun.source.tree.IdentifierTree> nodeMatcher)  
    Method​(Matcher<com.sun.source.tree.MethodTree> matcher)  
    MethodHasParameters​(ChildMultiMatcher.MatchType matchType, Matcher<com.sun.source.tree.VariableTree> nodeMatcher)  
    MethodInvocation​(Matcher<com.sun.source.tree.ExpressionTree> methodSelectMatcher, ChildMultiMatcher.MatchType matchType, Matcher<com.sun.source.tree.ExpressionTree> methodArgumentMatcher)
    Creates a new matcher for method invocations based on a method select and an argument matcher.
    MethodInvocationArgument​(int position, Matcher<com.sun.source.tree.ExpressionTree> argumentMatcher)  
    MethodInvocationMethodSelect​(Matcher<com.sun.source.tree.ExpressionTree> methodSelectMatcher)  
    Returns​(Matcher<? super com.sun.source.tree.ExpressionTree> returnedMatcher)
    New matcher for a return statement where the returned expression is matched by the passed returnedMatcher.
    Throws​(Matcher<? super com.sun.source.tree.ExpressionTree> thrownMatcher)
    New matcher for a throw statement where the thrown item is matched by the passed thrownMatcher.
  • Uses of Matcher in com.google.errorprone.matchers.method

    Subinterfaces of Matcher in com.google.errorprone.matchers.method
    Modifier and Type Interface Description
    static interface  MethodMatchers.AnyMethodMatcher
    Deprecated.
    use Matcher<ExpressionTree> instead of referring directly to this type.
    static interface  MethodMatchers.ConstructorClassMatcher
    Deprecated.
    use Matcher<ExpressionTree> instead of referring directly to this type.
    static interface  MethodMatchers.ConstructorMatcher
    Deprecated.
    use Matcher<ExpressionTree> instead of referring directly to this type.
    static interface  MethodMatchers.InstanceMethodMatcher
    Deprecated.
    use Matcher<ExpressionTree> instead of referring directly to this type.
    static interface  MethodMatchers.MethodClassMatcher
    Deprecated.
    use Matcher<ExpressionTree> instead of referring directly to this type.
    static interface  MethodMatchers.MethodMatcher
    Deprecated.
    use Matcher<ExpressionTree> instead of referring directly to this type.
    static interface  MethodMatchers.MethodNameMatcher
    Deprecated.
    use Matcher<ExpressionTree> instead of referring directly to this type.
    static interface  MethodMatchers.MethodSignatureMatcher
    Deprecated.
    use Matcher<ExpressionTree> instead of referring directly to this type.
    static interface  MethodMatchers.ParameterMatcher
    Deprecated.
    use Matcher<ExpressionTree> instead of referring directly to this type.
    static interface  MethodMatchers.StaticMethodMatcher
    Deprecated.
    use Matcher<ExpressionTree> instead of referring directly to this type.
    Methods in com.google.errorprone.matchers.method that return Matcher
    Modifier and Type Method Description
    static Matcher<com.sun.source.tree.ExpressionTree> MethodInvocationMatcher.compile​(Iterable<MethodInvocationMatcher.Rule> rules)
    Constructs a Matcher that matches for method invocations (including constructor invocations) satisfying at least one of the given Rule specifications.
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    MethodInvocationMatcher.compiledAnyOf​(Iterable<Matcher<? super T>> inputs)
    Compose several matchers together, such that the composite matches an AST node if any of the given matchers do.
    Method parameters in com.google.errorprone.matchers.method with type arguments of type Matcher
    Modifier and Type Method Description
    static <T extends com.sun.source.tree.Tree>
    Matcher<T>
    MethodInvocationMatcher.compiledAnyOf​(Iterable<Matcher<? super T>> inputs)
    Compose several matchers together, such that the composite matches an AST node if any of the given matchers do.
  • Uses of Matcher in com.google.errorprone.util

    Method parameters in com.google.errorprone.util with type arguments of type Matcher
    Modifier and Type Method Description
    static List<com.sun.source.tree.ExpressionTree> ASTHelpers.matchBinaryTree​(com.sun.source.tree.BinaryTree tree, List<Matcher<com.sun.source.tree.ExpressionTree>> matchers, VisitorState state)
    Given a BinaryTree to match against and a list of two matchers, applies the matchers to the operands in both orders.