public abstract class JavaExpression extends Object
?:; use
 Unknown for unrepresentable expressions).
 This class's representation is like an AST: subparts are also expressions. For declared names (fields, local variables, and methods), it also contains an Element.
Each subclass represents a different type of expression, such as MethodCall, ArrayAccess, LocalVariable, etc.
| Modifier and Type | Field and Description | 
|---|---|
| protected TypeMirror | typeThe type of this expression. | 
| Modifier | Constructor and Description | 
|---|---|
| protected  | JavaExpression(TypeMirror type)Create a JavaExpression. | 
| Modifier and Type | Method and Description | 
|---|---|
| abstract <R,P> R | accept(JavaExpressionVisitor<R,P> visitor,
      P p)Accept method of the visitor pattern. | 
| JavaExpression | atConstructorInvocation(NewClassTree newClassTree)Viewpoint-adapts  thisto thenewClassTree. | 
| JavaExpression | atFieldAccess(JavaExpression receiver)Viewpoint-adapts  thisto a field access with receiverreceiver. | 
| JavaExpression | atMethodBody(MethodTree methodTree)Viewpoint-adapts  thisto themethodTreeby converting anyFormalParameterintoLocalVariables. | 
| JavaExpression | atMethodInvocation(MethodInvocationNode invocationNode)Viewpoint-adapts  thisto theinvocationNode. | 
| JavaExpression | atMethodInvocation(MethodInvocationTree methodInvocationTree)Viewpoint-adapts  thisto themethodInvocationTree. | 
| boolean | containsModifiableAliasOf(Store<?> store,
                         JavaExpression other)Returns true if and only if  otherappears anywhere in this or an expression appears
 in this such thatothermight alias this expression, and that expression is
 modifiable. | 
| abstract boolean | containsOfClass(Class<? extends JavaExpression> clazz) | 
| abstract boolean | containsSyntacticEqualJavaExpression(JavaExpression other)Returns true if and only if this contains a JavaExpression that is syntactically equal to
  other. | 
| boolean | containsUnknown() | 
| static ArrayAccess | fromArrayAccess(ArrayAccessNode node)Returns the internal representation (as  FieldAccess) of aFieldAccessNode. | 
| static JavaExpression | fromNode(Node receiverNode)We ignore operations such as widening and narrowing when computing the internal
 representation. | 
| static JavaExpression | fromNodeFieldAccess(FieldAccessNode node)Returns the Java expression for a  FieldAccessNode. | 
| static JavaExpression | fromTree(ExpressionTree tree)Converts a javac  ExpressionTreeto a CF JavaExpression. | 
| static JavaExpression | fromVariableTree(VariableTree tree)Returns the Java expression corresponding to the given variable tree  tree. | 
| static List<FormalParameter> | getFormalParameters(ExecutableElement methodEle)Returns the parameters of  methodEleasFormalParameters. | 
| static JavaExpression | getImplicitReceiver(Element ele)Returns the implicit receiver of ele. | 
| static List<JavaExpression> | getParametersAsLocalVariables(ExecutableElement methodEle)Returns the parameters of  methodEleasLocalVariables. | 
| static JavaExpression | getPseudoReceiver(TreePath path,
                 TypeMirror enclosingType)Returns either a new ClassName or ThisReference JavaExpression object for the enclosingType. | 
| static JavaExpression | getReceiver(ExpressionTree accessTree)Returns the receiver of the given invocation | 
| TypeMirror | getType() | 
| abstract boolean | isDeterministic(AnnotationProvider provider)Returns true if the expression is deterministic. | 
| abstract boolean | isUnassignableByOtherCode()Returns true if and only if the value this expression stands for cannot be changed (with
 respect to ==) by a method call. | 
| abstract boolean | isUnmodifiableByOtherCode()Returns true if and only if the value this expression stands for cannot be changed by a
 method call, including changes to any of its fields. | 
| static boolean | listContainsSyntacticEqualJavaExpression(List<? extends JavaExpression> list,
                                        JavaExpression other)Returns true if the given list contains a JavaExpression that is syntactically equal to
  other. | 
| static boolean | listIsDeterministic(List<? extends JavaExpression> list,
                   AnnotationProvider provider)Returns true if all the expressions in the list are deterministic. | 
| abstract boolean | syntacticEquals(JavaExpression je)Returns true if and only if the two Java expressions are syntactically identical. | 
| static boolean | syntacticEqualsList(List<? extends JavaExpression> lst1,
                   List<? extends JavaExpression> lst2)Returns true if the corresponding list elements satisfy  syntacticEquals(org.checkerframework.dataflow.expression.JavaExpression). | 
