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

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

public class UnconditionalFlowInfo
extends FlowInfo

Record initialization status during definite assignment analysis No caching of pre-allocated instances.


Nested Class Summary
static class UnconditionalFlowInfo.AssertionFailedException
          Exception raised when unexpected behavior is detected during coverage tests.
 
Field Summary
static int BitCacheSize
           
static boolean coverageTestFlag
           
static int coverageTestId
           
 long definiteInits
           
 long[][] extra
           
static int extraLength
           
 int maxFieldCount
           
 long nullBit1
           
 long nullBit2
           
 long nullBit3
           
 long nullBit4
           
 long potentialInits
           
 
Fields inherited from class org.eclipse.jdt.internal.compiler.flow.FlowInfo
DEAD_END, NON_NULL, NULL, NULL_FLAG_MASK, REACHABLE, tagBits, UNKNOWN, UNREACHABLE
 
Constructor Summary
UnconditionalFlowInfo()
           
 
Method Summary
 FlowInfo addInitializationsFrom(FlowInfo inits)
          Add other inits to this flow info, then return this.
 FlowInfo addPotentialInitializationsFrom(FlowInfo inits)
          Compose other inits over this flow info, then return this.
 UnconditionalFlowInfo addPotentialNullInfoFrom(UnconditionalFlowInfo otherInits)
          Compose other inits over this flow info, then return this.
 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.
 FlowInfo copy()
          Return a deep copy of the current instance.
 UnconditionalFlowInfo discardInitializationInfo()
          Discard definite inits and potential inits from this, then return this.
 UnconditionalFlowInfo discardNonFieldInitializations()
          Remove local variables information from this flow info and return this.
 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.
 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.
 boolean isDefinitelyAssigned(FieldBinding field)
          Check status of definite assignment for a field.
 boolean isDefinitelyAssigned(LocalVariableBinding local)
          Check status of definite assignment for a local.
 boolean isDefinitelyNonNull(LocalVariableBinding local)
          Check status of definite non-null value for a given local variable.
 boolean isDefinitelyNull(LocalVariableBinding local)
          Check status of definite null value for a given local variable.
 boolean isDefinitelyUnknown(LocalVariableBinding local)
          Check status of definite unknown value for a given local variable.
 boolean isPotentiallyAssigned(FieldBinding field)
          Check status of potential assignment for a field.
 boolean isPotentiallyAssigned(LocalVariableBinding local)
          Check status of potential assignment for a local variable.
 boolean isPotentiallyNonNull(LocalVariableBinding local)
          Check status of potential null assignment for a local.
 boolean isPotentiallyNull(LocalVariableBinding local)
          Check status of potential null assignment for a local.
 boolean isPotentiallyUnknown(LocalVariableBinding local)
          Return true if the given local may have been assigned to an unknown value.
 boolean isProtectedNonNull(LocalVariableBinding local)
          Return true if the given local is protected by a test against a non null value.
 boolean isProtectedNull(LocalVariableBinding local)
          Return true if the given local is protected by a test against null.
 void markAsComparedEqualToNonNull(LocalVariableBinding local)
          Record that a local variable got checked to be non null.
 void markAsComparedEqualToNull(LocalVariableBinding local)
          Record that a local variable got checked to be null.
 void markAsDefinitelyAssigned(FieldBinding field)
          Record a field got definitely assigned.
 void markAsDefinitelyAssigned(LocalVariableBinding local)
          Record a local got definitely assigned.
 void markAsDefinitelyNonNull(LocalVariableBinding local)
          Record a local got definitely assigned to a non-null value.
 void markAsDefinitelyNull(LocalVariableBinding local)
          Record a local got definitely assigned to null.
 void markAsDefinitelyUnknown(LocalVariableBinding local)
          Mark a local as having been assigned to an unknown value.
 void markAsPotentiallyNull(LocalVariableBinding local)
          Record a local got definitely assigned to a possibly null value.
 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).
 UnconditionalFlowInfo nullInfoLessUnconditionalCopy()
          Return a copy of this unconditional flow info, deprived from its null info.
 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.
 FlowInfo setReachMode(int reachMode)
          Set this flow info reach mode and return this.
 java.lang.String toString()
           
 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.
 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.
 UnconditionalFlowInfo unconditionalInits()
          Return a flow info that merges the possible paths of execution described by this flow info.
 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 org.eclipse.jdt.internal.compiler.flow.FlowInfo
