Class ResultUseRule<C,S>
- java.lang.Object
-
- com.google.errorprone.bugpatterns.checkreturnvalue.ResultUseRule<C,S>
-
- Type Parameters:
C
- the type of the context object used during evaluationS
- the type of symbols
- Direct Known Subclasses:
ResultUseRule.GlobalRule
,ResultUseRule.MethodRule
,ResultUseRule.SymbolRule
public abstract class ResultUseRule<C,S> extends Object
A rule for determiningResultUsePolicy
for methods and/or constructors.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ResultUseRule.Evaluation<S>
An evaluation that a rule makes.static class
ResultUseRule.GlobalRule<C,S>
A global rule that is evaluated when none of the more specific rules determine aResultUsePolicy
for a method.static class
ResultUseRule.MethodRule<C,S,M extends S>
A rule that evaluates methods and constructors to determine aResultUsePolicy
for them.static class
ResultUseRule.RuleScope
Scope to which a rule may apply.static class
ResultUseRule.SymbolRule<C,S>
A rule that evaluates symbols of any kind to determine aResultUsePolicy
to associate with them.
-
Constructor Summary
Constructors Constructor Description ResultUseRule()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Optional<ResultUseRule.Evaluation<S>>
evaluate(ResultUseRule.RuleScope scope, S symbol, C context)
Evaluates the given symbol and optionally returns anResultUseRule.Evaluation
of it.abstract Optional<ResultUsePolicy>
evaluate(S symbol, C context)
Evaluates the givensymbol
and optionally returns aResultUsePolicy
for it.abstract String
id()
An ID for uniquely identifying this rule.abstract com.google.common.collect.ImmutableSet<ResultUseRule.RuleScope>
scopes()
The scopes this rule applies to.String
toString()
-
-
-
Method Detail
-
id
public abstract String id()
An ID for uniquely identifying this rule.
-
scopes
public abstract com.google.common.collect.ImmutableSet<ResultUseRule.RuleScope> scopes()
The scopes this rule applies to.
-
evaluate
public abstract Optional<ResultUsePolicy> evaluate(S symbol, C context)
Evaluates the givensymbol
and optionally returns aResultUsePolicy
for it.
-
evaluate
public final Optional<ResultUseRule.Evaluation<S>> evaluate(ResultUseRule.RuleScope scope, S symbol, C context)
Evaluates the given symbol and optionally returns anResultUseRule.Evaluation
of it.
-
-