| String | toStringDebug()Format this verbosely, for debugging. | 
protected final TypeMirror type
protected JavaExpression(TypeMirror type)
type - the type of the expressionpublic TypeMirror getType()
public abstract boolean containsOfClass(Class<? extends JavaExpression> clazz)
public boolean containsUnknown()
public abstract boolean isDeterministic(AnnotationProvider provider)
provider - an annotation provider (a type factory)public static boolean listIsDeterministic(List<? extends JavaExpression> list, AnnotationProvider provider)
list - the list whose elements to testprovider - an annotation provider (a type factory)public abstract boolean isUnassignableByOtherCode()
isUnassignableByOtherCode(), and operations
 whose operands are all isUnmodifiableByOtherCode().isUnmodifiableByOtherCode()public abstract boolean isUnmodifiableByOtherCode()
Approximately, this returns true if the expression is isUnassignableByOtherCode()
 and its type is immutable.
isUnassignableByOtherCode()@EqualsMethod public abstract boolean syntacticEquals(JavaExpression je)
This exists for use by containsSyntacticEqualJavaExpression(org.checkerframework.dataflow.expression.JavaExpression).
je - the other Java expression to compare to this onepublic static boolean syntacticEqualsList(List<? extends JavaExpression> lst1, List<? extends JavaExpression> lst2)
syntacticEquals(org.checkerframework.dataflow.expression.JavaExpression).lst1 - the first list to comparelst2 - the second list to comparesyntacticEquals(org.checkerframework.dataflow.expression.JavaExpression)public abstract boolean containsSyntacticEqualJavaExpression(JavaExpression other)
other.other - the JavaExpression to search forotherpublic static boolean listContainsSyntacticEqualJavaExpression(List<? extends JavaExpression> list, JavaExpression other)
other.list - the list in which to search for a matchother - the JavaExpression to search forotherpublic boolean containsModifiableAliasOf(Store<?> store, JavaExpression other)
other appears anywhere in this or an expression appears
 in this such that other might alias this expression, and that expression is
 modifiable.
 This is always true, except for cases where the Java type information prevents aliasing and none of the subexpressions can alias 'other'.
public String toStringDebug()
public static JavaExpression fromNodeFieldAccess(FieldAccessNode node)
FieldAccessNode. The result may contain Unknown as receiver.node - the FieldAccessNode to convert to a JavaExpressionFieldAccess or ClassName that corresponds to nodepublic static ArrayAccess fromArrayAccess(ArrayAccessNode node)
FieldAccess) of a FieldAccessNode.
 The result may contain Unknown as receiver.node - the ArrayAccessNode to convert to a JavaExpressionFieldAccess) of a FieldAccessNode.
     Can contain Unknown as receiver.public static JavaExpression fromNode(Node receiverNode)
receiverNode - a node to convert to a JavaExpressionUnknown.public static JavaExpression fromTree(ExpressionTree tree)
ExpressionTree to a CF JavaExpression. The result might contain
 Unknown.
 We ignore operations such as widening and narrowing when computing the JavaExpression.
tree - a javac treepublic static JavaExpression fromVariableTree(VariableTree tree)
tree.tree - a variable treetreepublic static List<JavaExpression> getParametersAsLocalVariables(ExecutableElement methodEle)
methodEle as LocalVariables.methodEle - the method elementLocalVariablespublic static List<FormalParameter> getFormalParameters(ExecutableElement methodEle)
methodEle as FormalParameters.methodEle - the method elementFormalParameterspublic static JavaExpression getReceiver(ExpressionTree accessTree)
accessTree - method or constructor invocationpublic static JavaExpression getImplicitReceiver(Element ele)
Returns either a new ClassName or a new ThisReference depending on whether ele is static or not. The passed element must be a field, method, or class.
ele - a field, method, or classpublic static JavaExpression getPseudoReceiver(TreePath path, TypeMirror enclosingType)
The Tree should be an expression or a statement that does not have a receiver or an implicit receiver. For example, a local variable declaration.
path - TreePath to treeenclosingType - type of the enclosing typepublic abstract <R,P> R accept(JavaExpressionVisitor<R,P> visitor, P p)
R - result type of the operationP - parameter typevisitor - the visitor to be applied to this JavaExpressionp - the parameter for this operationpublic JavaExpression atFieldAccess(JavaExpression receiver)
this to a field access with receiver receiver.receiver - receiver of the field accesspublic final JavaExpression atMethodBody(MethodTree methodTree)
this to the methodTree by converting any FormalParameter into LocalVariables.methodTree - method declaration treepublic final JavaExpression atMethodInvocation(MethodInvocationTree methodInvocationTree)
this to the methodInvocationTree.methodInvocationTree - method invocationpublic final JavaExpression atMethodInvocation(MethodInvocationNode invocationNode)
this to the invocationNode.invocationNode - method invocationpublic JavaExpression atConstructorInvocation(NewClassTree newClassTree)
this to the newClassTree.newClassTree - constructor invocation