Class 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:
    [email protected] (Louis Wasserman)
    See Also:
    Serialized Form
    • Constructor Detail

      • ExpressionTemplate

        public ExpressionTemplate()
    • Method Detail

      • generateNegation

        public boolean generateNegation()
      • match

        public Iterable<com.google.errorprone.refaster.ExpressionTemplateMatch> match​(com.sun.tools.javac.tree.JCTree target,
                                                                                      com.sun.tools.javac.util.Context context)
        Returns the matches of this template against the specified target AST.
        Specified by:
        match in class Template<com.google.errorprone.refaster.ExpressionTemplateMatch>
      • unify

        public Choice<Unifier> unify​(com.sun.tools.javac.tree.JCTree.JCExpression target,
                                     Unifier unifier)
        Description copied from interface: Unifiable
        Returns all valid unification paths (if any) from this Unifier that unify this with target.
        Specified by:
        unify in interface Unifiable<com.sun.tools.javac.tree.JCTree.JCExpression>
      • replace

        public Fix replace​(com.google.errorprone.refaster.ExpressionTemplateMatch match)
        Generates a SuggestedFix replacing the specified match (usually of another template) with this template.
        Specified by:
        replace in class Template<com.google.errorprone.refaster.ExpressionTemplateMatch>