Annotation Type Matches

@Target({PARAMETER,METHOD}) @Retention(SOURCE) public @interface Matches
Specify an error-prone Matcher to further restrict what expressions are matched by the annotated parameter.

Note: The @Matches annotation should only go on the @BeforeTemplate. For example:

 class SingletonList {
   public <E> List<E> before(@Matches(IsNonNullMatcher.class) E e) {
     return Collections.singletonList(e);

   public <E> List<E> after(E e) {
     return ImmutableList.of(e);
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Class<? extends Matcher<? super com.sun.source.tree.ExpressionTree>>
  • Element Details

    • value

      Class<? extends Matcher<? super com.sun.source.tree.ExpressionTree>> value