org.eclipse.jdt.internal.compiler.flow
Class FlowInfo

java.lang.Object
  extended by org.eclipse.jdt.internal.compiler.flow.FlowInfo
Direct Known Subclasses:
ConditionalFlowInfo, UnconditionalFlowInfo

public abstract class FlowInfo
extends java.lang.Object


Field Summary
static UnconditionalFlowInfo DEAD_END
           
static int NON_NULL
           
static int NULL
           
static int NULL_FLAG_MASK
           
static int REACHABLE
           
 int tagBits
           
static int UNKNOWN
           
static int UNREACHABLE
           
 
Constructor Summary
FlowInfo()
           
 
Method Summary
abstract  FlowInfo addInitializationsFrom(FlowInfo otherInits)
          Add other inits to this flow info, then return this.
abstract  FlowInfo addPotentialInitializationsFrom(FlowInfo otherInits)
          Compose other inits over this flow info, then return this.
 FlowInfo asNegatedCondition()
           
 boolean cannotBeDefinitelyNullOrNonNull(LocalVariableBinding local)
          Check whether a given local variable is known to be unable to gain a definite non null or definite null status by the use of an enclosing flow info.
 boolean cannotBeNull(LocalVariableBinding local)
          Check whether a given local variable is known to be non null, either because it is definitely non null, or because is has been tested against non null.
 boolean canOnlyBeNull(LocalVariableBinding local)
          Check whether a given local variable is known to be null, either because it is definitely null, or because is has been tested against null.
static FlowInfo conditional(FlowInfo initsWhenTrue, FlowInfo initsWhenFalse)
           
abstract  FlowInfo copy()
          Return a deep copy of the current instance.
static UnconditionalFlowInfo initial(int maxFieldCount)
           
abstract  FlowInfo initsWhenFalse()
          Return the flow info that would result from the path associated to the value false for the condition expression that generated this flow info.
abstract  FlowInfo initsWhenTrue()
          Return the flow info that would result from the path associated to the value true for the condition expression that generated this flow info.
abstract  boolean isDefinitelyAssigned(FieldBinding field)
          Check status of definite assignment for a field.
abstract  boolean isDefinitelyAssigned(LocalVariableBinding local)
          Check status of definite assignment for a local.
abstract  boolean isDefinitelyNonNull(LocalVariableBinding local)
          Check status of definite non-null value for a given local variable.
abstract  boolean isDefinitelyNull(LocalVariableBinding local)
          Check status of definite null value for a given local variable.
abstract  boolean isDefinitelyUnknown(LocalVariableBinding local)
          Check status of definite unknown value for a given local variable.
abstract  boolean isPotentiallyAssigned(FieldBinding field)
          Check status of potential assignment for a field.
abstract  boolean isPotentiallyAssigned(LocalVariableBinding field)
          Check status of potential assignment for a local variable.
abstract  boolean isPotentiallyNonNull(LocalVariableBinding local)
          Check status of potential null assignment for a local.
abstract  boolean isPotentiallyNull(LocalVariableBinding local)
          Check status of potential null assignment for a local.
abstract  boolean isPotentiallyUnknown(LocalVariableBinding local)
          Return true if the given local may have been assigned to an unknown value.
abstract  boolean isProtectedNonNull(LocalVariableBinding local)
          Return true if the given local is protected by a test against a non null value.
abstract  boolean isProtectedNull(LocalVariableBinding local)
          Return true if the given local is protected by a test against null.
abstract  void markAsComparedEqualToNonNull(LocalVariableBinding local)
          Record that a local variable got checked to be non null.
abstract  void markAsComparedEqualToNull(LocalVariableBinding local)
          Record that a local variable got checked to be null.
abstract  void markAsDefinitelyAssigned(FieldBinding field)
          Record a field got definitely assigned.
abstract  void markAsDefinitelyAssigned(LocalVariableBinding local)
          Record a local got definitely assigned.
abstract  void markAsDefinitelyNonNull(LocalVariableBinding local)
          Record a local got definitely assigned to a non-null value.
abstract  void markAsDefinitelyNull(LocalVariableBinding local)
          Record a local got definitely assigned to null.
abstract  void markAsDefinitelyUnknown(LocalVariableBinding local)
          Record a local got definitely assigned to an unknown value.
