Alle implementierten Schnittstellen:
TypeConstants, TypeIds
Bekannte direkte Unterklassen:
AllocationExpression, Annotation, ArrayAllocationExpression, ArrayInitializer, Assignment, CastExpression, ClassLiteralAccess, FunctionalExpression, JavadocArgumentExpression, JavadocModuleReference, Literal, MessageSend, OperatorExpression, Pattern, Reference, SwitchStatement, TypeReference

public abstract class Expression extends Statement
  • Felddetails

    • constant

      public Constant constant
    • statementEnd

      public int statementEnd
    • implicitConversion

      public int implicitConversion
    • resolvedType

      public TypeBinding resolvedType
    • NO_EXPRESSIONS

      public static Expression[] NO_EXPRESSIONS
  • Konstruktordetails

    • Expression

      public Expression()
  • Methodendetails

    • isConstantValueRepresentable

      public static final boolean isConstantValueRepresentable(Constant constant, int constantTypeID, int targetTypeID)
    • analyseCode

      public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo)
      Angegeben von:
      analyseCode in Klasse Statement
    • analyseCode

      public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, boolean valueRequired)
      More sophisticated for of the flow analysis used for analyzing expressions, and be able to optimize out portions of expressions where no actual value is required.
      Parameter:
      currentScope -
      flowContext -
      flowInfo -
      valueRequired -
      Gibt zurück:
      The state of initialization after the analysis of the current expression
    • updateFlowOnBooleanResult

      protected void updateFlowOnBooleanResult(FlowInfo flowInfo, boolean result)
      Back-propagation of flow info: before analysing a branch where a given condition is known to hold true/false respectively, ask the condition to contribute its information to the given flowInfo.
      Parameter:
      flowInfo - the info to be used for analysing the branch
      result - condition result that would cause entering the branch
    • checkCastTypesCompatibility

      public final boolean checkCastTypesCompatibility(Scope scope, TypeBinding castType, TypeBinding expressionType, Expression expression, boolean useAutoBoxing)
      Returns false if cast is not legal.
    • checkNPE

      public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo, int ttlForFieldCheck)
      Check this expression against potential NPEs, which may occur:
      • if the expression is the receiver in a field access, qualified allocation, array reference or message send incl. implicit message sends like it happens for the collection in a foreach statement.
      • if the expression is subject to unboxing
      • if the expression is the exception in a throw statement
      If a risk of NPE is detected report it to the context. If the expression denotes a local variable, mark it as checked, which affects the flow info.
      Parameter:
      scope - the scope of the analysis
      flowContext - the current flow context
      flowInfo - the upstream flow info; caveat: may get modified
      ttlForFieldCheck - if this is a reference to a field we will mark that field as nonnull for the specified timeToLive
      Gibt zurück:
      could this expression be checked by the current implementation?
    • checkNPE

      public boolean checkNPE(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo)
    • checkNPEbyUnboxing

      protected void checkNPEbyUnboxing(BlockScope scope, FlowContext flowContext, FlowInfo flowInfo)
      If this expression requires unboxing check if that operation can throw NPE.
    • checkUnsafeCast

      public boolean checkUnsafeCast(Scope scope, TypeBinding castType, TypeBinding expressionType, TypeBinding match, boolean isNarrowing)
    • computeConversion

      public void computeConversion(Scope scope, TypeBinding runtimeType, TypeBinding compileTimeType)
      Base types need that the widening is explicitly done by the compiler using some bytecode like i2f. Also check unsafe type operations.
    • computeNullStatus

      public static int computeNullStatus(int status, int combinedStatus)
    • generateCode

      public void generateCode(BlockScope currentScope, CodeStream codeStream)
      Expression statements are plain expressions, however they generate like normal expressions with no value required.
      Angegeben von:
      generateCode in Klasse Statement
      Parameter:
      currentScope - org.eclipse.jdt.internal.compiler.lookup.BlockScope
      codeStream - org.eclipse.jdt.internal.compiler.codegen.CodeStream
    • generateCode

      public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired)
      Every expression is responsible for generating its implicit conversion when necessary.
      Parameter:
      currentScope - org.eclipse.jdt.internal.compiler.lookup.BlockScope
      codeStream - org.eclipse.jdt.internal.compiler.codegen.CodeStream
      valueRequired - boolean
    • addPatternVariables

      public void addPatternVariables(BlockScope scope, CodeStream codeStream)
    • getPatternVariable

      public LocalDeclaration getPatternVariable()
    • collectPatternVariablesToScope

      public void collectPatternVariablesToScope(LocalVariableBinding[] variables, BlockScope scope)
    • generateOptimizedBoolean

      public void generateOptimizedBoolean(BlockScope currentScope, CodeStream codeStream, BranchLabel trueLabel, BranchLabel falseLabel, boolean valueRequired)
      Default generation of a boolean value
      Parameter:
      currentScope -
      codeStream -
      trueLabel -
      falseLabel -
      valueRequired -
    • generateOptimizedStringConcatenation

      public void generateOptimizedStringConcatenation(BlockScope blockScope, CodeStream codeStream, int typeID)
    • generateOptimizedStringConcatenationCreation

      public void generateOptimizedStringConcatenationCreation(BlockScope blockScope, CodeStream codeStream, int typeID)
    • buildStringForConcatation

      public void buildStringForConcatation(BlockScope blockScope, CodeStream codeStream, int typeID, StringBuilder recipe, List<TypeBinding> argTypes)
    • getDirectBinding

      public static Binding getDirectBinding(Expression someExpression)
    • isCompactableOperation

      public boolean isCompactableOperation()
    • isConstantValueOfTypeAssignableToType

      public boolean isConstantValueOfTypeAssignableToType(TypeBinding constantType, TypeBinding targetType)
    • isTypeReference

      public boolean isTypeReference()
    • localVariableBinding

      public LocalVariableBinding localVariableBinding()
      Returns the local variable referenced by this node. Can be a direct reference (SingleNameReference) or thru a cast expression etc...
    • markAsNonNull

      public void markAsNonNull()
      Mark this expression as being non null, per a specific tag in the source code.
    • nullStatus

      public int nullStatus(FlowInfo flowInfo, FlowContext flowContext)
    • optimizedBooleanConstant

      public Constant optimizedBooleanConstant()
      Constant usable for bytecode pattern optimizations, but cannot be inlined since it is not strictly equivalent to the definition of constant expressions. In particular, some side-effects may be required to occur (only the end value is known).
      Gibt zurück:
      Constant known to be of boolean type
    • isPertinentToApplicability

      public boolean isPertinentToApplicability(TypeBinding targetType, MethodBinding method)
    • postConversionType

      public TypeBinding postConversionType(Scope scope)
      Returns the type of the expression after required implicit conversions. When expression type gets promoted or inserted a generic cast, the converted type will differ from the resolved type (surface side-effects from #computeConversion(...)).
      Gibt zurück:
      the type after implicit conversion
    • print

      public StringBuffer print(int indent, StringBuffer output)
      Setzt außer Kraft:
      print in Klasse Statement
    • printExpression

      public abstract StringBuffer printExpression(int indent, StringBuffer output)
    • printStatement

      public StringBuffer printStatement(int indent, StringBuffer output)
      Angegeben von:
      printStatement in Klasse Statement
    • resolve

      public void resolve(BlockScope scope)
      Angegeben von:
      resolve in Klasse Statement
    • resolveExpressionType

      public TypeBinding resolveExpressionType(BlockScope scope)
      Beschreibung aus Klasse kopiert: Statement
      Returns the resolved expression if any associated to this statement - used parameter statement has to be either a SwitchStatement or a SwitchExpression
      Setzt außer Kraft:
      resolveExpressionType in Klasse Statement
    • resolveType

      public TypeBinding resolveType(BlockScope scope)
      Resolve the type of this expression in the context of a blockScope
      Parameter:
      scope -
      Gibt zurück:
      Return the actual type of this expression after resolution
    • resolveType

      public TypeBinding resolveType(ClassScope scope)
      Resolve the type of this expression in the context of a classScope
      Parameter:
      scope -
      Gibt zurück:
      Return the actual type of this expression after resolution
    • resolveTypeExpecting

      public TypeBinding resolveTypeExpecting(BlockScope scope, TypeBinding expectedType)
    • resolveExpressionExpecting

      public Expression resolveExpressionExpecting(TypeBinding targetType, Scope scope, InferenceContext18 context)
    • forcedToBeRaw

      public boolean forcedToBeRaw(ReferenceContext referenceContext)
      Returns true if the receiver is forced to be of raw type either to satisfy the contract imposed by a super type or because it *is* raw and the current type has no control over it (i.e the rawness originates from some other file.)
    • reusableJSRTarget

      public Object reusableJSRTarget()
      Returns an object which can be used to identify identical JSR sequence targets (see TryStatement subroutine codegen) or null if not reusable
    • setExpectedType

      public void setExpectedType(TypeBinding expectedType)
      Record the type expectation before this expression is typechecked. e.g. String s = foo();, foo() will be tagged as being expected of type String Used to trigger proper inference of generic method invocations.
      Parameter:
      expectedType - The type denoting an expectation in the context of an assignment conversion
    • setExpressionContext

      public void setExpressionContext(ExpressionContext context)
    • isCompatibleWith

      public boolean isCompatibleWith(TypeBinding left, Scope scope)
    • isBoxingCompatibleWith

      public boolean isBoxingCompatibleWith(TypeBinding left, Scope scope)
    • sIsMoreSpecific

      public boolean sIsMoreSpecific(TypeBinding s, TypeBinding t, Scope scope)
    • isExactMethodReference

      public boolean isExactMethodReference()
    • isPolyExpression

      public boolean isPolyExpression() throws UnsupportedOperationException
      Löst aus:
      UnsupportedOperationException
    • isPolyExpression

      public boolean isPolyExpression(MethodBinding method)
      Variant of isPolyExpression() to be used during type inference, when a resolution candidate exists.
    • tagAsNeedCheckCast

      public void tagAsNeedCheckCast()
    • tagAsUnnecessaryCast

      public void tagAsUnnecessaryCast(Scope scope, TypeBinding castType)
      Record the fact a cast expression got detected as being unnecessary.
      Parameter:
      scope -
      castType -
    • toTypeReference

      public Expression toTypeReference()
    • traverse

      public void traverse(ASTVisitor visitor, BlockScope scope)
      Traverse an expression in the context of a blockScope
      Setzt außer Kraft:
      traverse in Klasse ASTNode
      Parameter:
      visitor -
      scope -
    • traverse

      public void traverse(ASTVisitor visitor, ClassScope scope)
      Traverse an expression in the context of a classScope
      Parameter:
      visitor -
      scope -
    • statementExpression

      public boolean statementExpression()
    • isTrulyExpression

      public boolean isTrulyExpression()
    • nullAnnotatedVariableBinding

      public VariableBinding nullAnnotatedVariableBinding(boolean supportTypeAnnotations)
      Used on the lhs of an assignment for detecting null spec violation. If this expression represents a null-annotated variable return the variable binding, otherwise null.
      Parameter:
      supportTypeAnnotations - if true this causes any variable binding to be used independent of declaration annotations (for in-depth analysis of type annotations)
    • isFunctionalType

      public boolean isFunctionalType()
    • getPolyExpressions

      public Expression[] getPolyExpressions()
      Returns contained poly expressions, result could be 0, 1 or more (for conditional expression)
    • isPotentiallyCompatibleWith

      public boolean isPotentiallyCompatibleWith(TypeBinding targetType, Scope scope)
    • optimizedNullComparisonConstant

      protected Constant optimizedNullComparisonConstant()