asNegatedCondition, conditional, initial, mergedOptimizedBranches, reachMode
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

coverageTestFlag

public static final boolean coverageTestFlag
See Also:
Constant Field Values

coverageTestId

public static int coverageTestId

definiteInits

public long definiteInits

potentialInits

public long potentialInits

nullBit1

public long nullBit1

nullBit2

public long nullBit2

nullBit3

public long nullBit3

nullBit4

public long nullBit4

extraLength

public static final int extraLength
See Also:
Constant Field Values

extra

public long[][] extra

maxFieldCount

public int maxFieldCount

BitCacheSize

public static final int BitCacheSize
See Also:
Constant Field Values
Constructor Detail

UnconditionalFlowInfo

public UnconditionalFlowInfo()
Method Detail

addInitializationsFrom

public FlowInfo addInitializationsFrom(FlowInfo inits)
Description copied from class: FlowInfo
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.

Specified by:
addInitializationsFrom in class FlowInfo
Parameters:
inits - other inits to add to this
Returns:
this, modified according to otherInits information

addPotentialInitializationsFrom

public FlowInfo addPotentialInitializationsFrom(FlowInfo inits)
Description copied from class: FlowInfo
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.

Specified by:
addPotentialInitializationsFrom in class FlowInfo
Parameters:
inits - other inits to compose over this
Returns:
this, modified according to otherInits information

addPotentialNullInfoFrom

public UnconditionalFlowInfo addPotentialNullInfoFrom(UnconditionalFlowInfo otherInits)
Compose other inits over this flow info, then return this. The operation semantics are to wave into this flow info the consequences upon null information 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; moreover, only the null information is affected.

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

cannotBeDefinitelyNullOrNonNull

public final boolean cannotBeDefinitelyNullOrNonNull(LocalVariableBinding local)
Description copied from class: FlowInfo
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).

Overrides:
cannotBeDefinitelyNullOrNonNull in class FlowInfo
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 final boolean cannotBeNull(LocalVariableBinding local)
Description copied from class: FlowInfo
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.

Overrides:
cannotBeNull in class FlowInfo
Parameters:
local - the variable to ckeck
Returns:
true iff local cannot be null for this flow info

canOnlyBeNull

public final boolean canOnlyBeNull(LocalVariableBinding local)
Description copied from class: FlowInfo
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.

Overrides:
canOnlyBeNull in class FlowInfo
Parameters:
local - the variable to ckeck
Returns:
true iff local can only be null for this flow info

copy

public FlowInfo copy()
Description copied from class: FlowInfo
Return a deep copy of the current instance.

Specified by:
copy in class FlowInfo
Returns:
a deep copy of this flow info

discardInitializationInfo

public UnconditionalFlowInfo discardInitializationInfo()
Discard definite inits and potential inits from this, then return this. The returned flow info only holds null related information.

Returns:
this flow info, minus definite inits and potential inits

discardNonFieldInitializations

public UnconditionalFlowInfo discardNonFieldInitializations()
Remove local variables information from this flow info and return this.

Returns:
this, deprived from any local variable information

initsWhenFalse

public FlowInfo initsWhenFalse()
Description copied from class: FlowInfo
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).

Specified by:
initsWhenFalse in class FlowInfo
Returns:
the flow info associated to the false branch of the condition that generated this flow info

initsWhenTrue

public FlowInfo initsWhenTrue()
Description copied from class: FlowInfo
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).