abstract  void markAsPotentiallyNull(LocalVariableBinding local)
          Record a local got definitely assigned to a possibly null value.
static UnconditionalFlowInfo mergedOptimizedBranches(FlowInfo initsWhenTrue, boolean isOptimizedTrue, FlowInfo initsWhenFalse, boolean isOptimizedFalse, boolean allowFakeDeadBranch)
          Merge branches using optimized boolean conditions
abstract  UnconditionalFlowInfo mergedWith(UnconditionalFlowInfo otherInits)
          Return the intersection of this and otherInits, that is one of: the receiver updated in the following way: intersection of definitely assigned variables, union of potentially assigned variables, similar operations for null, or the receiver or otherInits if the other one is non reachable. otherInits is not affected, and is not returned either (no need to protect the result).
abstract  UnconditionalFlowInfo nullInfoLessUnconditionalCopy()
          Return a copy of this unconditional flow info, deprived from its null info.
 int reachMode()
          Return REACHABLE if this flow info is reachable, UNREACHABLE else.
abstract  FlowInfo safeInitsWhenTrue()
          Return a flow info that carries the same information as the result of initsWhenTrue, but warrantied to be different from this.
Caveat: side effects on the result may affect components of this.
abstract  FlowInfo setReachMode(int reachMode)
          Set this flow info reach mode and return this.
 java.lang.String toString()
           
abstract  UnconditionalFlowInfo unconditionalCopy()
          Return a new flow info that holds the same information as this would after a call to unconditionalInits, but leaving this info unaffected.
abstract  UnconditionalFlowInfo unconditionalFieldLessCopy()
          Return a new flow info that holds the same information as this would after a call to unconditionalInits followed by the erasure of fields specific information, but leaving this flow info unaffected.
abstract  UnconditionalFlowInfo unconditionalInits()
          Return a flow info that merges the possible paths of execution described by this flow info.
abstract  UnconditionalFlowInfo unconditionalInitsWithoutSideEffect()
          Return a new flow info that holds the same information as this would after a call to unconditionalInits, but leaving this info unaffected.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

tagBits

public int tagBits

REACHABLE

public static final int REACHABLE
See Also:
Constant Field Values

UNREACHABLE

public static final int UNREACHABLE
See Also:
Constant Field Values

NULL_FLAG_MASK

public static final int NULL_FLAG_MASK
See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
See Also:
Constant Field Values

NULL

public static final int NULL
See Also:
Constant Field Values

NON_NULL

public static final int NON_NULL
See Also:
Constant Field Values

DEAD_END

public static final UnconditionalFlowInfo DEAD_END
Constructor Detail

FlowInfo

public FlowInfo()
Method Detail

addInitializationsFrom

public abstract FlowInfo addInitializationsFrom(FlowInfo otherInits)
Add other inits to this flow info, then return this. The operation semantics are to match as closely as possible the application to this flow info of all the operations that resulted into otherInits.

Parameters:
otherInits - other inits to add to this
Returns:
this, modified according to otherInits information

addPotentialInitializationsFrom

public abstract FlowInfo addPotentialInitializationsFrom(FlowInfo otherInits)
Compose other inits over this flow info, then return this. The operation semantics are to wave into this flow info the consequences of a possible path into the operations that resulted into otherInits. The fact that this path may be left unexecuted under peculiar conditions results into less specific results than addInitializationsFrom.

Parameters:
otherInits - other inits to compose over this
Returns:
this, modified according to otherInits information

asNegatedCondition

public FlowInfo asNegatedCondition()

conditional

public static FlowInfo conditional(FlowInfo initsWhenTrue,
                                   FlowInfo initsWhenFalse)

cannotBeDefinitelyNullOrNonNull

public boolean cannotBeDefinitelyNullOrNonNull(LocalVariableBinding local)
Check whether a given local variable is known to be unable to gain a definite non null or definite null status by the use of an enclosing flow info. The semantics are that if the current flow info marks the variable as potentially unknown or else as being both potentially null and potentially non null, then it won't ever be promoted as definitely null or definitely non null. (It could still get promoted to definite unknown).

Parameters:
local - the variable to ckeck
Returns:
true iff this flow info prevents local from being promoted to definite non null or definite null against an enclosing flow info

