Class BlockTemplate
java.lang.Object
com.google.errorprone.refaster.Template<com.google.errorprone.refaster.BlockTemplateMatch>
com.google.errorprone.refaster.BlockTemplate
- All Implemented Interfaces:
Serializable
public abstract class BlockTemplate
extends Template<com.google.errorprone.refaster.BlockTemplateMatch>
Template representing a sequence of consecutive statements.
- Author:
- lowasser@google.com (Louis Wasserman)
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BlockTemplate
create
(com.google.common.collect.ImmutableClassToInstanceMap<Annotation> annotations, Iterable<UTypeVar> typeVariables, Map<String, ? extends UType> expressionArgumentTypes, Iterable<? extends UStatement> templateStatements) static BlockTemplate
create
(UStatement... templateStatements) static BlockTemplate
create
(Iterable<UTypeVar> typeVariables, Map<String, ? extends UType> expressionArgumentTypes, UStatement... templateStatements) static BlockTemplate
create
(Map<String, ? extends UType> expressionArgumentTypes, UStatement... templateStatements) Iterable
<com.google.errorprone.refaster.BlockTemplateMatch> match
(com.sun.tools.javac.tree.JCTree tree, com.sun.tools.javac.util.Context context) If the tree is aJCTree.JCBlock
, returns a list of disjoint matches corresponding to the exact list of template statements found consecutively; otherwise, returns an empty list.replace
(com.google.errorprone.refaster.BlockTemplateMatch match) withStatements
(Iterable<? extends UStatement> templateStatements) Methods inherited from class com.google.errorprone.refaster.Template
actualTypes, addImports, annotations, expectedTypes, expressionArgumentTypes, pretty, templateTypeVariables, typecheck
-
Constructor Details
-
BlockTemplate
public BlockTemplate()
-
-
Method Details
-
create
-
create
public static BlockTemplate create(Map<String, ? extends UType> expressionArgumentTypes, UStatement... templateStatements) -
create
public static BlockTemplate create(Iterable<UTypeVar> typeVariables, Map<String, ? extends UType> expressionArgumentTypes, UStatement... templateStatements) -
create
public static BlockTemplate create(com.google.common.collect.ImmutableClassToInstanceMap<Annotation> annotations, Iterable<UTypeVar> typeVariables, Map<String, ? extends UType> expressionArgumentTypes, Iterable<? extends UStatement> templateStatements) -
withStatements
-
match
public Iterable<com.google.errorprone.refaster.BlockTemplateMatch> match(com.sun.tools.javac.tree.JCTree tree, com.sun.tools.javac.util.Context context) If the tree is aJCTree.JCBlock
, returns a list of disjoint matches corresponding to the exact list of template statements found consecutively; otherwise, returns an empty list. -
replace
-