Class ReturnsMono

java.lang.Object
tech.picnic.errorprone.refaster.matchers.ReturnsMono
All Implemented Interfaces:
com.google.errorprone.matchers.Matcher<ExpressionTree>, Serializable

public final class ReturnsMono extends Object implements com.google.errorprone.matchers.Matcher<ExpressionTree>
A matcher of Functions that return a reactor.core.publisher.Mono.

Refaster template method parameter types enable one to constrain the type of expressions matched by the "free variables" represented by the associated method parameters. For this, Refaster relies on the Java compiler to determine the type of candidate expressions. For lambda expressions and method references, the inferred type is one that is compatible with the associated assignment, invocation or casting context. It is important to note that this inferred type is not necessarily the most specific compatible type.

This matcher addresses that issue for the specific case in which one wishes to e.g. match expressions that are assignment/invocation/cast-compatible with Function<String, Mono<? extends String>>, but are in fact typed Function<String, Publisher<? extends String>>.

See Also:
  • Constructor Details

    • ReturnsMono

      public ReturnsMono()
      Instantiates a new ReturnsMono instance.
  • Method Details

    • matches

      public boolean matches(ExpressionTree tree, com.google.errorprone.VisitorState state)
      Specified by:
      matches in interface com.google.errorprone.matchers.Matcher<ExpressionTree>