cannotBeNull

public boolean cannotBeNull(LocalVariableBinding local)
Check whether a given local variable is known to be non null, either because it is definitely non null, or because is has been tested against non null.

Parameters:
local - the variable to ckeck
Returns:
true iff local cannot be null for this flow info

canOnlyBeNull

public boolean canOnlyBeNull(LocalVariableBinding local)
Check whether a given local variable is known to be null, either because it is definitely null, or because is has been tested against null.

Parameters:
local - the variable to ckeck
Returns:
true iff local can only be null for this flow info

copy

public abstract FlowInfo copy()
Return a deep copy of the current instance.

Returns:
a deep copy of this flow info

initial

public static UnconditionalFlowInfo initial(int maxFieldCount)

initsWhenFalse

public abstract FlowInfo initsWhenFalse()
Return the flow info that would result from the path associated to the value false for the condition expression that generated this flow info. May be this flow info if it is not an instance of ConditionalFlowInfo. May have a side effect on subparts of this flow info (subtrees get merged).

Returns:
the flow info associated to the false branch of the condition that generated this flow info

initsWhenTrue

public abstract FlowInfo initsWhenTrue()
Return the flow info that would result from the path associated to the value true for the condition expression that generated this flow info. May be this flow info if it is not an instance of ConditionalFlowInfo. May have a side effect on subparts of this flow info (subtrees get merged).

Returns:
the flow info associated to the true branch of the condition that generated this flow info

isDefinitelyAssigned

public abstract boolean isDefinitelyAssigned(FieldBinding field)
Check status of definite assignment for a field.


isDefinitelyAssigned

public abstract boolean isDefinitelyAssigned(LocalVariableBinding local)
Check status of definite assignment for a local.


isDefinitelyNonNull

public abstract boolean isDefinitelyNonNull(LocalVariableBinding local)
Check status of definite non-null value for a given local variable.

Parameters:
local - the variable to ckeck
Returns:
true iff local is definitely non null for this flow info

isDefinitelyNull

public abstract boolean isDefinitelyNull(LocalVariableBinding local)
Check status of definite null value for a given local variable.

Parameters:
local - the variable to ckeck
Returns:
true iff local is definitely null for this flow info

isDefinitelyUnknown

public abstract boolean isDefinitelyUnknown(LocalVariableBinding local)
Check status of definite unknown value for a given local variable.

Parameters:
local - the variable to ckeck
Returns:
true iff local is definitely unknown for this flow info

isPotentiallyAssigned

public abstract boolean isPotentiallyAssigned(FieldBinding field)
Check status of potential assignment for a field.


isPotentiallyAssigned

public abstract boolean isPotentiallyAssigned(LocalVariableBinding field)
Check status of potential assignment for a local variable.


isPotentiallyNonNull

public abstract boolean isPotentiallyNonNull(LocalVariableBinding local)
Check status of potential null assignment for a local. Return true if there is a reasonable expectation that the variable be non null at this point.

Parameters:
local - LocalVariableBinding - the binding for the checked local
Returns:
true if there is a reasonable expectation that local be non null at this point

isPotentiallyNull

public abstract boolean isPotentiallyNull(LocalVariableBinding local)
Check status of potential null assignment for a local. Return true if there is a reasonable expectation that the variable be null at this point. This includes the protected null case, so as to augment diagnostics, but does not really check that someone deliberately assigned to null on any specific path

Parameters:
local - LocalVariableBinding - the binding for the checked local
Returns:
true if there is a reasonable expectation that local be null at this point

isPotentiallyUnknown

public abstract boolean isPotentiallyUnknown(LocalVariableBinding local)
Return true if the given local may have been assigned to an unknown value.

Parameters:
local - the local to check
Returns:
true if the given local may have been assigned to an unknown value

isProtectedNonNull

public abstract boolean isProtectedNonNull(LocalVariableBinding local)
Return true if the given local is protected by a test against a non null value.

Parameters:
local - the local to check
Returns:
true if the given local is protected by a test against a non null

isProtectedNull

public abstract boolean isProtectedNull(LocalVariableBinding local)
Return true if the given local is protected by a test against null.

Parameters:
local - the local to check
Returns:
true if the given local is protected by a test against null