Specified by:
initsWhenTrue in class FlowInfo
Returns:
the flow info associated to the true branch of the condition that generated this flow info

isDefinitelyAssigned

public final boolean isDefinitelyAssigned(FieldBinding field)
Description copied from class: FlowInfo
Check status of definite assignment for a field.

Specified by:
isDefinitelyAssigned in class FlowInfo

isDefinitelyAssigned

public final boolean isDefinitelyAssigned(LocalVariableBinding local)
Description copied from class: FlowInfo
Check status of definite assignment for a local.

Specified by:
isDefinitelyAssigned in class FlowInfo

isDefinitelyNonNull

public final boolean isDefinitelyNonNull(LocalVariableBinding local)
Description copied from class: FlowInfo
Check status of definite non-null value for a given local variable.

Specified by:
isDefinitelyNonNull in class FlowInfo
Parameters:
local - the variable to ckeck
Returns:
true iff local is definitely non null for this flow info

isDefinitelyNull

public final boolean isDefinitelyNull(LocalVariableBinding local)
Description copied from class: FlowInfo
Check status of definite null value for a given local variable.

Specified by:
isDefinitelyNull in class FlowInfo
Parameters:
local - the variable to ckeck
Returns:
true iff local is definitely null for this flow info

isDefinitelyUnknown

public final boolean isDefinitelyUnknown(LocalVariableBinding local)
Description copied from class: FlowInfo
Check status of definite unknown value for a given local variable.

Specified by:
isDefinitelyUnknown in class FlowInfo
Parameters:
local - the variable to ckeck
Returns:
true iff local is definitely unknown for this flow info

isPotentiallyAssigned

public final boolean isPotentiallyAssigned(FieldBinding field)
Description copied from class: FlowInfo
Check status of potential assignment for a field.

Specified by:
isPotentiallyAssigned in class FlowInfo

isPotentiallyAssigned

public final boolean isPotentiallyAssigned(LocalVariableBinding local)
Description copied from class: FlowInfo
Check status of potential assignment for a local variable.

Specified by:
isPotentiallyAssigned in class FlowInfo

isPotentiallyNonNull

public final boolean isPotentiallyNonNull(LocalVariableBinding local)
Description copied from class: FlowInfo
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.

Specified by:
isPotentiallyNonNull in class FlowInfo
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 final boolean isPotentiallyNull(LocalVariableBinding local)
Description copied from class: FlowInfo
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

Specified by:
isPotentiallyNull in class FlowInfo
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 final boolean isPotentiallyUnknown(LocalVariableBinding local)
Description copied from class: FlowInfo
Return true if the given local may have been assigned to an unknown value.

Specified by:
isPotentiallyUnknown in class FlowInfo
Parameters:
local - the local to check
Returns:
true if the given local may have been assigned to an unknown value

isProtectedNonNull

public final boolean isProtectedNonNull(LocalVariableBinding local)
Description copied from class: FlowInfo
Return true if the given local is protected by a test against a non null value.

Specified by:
isProtectedNonNull in class FlowInfo
Parameters:
local - the local to check
Returns:
true if the given local is protected by a test against a non null

isProtectedNull

public final boolean isProtectedNull(LocalVariableBinding local)
Description copied from class: FlowInfo
Return true if the given local is protected by a test against null.

Specified by:
isProtectedNull in class FlowInfo
Parameters:
local - the local to check
Returns:
true if the given local is protected by a test against null

markAsComparedEqualToNonNull

public void markAsComparedEqualToNonNull(LocalVariableBinding local)
Description copied from class: FlowInfo
Record that a local variable got checked to be non null.

Specified by:
markAsComparedEqualToNonNull in class FlowInfo
Parameters:
local - the checked local variable

markAsComparedEqualToNull

public void markAsComparedEqualToNull(LocalVariableBinding local)
Description copied from class: FlowInfo
Record that a local variable got checked to be null.

