Class LocalVariable


  • public class LocalVariable
    extends JavaExpression
    A local variable.

    This class also represents a formal parameter expressed using its name. Class FormalParameter represents a formal parameter expressed using the "#2" notation.

    • Field Detail

      • element

        protected final javax.lang.model.element.VariableElement element
        The element for this local variable.
    • Constructor Detail

      • LocalVariable

        public LocalVariable​(LocalVariableNode localVar)
        Creates a new LocalVariable.
        Parameters:
        localVar - a CFG local variable
      • LocalVariable

        public LocalVariable​(javax.lang.model.element.VariableElement element)
        Creates a new LocalVariable.
        Parameters:
        element - the element for the local variable
    • Method Detail

      • equals

        public boolean equals​(@Nullable java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • sameElement

        protected static boolean sameElement​(javax.lang.model.element.VariableElement element1,
                                             javax.lang.model.element.VariableElement element2)
        Returns true if the two elements are the same.
        Parameters:
        element1 - the first element to compare
        element2 - the second element to compare
        Returns:
        true if the two elements are the same
      • getElement

        public javax.lang.model.element.VariableElement getElement()
        Returns the element for this variable.
        Returns:
        the element for this variable
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toStringDebug

        public java.lang.String toStringDebug()
        Description copied from class: JavaExpression
        Format this verbosely, for debugging.
        Overrides:
        toStringDebug in class JavaExpression
        Returns:
        a verbose string representation of this
      • isDeterministic

        public boolean isDeterministic​(AnnotationProvider provider)
        Description copied from class: JavaExpression
        Returns true if the expression is deterministic.
        Specified by:
        isDeterministic in class JavaExpression
        Parameters:
        provider - an annotation provider (a type factory)
        Returns:
        true if this expression is deterministic
      • containsSyntacticEqualJavaExpression

        public boolean containsSyntacticEqualJavaExpression​(JavaExpression other)
        Description copied from class: JavaExpression
        Returns true if and only if this contains a JavaExpression that is syntactically equal to other.
        Specified by:
        containsSyntacticEqualJavaExpression in class JavaExpression
        Parameters:
        other - the JavaExpression to search for
        Returns:
        true if and only if this contains a JavaExpression that is syntactically equal to other
      • accept

        public <R,​P> R accept​(JavaExpressionVisitor<R,​P> visitor,
                                    P p)
        Description copied from class: JavaExpression
        Accept method of the visitor pattern.
        Specified by:
        accept in class JavaExpression
        Type Parameters:
        R - result type of the operation
        P - parameter type
        Parameters:
        visitor - the visitor to be applied to this JavaExpression
        p - the parameter for this operation
        Returns:
        the result of visiting this