markAsComparedEqualToNonNull

public abstract void markAsComparedEqualToNonNull(LocalVariableBinding local)
Record that a local variable got checked to be non null.

Parameters:
local - the checked local variable

markAsComparedEqualToNull

public abstract void markAsComparedEqualToNull(LocalVariableBinding local)
Record that a local variable got checked to be null.

Parameters:
local - the checked local variable

markAsDefinitelyAssigned

public abstract void markAsDefinitelyAssigned(FieldBinding field)
Record a field got definitely assigned.


markAsDefinitelyNonNull

public abstract void markAsDefinitelyNonNull(LocalVariableBinding local)
Record a local got definitely assigned to a non-null value.


markAsDefinitelyNull

public abstract void markAsDefinitelyNull(LocalVariableBinding local)
Record a local got definitely assigned to null.


markAsDefinitelyAssigned

public abstract void markAsDefinitelyAssigned(LocalVariableBinding local)
Record a local got definitely assigned.


markAsDefinitelyUnknown

public abstract void markAsDefinitelyUnknown(LocalVariableBinding local)
Record a local got definitely assigned to an unknown value.


markAsPotentiallyNull

public abstract void markAsPotentiallyNull(LocalVariableBinding local)
Record a local got definitely assigned to a possibly null value.


mergedOptimizedBranches

public static UnconditionalFlowInfo mergedOptimizedBranches(FlowInfo initsWhenTrue,
                                                            boolean isOptimizedTrue,
                                                            FlowInfo initsWhenFalse,
                                                            boolean isOptimizedFalse,
                                                            boolean allowFakeDeadBranch)
Merge branches using optimized boolean conditions


reachMode

public int reachMode()
Return REACHABLE if this flow info is reachable, UNREACHABLE else.

Returns:
REACHABLE if this flow info is reachable, UNREACHABLE else

safeInitsWhenTrue

public abstract FlowInfo safeInitsWhenTrue()
Return a flow info that carries the same information as the result of initsWhenTrue, but warrantied to be different from this.
Caveat: side effects on the result may affect components of this.

Returns:
the result of initsWhenTrue or a copy of it

setReachMode

public abstract FlowInfo setReachMode(int reachMode)
Set this flow info reach mode and return this.

Parameters:
reachMode - one of REACHABLE or UNREACHABLE
Returns:
this, with the reach mode set to reachMode

mergedWith

public abstract UnconditionalFlowInfo mergedWith(UnconditionalFlowInfo otherInits)
Return the intersection of this and otherInits, that is one of: otherInits is not affected, and is not returned either (no need to protect the result).

Parameters:
otherInits - the flow info to merge with this
Returns:
the intersection of this and otherInits.

nullInfoLessUnconditionalCopy

public abstract UnconditionalFlowInfo nullInfoLessUnconditionalCopy()
Return a copy of this unconditional flow info, deprived from its null info. DEAD_END is returned unmodified.

Returns:
a copy of this unconditional flow info deprived from its null info

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

unconditionalCopy

public abstract UnconditionalFlowInfo unconditionalCopy()
Return a new flow info that holds the same information as this would after a call to unconditionalInits, but leaving this info unaffected. Moreover, the result can be modified without affecting this.

Returns:
a new flow info carrying this unconditional flow info

unconditionalFieldLessCopy

public abstract UnconditionalFlowInfo unconditionalFieldLessCopy()
Return a new flow info that holds the same information as this would after a call to unconditionalInits followed by the erasure of fields specific information, but leaving this flow info unaffected.

Returns:
a new flow info carrying the unconditional flow info for local variables

unconditionalInits

public abstract UnconditionalFlowInfo unconditionalInits()
Return a flow info that merges the possible paths of execution described by this flow info. In case of an unconditional flow info, return this. In case of a conditional flow info, merge branches recursively. Caveat: this may be affected, and modifying the result may affect this.

Returns:
a flow info that merges the possible paths of execution described by this

unconditionalInitsWithoutSideEffect

public abstract UnconditionalFlowInfo unconditionalInitsWithoutSideEffect()
Return a new flow info that holds the same information as this would after a call to unconditionalInits, but leaving this info unaffected. Side effects on the result might affect this though (consider it as read only).

Returns:
a flow info carrying this unconditional flow info