Class ExpressionTemplate
java.lang.Object
com.google.errorprone.refaster.Template<com.google.errorprone.refaster.ExpressionTemplateMatch>
com.google.errorprone.refaster.ExpressionTemplate
- All Implemented Interfaces:
Unifiable<com.sun.tools.javac.tree.JCTree.JCExpression>, Serializable
public abstract class ExpressionTemplate
extends Template<com.google.errorprone.refaster.ExpressionTemplateMatch>
implements Unifiable<com.sun.tools.javac.tree.JCTree.JCExpression>
Implementation of a template to match and replace an expression anywhere in an AST.
- Author:
- lowasser@google.com (Louis Wasserman)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ExpressionTemplatecreate(com.google.common.collect.ImmutableClassToInstanceMap<Annotation> annotations, Iterable<UTypeVar> typeVariables, Map<String, ? extends UType> expressionArgumentTypes, UExpression expression, UType returnType) static ExpressionTemplatecreate(UExpression expression, UType returnType) static ExpressionTemplatecreate(Map<String, ? extends UType> expressionArgumentTypes, UExpression expression, UType returnType) booleanIterable<com.google.errorprone.refaster.ExpressionTemplateMatch> match(com.sun.tools.javac.tree.JCTree target, com.sun.tools.javac.util.Context context, com.sun.tools.javac.tree.JCTree.JCCompilationUnit compilationUnit) Returns the matches of this template against the specified target AST.negation()replace(com.google.errorprone.refaster.ExpressionTemplateMatch match) Generates aSuggestedFixreplacing the specified match (usually of another template) with this template.Returns all valid unification paths (if any) from thisUnifierthat unify this withtarget.withRuleTypeVariables(Iterable<UTypeVar> ruleTypeVariables) Methods inherited from class Template
actualTypes, addImports, annotations, expectedTypes, expressionArgumentTypes, pretty, ruleTypeVariables, templateTypeVariables, typecheck
-
Constructor Details
-
ExpressionTemplate
public ExpressionTemplate()
-
-
Method Details
-
create
-
create
public static ExpressionTemplate create(Map<String, ? extends UType> expressionArgumentTypes, UExpression expression, UType returnType) -
create
public static ExpressionTemplate create(com.google.common.collect.ImmutableClassToInstanceMap<Annotation> annotations, Iterable<UTypeVar> typeVariables, Map<String, ? extends UType> expressionArgumentTypes, UExpression expression, UType returnType) -
withRuleTypeVariables
- Specified by:
withRuleTypeVariablesin classTemplate<com.google.errorprone.refaster.ExpressionTemplateMatch>
-
generateNegation
public boolean generateNegation() -
negation
-
match
public Iterable<com.google.errorprone.refaster.ExpressionTemplateMatch> match(com.sun.tools.javac.tree.JCTree target, com.sun.tools.javac.util.Context context, com.sun.tools.javac.tree.JCTree.JCCompilationUnit compilationUnit) Returns the matches of this template against the specified target AST. -
unify
Description copied from interface:UnifiableReturns all valid unification paths (if any) from thisUnifierthat unify this withtarget. -
replace
Generates aSuggestedFixreplacing the specified match (usually of another template) with this template.
-