java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.flow.FlowContext
Alle implementierten Schnittstellen:
TypeConstants
Bekannte direkte Unterklassen:
ExceptionHandlingFlowContext, SwitchFlowContext, TryFlowContext

public class FlowContext extends Object implements TypeConstants
Reflects the context of code analysis, keeping track of enclosing try statements, exception handlers, etc...
  • Felddetails

    • NotContinuableContext

      public static final FlowContext NotContinuableContext
    • NonLocalGotoThroughSwitchContext

      public static final FlowContext NonLocalGotoThroughSwitchContext
    • associatedNode

      public ASTNode associatedNode
    • parent

      public FlowContext parent
    • initsOnFinally

      public FlowInfo initsOnFinally
    • conditionalLevel

      public int conditionalLevel
      Used to record whether effects in a try block affect the finally-block conditionally or unconditionally. -1 means: no effect, 0 means: unconditional effect, > 0 means levels of nested conditional structures.
    • tagBits

      public int tagBits
    • providedExpectedTypes

      public TypeBinding[][] providedExpectedTypes
    • DEFER_NULL_DIAGNOSTIC

      public static final int DEFER_NULL_DIAGNOSTIC
      Siehe auch:
    • PREEMPT_NULL_DIAGNOSTIC

      public static final int PREEMPT_NULL_DIAGNOSTIC
      Siehe auch:
    • INSIDE_NEGATION

      public static final int INSIDE_NEGATION
      Siehe auch:
    • HIDE_NULL_COMPARISON_WARNING

      public static final int HIDE_NULL_COMPARISON_WARNING
      used to hide null comparison related warnings inside assert statements
      Siehe auch:
    • HIDE_NULL_COMPARISON_WARNING_MASK

      public static final int HIDE_NULL_COMPARISON_WARNING_MASK
      Siehe auch:
    • CAN_ONLY_NULL_NON_NULL

      public static final int CAN_ONLY_NULL_NON_NULL
      Siehe auch:
    • CAN_ONLY_NULL

      public static final int CAN_ONLY_NULL
      Siehe auch:
    • CAN_ONLY_NON_NULL

      public static final int CAN_ONLY_NON_NULL
      Siehe auch:
    • MAY_NULL

      public static final int MAY_NULL
      Siehe auch:
    • ASSIGN_TO_NONNULL

      public static final int ASSIGN_TO_NONNULL
      Siehe auch:
    • IN_UNBOXING

      public static final int IN_UNBOXING
      Siehe auch:
    • EXIT_RESOURCE

      public static final int EXIT_RESOURCE
      Siehe auch:
    • CHECK_MASK

      public static final int CHECK_MASK
      Siehe auch:
    • IN_COMPARISON_NULL

      public static final int IN_COMPARISON_NULL
      Siehe auch:
    • IN_COMPARISON_NON_NULL

      public static final int IN_COMPARISON_NON_NULL
      Siehe auch:
    • IN_ASSIGNMENT

      public static final int IN_ASSIGNMENT
      Siehe auch:
    • IN_INSTANCEOF

      public static final int IN_INSTANCEOF
      Siehe auch:
    • CONTEXT_MASK

      public static final int CONTEXT_MASK
      Siehe auch:
  • Konstruktordetails

    • FlowContext

      public FlowContext(FlowContext parent, ASTNode associatedNode, boolean inheritNullFieldChecks)
  • Methodendetails

    • copyNullCheckedFieldsFrom

      public void copyNullCheckedFieldsFrom(FlowContext other)
    • recordNullCheckedFieldReference

      public void recordNullCheckedFieldReference(Reference reference, int timeToLive)
      Record that a reference to a field has been seen in a non-null state.
      Parameter:
      reference - Can be a SingleNameReference, a FieldReference or a QualifiedNameReference resolving to a field
      timeToLive - control how many expire events are needed to expire this information
    • extendTimeToLiveForNullCheckedField

      public void extendTimeToLiveForNullCheckedField(int t)
      If a null checked field has been recorded recently, increase its time to live.
    • expireNullCheckedFieldInfo

      public void expireNullCheckedFieldInfo()
      Forget any information about fields that were previously known to be non-null. Will only cause any effect if CompilerOptions.enableSyntacticNullAnalysisForFields (implicitly by guards before calls to recordNullCheckedFieldReference(Reference, int)).
    • isNullcheckedFieldAccess

      public boolean isNullcheckedFieldAccess(Reference reference)
      Is the given field reference equivalent to a reference that is freshly known to be non-null? Can only return true if CompilerOptions.enableSyntacticNullAnalysisForFields (implicitly by guards before calls to recordNullCheckedFieldReference(Reference, int)).
    • breakLabel

      public BranchLabel breakLabel()
    • checkExceptionHandlers

      public void checkExceptionHandlers(TypeBinding raisedException, ASTNode location, FlowInfo flowInfo, BlockScope scope)
    • checkExceptionHandlers

      public void checkExceptionHandlers(TypeBinding raisedException, ASTNode location, FlowInfo flowInfo, BlockScope scope, boolean isExceptionOnAutoClose)
      Parameter:
      isExceptionOnAutoClose - This is for checking exception handlers for exceptions raised during the auto close of resources inside a try with resources statement. (Relevant for source levels 1.7 and above only)
    • checkExceptionHandlers

      public void checkExceptionHandlers(TypeBinding[] raisedExceptions, ASTNode location, FlowInfo flowInfo, BlockScope scope)
    • continueLabel

      public BranchLabel continueLabel()
    • getInitsForFinalBlankInitializationCheck

      public FlowInfo getInitsForFinalBlankInitializationCheck(TypeBinding declaringType, FlowInfo flowInfo)
    • getTargetContextForBreakLabel

      public FlowContext getTargetContextForBreakLabel(char[] labelName)
    • getTargetContextForContinueLabel

      public FlowContext getTargetContextForContinueLabel(char[] labelName)
    • getTargetContextForDefaultBreak

      public FlowContext getTargetContextForDefaultBreak()
    • getTargetContextForYield

      public FlowContext getTargetContextForYield(boolean requireExpression)
    • getTargetContextForDefaultContinue

      public FlowContext getTargetContextForDefaultContinue()
    • getInitializationContext

      public FlowContext getInitializationContext()
      Answer flow context that corresponds to initialization. Suitably override in subtypes.
    • getLocalParent

      public FlowContext getLocalParent()
      Answer the parent flow context but be careful not to cross the boundary of a nested type, or null if no such parent exists.
    • individualToString

      public String individualToString()
    • initsOnBreak

      public FlowInfo initsOnBreak()
    • initsOnReturn

      public UnconditionalFlowInfo initsOnReturn()
    • isBreakable

      public boolean isBreakable()
    • isContinuable

      public boolean isContinuable()
    • isNonReturningContext

      public boolean isNonReturningContext()
    • isSubRoutine

      public boolean isSubRoutine()
    • labelName

      public char[] labelName()
    • markFinallyNullStatus

      public void markFinallyNullStatus(LocalVariableBinding local, int nullStatus)
      Record a given null status of a given local variable as it will be seen in the finally block.
      Parameter:
      local - the local variable being observed
      nullStatus - the null status of local at the current point in the flow
    • mergeFinallyNullInfo

      public void mergeFinallyNullInfo(FlowInfo flowInfo)
      Merge the effect of a statement presumably contained in a try-block, i.e., record how the collected info will affect the corresponding finally-block. Precondition: caller has checked that initsOnFinally != null.
      Parameter:
      flowInfo - info after executing a statement of the try-block.
    • recordAbruptExit

      public void recordAbruptExit()
      Record the fact that an abrupt exit has been observed, one of: - potential exception (incl. unchecked exceptions) - break - continue - return
    • recordBreakFrom

      public void recordBreakFrom(FlowInfo flowInfo)
    • recordBreakTo

      public void recordBreakTo(FlowContext targetContext)
    • recordContinueFrom

      public void recordContinueFrom(FlowContext innerFlowContext, FlowInfo flowInfo)
    • recordExitAgainstResource

      public boolean recordExitAgainstResource(BlockScope scope, FlowInfo flowInfo, FakedTrackingVariable trackingVar, ASTNode reference)
      Record that we found an early exit from a method while a resource is in scope.
      Parameter:
      scope - enclosing scope
      flowInfo - flowInfo at the point of the early exit
      trackingVar - representation of the resource
      reference - the return or throw statement marking the early exit
      Gibt zurück:
      true if the situation has been handled by this flow context.
    • recordProvidedExpectedTypes

      protected void recordProvidedExpectedTypes(TypeBinding providedType, TypeBinding expectedType, int nullCount)
    • recordFinalAssignment

      protected boolean recordFinalAssignment(VariableBinding variable, Reference finalReference)
    • recordNullReference

      protected final void recordNullReference(LocalVariableBinding local, ASTNode location, int checkType, FlowInfo nullInfo)
      Record a null reference for use by deferred checks. Only looping or finally contexts really record that information. Other contexts immediately check for unboxing.
      Parameter:
      local - the local variable involved in the check
      location - the location triggering the analysis, for normal null dereference this is an expression resolving to 'local', for resource leaks it is an early exit statement.
      checkType - the checkType against which the check must be performed; one of CAN_ONLY_NULL, CAN_ONLY_NULL_NON_NULL, MAY_NULL, CAN_ONLY_NON_NULL, potentially combined with a context indicator (one of IN_COMPARISON_NULL, IN_COMPARISON_NON_NULL, IN_ASSIGNMENT or IN_INSTANCEOF).
      Alternatively, a IN_UNBOXING check can e requested.
      nullInfo - the null flow info observed at this first visit of location.
    • recordNullReferenceWithAnnotationStatus

      protected void recordNullReferenceWithAnnotationStatus(LocalVariableBinding local, ASTNode location, int checkType, FlowInfo nullInfo, NullAnnotationMatching nullAnnotationStatus)
      Record a null reference for use by deferred checks. Only looping or finally contexts really record that information. Other contexts immediately check for unboxing.
      Parameter:
      local - the local variable involved in the check
      location - the location triggering the analysis, for normal null dereference this is an expression resolving to 'local', for resource leaks it is an early exit statement.
      checkType - the checkType against which the check must be performed; one of CAN_ONLY_NULL, CAN_ONLY_NULL_NON_NULL, MAY_NULL, CAN_ONLY_NON_NULL, potentially combined with a context indicator (one of IN_COMPARISON_NULL, IN_COMPARISON_NON_NULL, IN_ASSIGNMENT or IN_INSTANCEOF).
      Alternatively, a IN_UNBOXING check can e requested.
      nullInfo - the null flow info observed at this first visit of location.
      nullAnnotationStatus - if null annotations are analysed this may hold more information about the exact kind of problem, can be null
    • recordUnboxing

      public void recordUnboxing(Scope scope, Expression expression, int nullStatus, FlowInfo flowInfo)
      Either AST analysis or checking of a child flow context has encountered an unboxing situation. Record this fact for handling at an appropriate point in time.
      Parameter:
      nullStatus - the status as we know it so far.
    • checkUnboxing

      protected void checkUnboxing(Scope scope, Expression expression, FlowInfo flowInfo)
      During deferred checking re-visit a previously recording unboxing situation.
    • recordReturnFrom

      public void recordReturnFrom(UnconditionalFlowInfo flowInfo)
    • recordSettingFinal

      public void recordSettingFinal(VariableBinding variable, Reference finalReference, FlowInfo flowInfo)
    • recordUsingNullReference

      public void recordUsingNullReference(Scope scope, LocalVariableBinding local, ASTNode location, int checkType, FlowInfo flowInfo)
      Record a null reference for use by deferred checks. Only looping or finally contexts really record that information. The context may emit an error immediately depending on the status of local against flowInfo and its nature (only looping of finally contexts defer part of the checks; nonetheless, contexts that are nested into a looping or a finally context get affected and delegate some checks to their enclosing context).
      Parameter:
      scope - the scope into which the check is performed
      local - the local variable involved in the check
      location - the location triggering the analysis, for normal null dereference this is an expression resolving to 'local', for resource leaks it is an early exit statement.
      checkType - the status against which the check must be performed; one of CAN_ONLY_NULL, CAN_ONLY_NULL_NON_NULL, MAY_NULL, potentially combined with a context indicator (one of IN_COMPARISON_NULL, IN_COMPARISON_NON_NULL, IN_ASSIGNMENT or IN_INSTANCEOF) and a bit to indicate whether the reference is being recorded inside an assert, HIDE_NULL_COMPARISON_WARNING
      flowInfo - the flow info at the check point; deferring contexts will perform supplementary checks against flow info instances that cannot be known at the time of calling this method (they are influenced by code that follows the current point)
    • subroutine

      public SubRoutineStatement subroutine()
    • toString

      public String toString()
      Setzt außer Kraft:
      toString in Klasse Object
    • recordNullityMismatch

      public void recordNullityMismatch(BlockScope currentScope, Expression expression, TypeBinding providedType, TypeBinding expectedType, FlowInfo flowInfo, int nullStatus, NullAnnotationMatching annotationStatus)
      Record that a nullity mismatch was detected against an annotated type reference.
      Parameter:
      currentScope - scope for error reporting
      expression - the expression violating the specification
      providedType - the type of the provided value, i.e., either expression or an element thereof (in ForeachStatements)
      expectedType - the declared type of the spec'ed variable, for error reporting.
      flowInfo - the flowInfo observed when visiting expression
      nullStatus - the null status of expression at the current location
      annotationStatus - status from type annotation analysis, or null
    • internalRecordNullityMismatch

      protected boolean internalRecordNullityMismatch(Expression expression, TypeBinding providedType, FlowInfo flowInfo, int nullStatus, NullAnnotationMatching nullAnnotationStatus, TypeBinding expectedType, int checkType)