Class ReturnValueIgnored

All Implemented Interfaces:
BugChecker.MemberReferenceTreeMatcher, BugChecker.MethodInvocationTreeMatcher, BugChecker.NewClassTreeMatcher, BugChecker.ReturnTreeMatcher, ResultUsePolicyAnalyzer<com.sun.source.tree.ExpressionTree,VisitorState>, Suppressible, Serializable

public class ReturnValueIgnored extends AbstractReturnValueIgnored
A checker which produces an error when a return value is accidentally discarded.
See Also:
  • Method Details

    • specializedMatcher

      public Matcher<? super com.sun.source.tree.ExpressionTree> specializedMatcher()
      Description copied from class: AbstractReturnValueIgnored
      Match whatever additional conditions concrete subclasses want to match (a list of known side-effect-free methods, has a @CheckReturnValue annotation, etc.).
      Specified by:
      specializedMatcher in class AbstractReturnValueIgnored
    • getMatchMetadata

      public<String,?> getMatchMetadata(com.sun.source.tree.ExpressionTree tree, VisitorState state)
      Description copied from interface: ResultUsePolicyAnalyzer
      Returns a map of optional metadata about why this check matched the given expression.
    • getMessage

      protected String getMessage(Name name)
      Description copied from class: AbstractReturnValueIgnored
      Returns the diagnostic message. Can be overridden by subclasses to provide a customized diagnostic that includes the name of the invoked method.
      getMessage in class AbstractReturnValueIgnored