Specified by:
markAsComparedEqualToNull in class FlowInfo
Parameters:
local - the checked local variable

markAsDefinitelyAssigned

public void markAsDefinitelyAssigned(FieldBinding field)
Description copied from class: FlowInfo
Record a field got definitely assigned.

Specified by:
markAsDefinitelyAssigned in class FlowInfo

markAsDefinitelyAssigned

public void markAsDefinitelyAssigned(LocalVariableBinding local)
Description copied from class: FlowInfo
Record a local got definitely assigned.

Specified by:
markAsDefinitelyAssigned in class FlowInfo

markAsDefinitelyNonNull

public void markAsDefinitelyNonNull(LocalVariableBinding local)
Description copied from class: FlowInfo
Record a local got definitely assigned to a non-null value.

Specified by:
markAsDefinitelyNonNull in class FlowInfo

markAsDefinitelyNull

public void markAsDefinitelyNull(LocalVariableBinding local)
Description copied from class: FlowInfo
Record a local got definitely assigned to null.

Specified by:
markAsDefinitelyNull in class FlowInfo

markAsDefinitelyUnknown

public void markAsDefinitelyUnknown(LocalVariableBinding local)
Mark a local as having been assigned to an unknown value.

Specified by:
markAsDefinitelyUnknown in class FlowInfo
Parameters:
local - the local to mark

mergedWith

public UnconditionalFlowInfo mergedWith(UnconditionalFlowInfo otherInits)
Description copied from class: FlowInfo
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).

Specified by:
mergedWith in class FlowInfo
Parameters:
otherInits - the flow info to merge with this
Returns:
the intersection of this and otherInits.

nullInfoLessUnconditionalCopy

public UnconditionalFlowInfo nullInfoLessUnconditionalCopy()
Description copied from class: FlowInfo
Return a copy of this unconditional flow info, deprived from its null info. DEAD_END is returned unmodified.

Specified by:
nullInfoLessUnconditionalCopy in class FlowInfo
Returns:
a copy of this unconditional flow info deprived from its null info

safeInitsWhenTrue

public FlowInfo safeInitsWhenTrue()
Description copied from class: FlowInfo
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.

Specified by:
safeInitsWhenTrue in class FlowInfo
Returns:
the result of initsWhenTrue or a copy of it

setReachMode

public FlowInfo setReachMode(int reachMode)
Description copied from class: FlowInfo
Set this flow info reach mode and return this.

Specified by:
setReachMode in class FlowInfo
Parameters:
reachMode - one of REACHABLE or UNREACHABLE
Returns:
this, with the reach mode set to reachMode

toString

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

unconditionalCopy

public UnconditionalFlowInfo unconditionalCopy()
Description copied from class: FlowInfo
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.

Specified by:
unconditionalCopy in class FlowInfo
Returns:
a new flow info carrying this unconditional flow info

unconditionalFieldLessCopy

public UnconditionalFlowInfo unconditionalFieldLessCopy()
Description copied from class: FlowInfo
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.

Specified by:
unconditionalFieldLessCopy in class FlowInfo
Returns:
a new flow info carrying the unconditional flow info for local variables

unconditionalInits

public UnconditionalFlowInfo unconditionalInits()
Description copied from class: FlowInfo
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.

Specified by:
unconditionalInits in class FlowInfo
Returns:
a flow info that merges the possible paths of execution described by this

unconditionalInitsWithoutSideEffect

public UnconditionalFlowInfo unconditionalInitsWithoutSideEffect()
Description copied from class: FlowInfo
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).

Specified by:
unconditionalInitsWithoutSideEffect in class FlowInfo
Returns:
a flow info carrying this unconditional flow info

markAsPotentiallyNull

public void markAsPotentiallyNull(LocalVariableBinding local)
Description copied from class: FlowInfo
Record a local got definitely assigned to a possibly null value.

Specified by:
markAsPotentiallyNull in class FlowInfo