public static class JavaExpressionParseUtil.JavaExpressionContext extends Object
@A(E)
, the context is the program element that is annotated by @A(E)
.Modifier and Type | Field and Description |
---|---|
List<JavaExpression> |
arguments
In a context for a method declaration or lambda, the formals.
|
BaseContext |
checkerContext
The checker context.
|
boolean |
parsingMember
Whether or not the FlowExpressionParser is parsing the "member" part of a member select.
|
JavaExpression |
receiver
The value of
this in this context. |
boolean |
useLocalScope
Whether the TreePath should be used to find identifiers.
|
Constructor and Description |
---|
JavaExpressionContext(JavaExpression receiver,
List<JavaExpression> arguments,
BaseContext checkerContext)
Creates a context for parsing a Java expression.
|
public final JavaExpression receiver
this
in this context.public final List<JavaExpression> arguments
public final BaseContext checkerContext
public final boolean parsingMember
public final boolean useLocalScope
public JavaExpressionContext(JavaExpression receiver, List<JavaExpression> arguments, BaseContext checkerContext)
receiver
- used to replace "this" in a Java expression and used to resolve
identifiers in any Java expression with an implicit "this"arguments
- used to replace parameter references, e.g. #1, in Java expressions, null
if no argumentscheckerContext
- used to create JavaExpression
spublic static JavaExpressionParseUtil.JavaExpressionContext buildContextForMethodDeclaration(MethodTree methodDeclaration, Tree enclosingTree, BaseContext checkerContext)
JavaExpressionParseUtil.JavaExpressionContext
for the method declared in methodDeclaration
.methodDeclaration
- used to translate parameter numbers in a Java expression to
formal parameters of the methodenclosingTree
- used to look up fields and as the type of "this" in Java expressionscheckerContext
- used to build JavaExpressionmethodDeclaration
public static JavaExpressionParseUtil.JavaExpressionContext buildContextForMethodDeclaration(MethodTree methodDeclaration, TreePath currentPath, BaseContext checkerContext)
JavaExpressionParseUtil.JavaExpressionContext
for the method declared in methodDeclaration
.methodDeclaration
- used to translate parameter numbers in a Java expression to
formal parameters of the methodcurrentPath
- the path to the method. It is used to find the enclosing class, which
is used to look up fields and as the type of "this" in Java expressions.checkerContext
- used to build JavaExpressionmethodDeclaration
public static JavaExpressionParseUtil.JavaExpressionContext buildContextForMethodDeclaration(MethodTree methodDeclaration, TypeMirror enclosingType, BaseContext checkerContext)
JavaExpressionParseUtil.JavaExpressionContext
for the method declared in methodDeclaration
.methodDeclaration
- used to translate parameter numbers in a Java expression to
formal parameters of the methodenclosingType
- used to look up fields and as type of "this" in Java expressionscheckerContext
- used to build JavaExpressionmethodDeclaration
public static JavaExpressionParseUtil.JavaExpressionContext buildContextForLambda(LambdaExpressionTree lambdaTree, TreePath path, BaseContext checkerContext)
JavaExpressionParseUtil.JavaExpressionContext
for the given lambda.lambdaTree
- a lambdapath
- the path to the lambdacheckerContext
- used to build JavaExpressionlambdaTree
public static JavaExpressionParseUtil.JavaExpressionContext buildContextForClassDeclaration(ClassTree classTree, BaseContext checkerContext)
JavaExpressionParseUtil.JavaExpressionContext
for the class classTree
as seen at the
class declaration.classTree
- a classcheckerContext
- used to build JavaExpressionJavaExpressionParseUtil.JavaExpressionContext
for the class classTree
as seen at the
class declarationpublic static JavaExpressionParseUtil.JavaExpressionContext buildContextForMethodUse(MethodInvocationNode methodInvocation, BaseContext checkerContext)
JavaExpressionParseUtil.JavaExpressionContext
for the method called by methodInvocation
, as seen at the method use (i.e., at the call site).methodInvocation
- a method invocationcheckerContext
- the javac components to useJavaExpressionParseUtil.JavaExpressionContext
for the method methodInvocation
public static JavaExpressionParseUtil.JavaExpressionContext buildContextForMethodUse(MethodInvocationTree methodInvocation, BaseContext checkerContext)
JavaExpressionParseUtil.JavaExpressionContext
for the method called by methodInvocation
, as seen at the method use (i.e., at the call site).methodInvocation
- a method invocationcheckerContext
- the javac components to useJavaExpressionParseUtil.JavaExpressionContext
for the method methodInvocation
public static JavaExpressionParseUtil.JavaExpressionContext buildContextForNewClassUse(ObjectCreationNode n, BaseContext checkerContext)
JavaExpressionParseUtil.JavaExpressionContext
for the constructor n
(represented as a
Node
as seen at the constructor use (i.e., at a "new" expression).n
- an object creation nodecheckerContext
- the checker contextJavaExpressionParseUtil.JavaExpressionContext
for the constructor n
(represented as a
Node
as seen at the constructor use (i.e., at a "new" expression)public JavaExpressionParseUtil.JavaExpressionContext copyChangeToParsingMemberOfReceiver(JavaExpression receiver)
receiver
- the receiver for the newly-returned contextpublic JavaExpressionParseUtil.JavaExpressionContext copyNotParsingMember()
public JavaExpressionParseUtil.JavaExpressionContext copyAndSetUseLocalScope(boolean useLocalScope)
useLocalScope
is set to the
given value.useLocalScope
- whether the local scope should be used to resolve identifiersuseLocalScope
is set to the given valuepublic String toStringDebug()