Annotation Interface 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 {
  @BeforeTemplate
  public <E> List<E> before(@Matches(IsNonNullMatcher.class) E e) {
    return Collections.singletonList(e);
  }

  @AfterTemplate
  public <E> List<E> after(E e) {
    return ImmutableList.of(e);
  }
}