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.
|
SourceChecker |
checker
The checker.
|
boolean |
parsingMember
Whether or not the JavaExpressionParser 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,
SourceChecker checker)
Creates a context for parsing a Java expression.
|
public final JavaExpression receiver
this in this context.public final List<JavaExpression> arguments
public final SourceChecker checker
public final boolean parsingMember
public final boolean useLocalScope
public JavaExpressionContext(JavaExpression receiver, List<JavaExpression> arguments, SourceChecker checker)
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 argumentschecker - used to create JavaExpressionspublic static JavaExpressionParseUtil.JavaExpressionContext buildContextForMethodDeclaration(MethodTree methodDeclaration, Tree enclosingTree, SourceChecker checker)
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 expressionschecker - used to build JavaExpressionmethodDeclarationpublic static JavaExpressionParseUtil.JavaExpressionContext buildContextForMethodDeclaration(MethodTree methodDeclaration, TreePath currentPath, SourceChecker checker)
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.checker - used to build JavaExpressionmethodDeclarationpublic static JavaExpressionParseUtil.JavaExpressionContext buildContextForMethodDeclaration(MethodTree methodDeclaration, TypeMirror enclosingType, SourceChecker checker)
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 expressionschecker - used to build JavaExpressionmethodDeclarationpublic static JavaExpressionParseUtil.JavaExpressionContext buildContextForLambda(LambdaExpressionTree lambdaTree, TreePath path, SourceChecker checker)
JavaExpressionParseUtil.JavaExpressionContext for the given lambda.lambdaTree - a lambdapath - the path to the lambdachecker - used to build JavaExpressionlambdaTreepublic static JavaExpressionParseUtil.JavaExpressionContext buildContextForClassDeclaration(ClassTree classTree, SourceChecker checker)
JavaExpressionParseUtil.JavaExpressionContext for the class classTree as seen at the
class declaration.classTree - a classchecker - used to build JavaExpressionJavaExpressionParseUtil.JavaExpressionContext for the class classTree as seen at the
class declarationpublic static JavaExpressionParseUtil.JavaExpressionContext buildContextForMethodUse(MethodInvocationNode methodInvocation, SourceChecker checker)
JavaExpressionParseUtil.JavaExpressionContext for the method called by methodInvocation, as seen at the method use (i.e., at the call site).methodInvocation - a method invocationchecker - the javac components to useJavaExpressionParseUtil.JavaExpressionContext for the method methodInvocationpublic static JavaExpressionParseUtil.JavaExpressionContext buildContextForMethodUse(MethodInvocationTree methodInvocation, SourceChecker checker)
JavaExpressionParseUtil.JavaExpressionContext for the method called by methodInvocation, as seen at the method use (i.e., at the call site).methodInvocation - a method invocationchecker - the javac components to useJavaExpressionParseUtil.JavaExpressionContext for the method methodInvocationpublic static JavaExpressionParseUtil.JavaExpressionContext buildContextForNewClassUse(ObjectCreationNode n, SourceChecker checker)
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 nodechecker - the checkerJavaExpressionParseUtil.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()