Class UVariableDecl

java.lang.Object
com.sun.source.util.SimpleTreeVisitor<Choice<Unifier>,​Unifier>
com.google.errorprone.refaster.UTree<com.sun.tools.javac.tree.JCTree.JCStatement>
com.google.errorprone.refaster.UVariableDecl
All Implemented Interfaces:
com.google.common.base.Function<UStatement.UnifierWithUnconsumedStatements,​Choice<UStatement.UnifierWithUnconsumedStatements>>, Unifiable<com.sun.source.tree.Tree>, UStatement, com.sun.source.tree.StatementTree, com.sun.source.tree.Tree, com.sun.source.tree.TreeVisitor<Choice<Unifier>,​Unifier>, com.sun.source.tree.VariableTree, Serializable, Function<UStatement.UnifierWithUnconsumedStatements,​Choice<UStatement.UnifierWithUnconsumedStatements>>

public abstract class UVariableDecl
extends UTree<com.sun.tools.javac.tree.JCTree.JCStatement>
implements com.sun.source.tree.VariableTree
A UTree representation of a local variable declaration.

A UVariableDecl can be unified with any variable declaration which has a matching type and initializer. Annotations and modifiers are preserved for the corresponding replacement, as well as the variable name. ULocalVarIdent instances are used to represent references to local variables.

As a result, we can modify variable declarations and initializations in target code while preserving variable names and other contextual information.

Author:
lowasser@google.com (Louis Wasserman)
See Also:
Serialized Form
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.sun.source.tree.Tree

    com.sun.source.tree.Tree.Kind

    Nested classes/interfaces inherited from interface com.google.errorprone.refaster.UStatement

    UStatement.UnifierWithUnconsumedStatements
  • Field Summary

    Fields inherited from class com.sun.source.util.SimpleTreeVisitor

    DEFAULT_VALUE
  • Constructor Summary

    Constructors
    Constructor Description
    UVariableDecl()  
  • Method Summary

    Modifier and Type Method Description
    <R,​ D> R accept​(com.sun.source.tree.TreeVisitor<R,​D> visitor, D data)  
    Choice<UStatement.UnifierWithUnconsumedStatements> apply​(UStatement.UnifierWithUnconsumedStatements state)  
    static UVariableDecl create​(CharSequence identifier, UExpression type)  
    static UVariableDecl create​(CharSequence identifier, UExpression type, UExpression initializer)  
    abstract UExpression getInitializer()  
    com.sun.source.tree.Tree.Kind getKind()  
    com.sun.source.tree.ModifiersTree getModifiers()  
    abstract StringName getName()  
    com.sun.source.tree.ExpressionTree getNameExpression()  
    abstract UExpression getType()  
    com.sun.tools.javac.tree.JCTree.JCVariableDecl inline​(Inliner inliner)  
    com.sun.tools.javac.tree.JCTree.JCVariableDecl inlineImplicitType​(Inliner inliner)  
    com.sun.tools.javac.util.List<com.sun.tools.javac.tree.JCTree.JCStatement> inlineStatements​(Inliner inliner)  
    Choice<Unifier> visitVariable​(com.sun.source.tree.VariableTree decl, Unifier unifier)  

    Methods inherited from class com.google.errorprone.refaster.UTree

    defaultAction, unify

    Methods inherited from class com.sun.source.util.SimpleTreeVisitor

    visit, visit, visitAnnotatedType, visitAnnotation, visitArrayAccess, visitArrayType, visitAssert, visitAssignment, visitBinary, visitBindingPattern, visitBlock, visitBreak, visitCase, visitCatch, visitClass, visitCompilationUnit, visitCompoundAssignment, visitConditionalExpression, visitContinue, visitDoWhileLoop, visitEmptyStatement, visitEnhancedForLoop, visitErroneous, visitExports, visitExpressionStatement, visitForLoop, visitIdentifier, visitIf, visitImport, visitInstanceOf, visitIntersectionType, visitLabeledStatement, visitLambdaExpression, visitLiteral, visitMemberReference, visitMemberSelect, visitMethod, visitMethodInvocation, visitModifiers, visitModule, visitNewArray, visitNewClass, visitOpens, visitOther, visitPackage, visitParameterizedType, visitParenthesized, visitPrimitiveType, visitProvides, visitRequires, visitReturn, visitSwitch, visitSwitchExpression, visitSynchronized, visitThrow, visitTry, visitTypeCast, visitTypeParameter, visitUnary, visitUnionType, visitUses, visitWhileLoop, visitWildcard, visitYield

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.google.common.base.Function

    equals

    Methods inherited from interface java.util.function.Function

    andThen, compose