public abstract class FlowInfo
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static UnconditionalFlowInfo |
DEAD_END |
static int |
NON_NULL |
static int |
NULL |
static int |
NULL_FLAG_MASK |
static int |
POTENTIALLY_NON_NULL |
static int |
POTENTIALLY_NULL |
static int |
POTENTIALLY_UNKNOWN |
static int |
REACHABLE |
int |
tagBits |
static int |
UNKNOWN |
static int |
UNREACHABLE |
static int |
UNREACHABLE_BY_NULLANALYSIS |
static int |
UNREACHABLE_OR_DEAD |
static int |
UNROOTED |
| Constructor and Description |
|---|
FlowInfo() |
| Modifier and Type | Method and Description |
|---|---|
abstract FlowInfo |
addInitializationsFrom(FlowInfo otherInits)
Add other inits to this flow info, then return this.
|
abstract FlowInfo |
addNullInfoFrom(FlowInfo otherInits)
Add all null information from otherInits to this flow info and 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.
|
abstract boolean |
hasNullInfoFor(LocalVariableBinding local)
Check if any null info has been recorded for a given local variable.
|
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.
|
void |
markNullStatus(LocalVariableBinding local,
int nullStatus)
Mark the null status of the given local according to the given status
|
abstract void |
markPotentiallyNonNullBit(LocalVariableBinding local)
Record a local may have got assigned to non-null (set the bit on existing info).
|
abstract void |
markPotentiallyNullBit(LocalVariableBinding local)
Record a local may have got assigned to null (set the bit on existing info).
|
abstract void |
markPotentiallyUnknownBit(LocalVariableBinding local)
Record a local may have got assigned to unknown (set the bit on existing info).
|
static UnconditionalFlowInfo |
mergedOptimizedBranches(FlowInfo initsWhenTrue,
boolean isOptimizedTrue,
FlowInfo initsWhenFalse,
boolean isOptimizedFalse,
boolean allowFakeDeadBranch)
Merge branches using optimized boolean conditions
|
static UnconditionalFlowInfo |
mergedOptimizedBranchesIfElse(FlowInfo initsWhenTrue,
boolean isOptimizedTrue,
FlowInfo initsWhenFalse,
boolean isOptimizedFalse,
boolean allowFakeDeadBranch,
FlowInfo flowInfo,
IfStatement ifStatement,
boolean reportDeadCodeInKnownPattern)
Merge if-else 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).
|
static int |
mergeNullStatus(int nullStatus1,
int nullStatus2)
Merge two single bits (NULL, NON_NULL, POTENTIALLY*..) into one.
|
abstract UnconditionalFlowInfo |
nullInfoLessUnconditionalCopy()
Return a copy of this unconditional flow info, deprived from its null
info.
|
int |
nullStatus(LocalVariableBinding local)
Answer the null status of the given local
|
int |
reachMode()
Find out the reachability mode of this flowInfo.
|
abstract void |
resetAssignmentInfo(LocalVariableBinding local)
Resets the definite and potential initialization info for the given local variable
|
abstract void |
resetNullInfo(LocalVariableBinding local)
Reset all null-information about a given local.
|
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.
|
static int |
tagBitsToNullStatus(long tagBits)
Check whether 'tagBits' contains either
TagBits.AnnotationNonNull or TagBits.AnnotationNullable,
and answer the corresponding null status (NON_NULL etc.). |
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. |
public int tagBits
public static final int REACHABLE
public static final int UNREACHABLE_OR_DEAD
public static final int UNREACHABLE_BY_NULLANALYSIS
public static final int UNREACHABLE
public static final int NULL_FLAG_MASK
public static final int UNKNOWN
public static final int NULL
public static final int NON_NULL
public static final int POTENTIALLY_UNKNOWN
public static final int POTENTIALLY_NULL
public static final int POTENTIALLY_NON_NULL
public static final int UNROOTED
public static final UnconditionalFlowInfo DEAD_END
public abstract FlowInfo addInitializationsFrom(FlowInfo otherInits)
otherInits - other inits to add to thispublic abstract FlowInfo addNullInfoFrom(FlowInfo otherInits)
public abstract FlowInfo addPotentialInitializationsFrom(FlowInfo otherInits)
addInitializationsFrom.otherInits - other inits to compose over thispublic FlowInfo asNegatedCondition()
public boolean cannotBeDefinitelyNullOrNonNull(LocalVariableBinding local)
local - the variable to checkpublic boolean cannotBeNull(LocalVariableBinding local)
local - the variable to ckeckpublic boolean canOnlyBeNull(LocalVariableBinding local)
local - the variable to ckeckpublic abstract FlowInfo copy()
public static UnconditionalFlowInfo initial(int maxFieldCount)
public abstract FlowInfo initsWhenFalse()
ConditionalFlowInfo. May have a side effect on subparts of this flow
info (subtrees get merged).public abstract FlowInfo initsWhenTrue()
ConditionalFlowInfo. May have a side effect on subparts of this flow
info (subtrees get merged).public abstract boolean isDefinitelyAssigned(FieldBinding field)
public abstract boolean isDefinitelyAssigned(LocalVariableBinding local)
public abstract boolean isDefinitelyNonNull(LocalVariableBinding local)
local - the variable to ckeckpublic abstract boolean isDefinitelyNull(LocalVariableBinding local)
local - the variable to ckeckpublic abstract boolean isDefinitelyUnknown(LocalVariableBinding local)
local - the variable to ckeckpublic abstract boolean hasNullInfoFor(LocalVariableBinding local)
public abstract boolean isPotentiallyAssigned(FieldBinding field)
public abstract boolean isPotentiallyAssigned(LocalVariableBinding field)
public abstract boolean isPotentiallyNonNull(LocalVariableBinding local)
local - LocalVariableBinding - the binding for the checked localpublic abstract boolean isPotentiallyNull(LocalVariableBinding local)
local - LocalVariableBinding - the binding for the checked localpublic abstract boolean isPotentiallyUnknown(LocalVariableBinding local)
local - the local to checkpublic abstract boolean isProtectedNonNull(LocalVariableBinding local)
local - the local to checkpublic abstract boolean isProtectedNull(LocalVariableBinding local)
local - the local to checkpublic abstract void markAsComparedEqualToNonNull(LocalVariableBinding local)
local - the checked local variablepublic abstract void markAsComparedEqualToNull(LocalVariableBinding local)
local - the checked local variablepublic abstract void markAsDefinitelyAssigned(FieldBinding field)
public abstract void markAsDefinitelyNonNull(LocalVariableBinding local)
public abstract void markAsDefinitelyNull(LocalVariableBinding local)
public abstract void resetNullInfo(LocalVariableBinding local)
public abstract void markPotentiallyUnknownBit(LocalVariableBinding local)
public abstract void markPotentiallyNullBit(LocalVariableBinding local)
public abstract void markPotentiallyNonNullBit(LocalVariableBinding local)
public abstract void markAsDefinitelyAssigned(LocalVariableBinding local)
public abstract void markAsDefinitelyUnknown(LocalVariableBinding local)
public void markNullStatus(LocalVariableBinding local, int nullStatus)
local - nullStatus - bitset of FLowInfo.UNKNOWN ... FlowInfo.POTENTIALLY_NON_NULLpublic int nullStatus(LocalVariableBinding local)
local - public static int mergeNullStatus(int nullStatus1,
int nullStatus2)
public static UnconditionalFlowInfo mergedOptimizedBranches(FlowInfo initsWhenTrue, boolean isOptimizedTrue, FlowInfo initsWhenFalse, boolean isOptimizedFalse, boolean allowFakeDeadBranch)
public static UnconditionalFlowInfo mergedOptimizedBranchesIfElse(FlowInfo initsWhenTrue, boolean isOptimizedTrue, FlowInfo initsWhenFalse, boolean isOptimizedFalse, boolean allowFakeDeadBranch, FlowInfo flowInfo, IfStatement ifStatement, boolean reportDeadCodeInKnownPattern)
public int reachMode()
public abstract FlowInfo safeInitsWhenTrue()
initsWhenTrue, but warrantied to be different
from this.public abstract FlowInfo setReachMode(int reachMode)
reachMode - one of REACHABLE, UNREACHABLE_OR_DEAD,
UNREACHABLE_BY_NULLANALYSIS or UNREACHABLEpublic abstract UnconditionalFlowInfo mergedWith(UnconditionalFlowInfo otherInits)
otherInits - the flow info to merge with thispublic abstract UnconditionalFlowInfo nullInfoLessUnconditionalCopy()
DEAD_END is returned unmodified.public java.lang.String toString()
toString in class java.lang.Objectpublic abstract UnconditionalFlowInfo unconditionalCopy()
public abstract UnconditionalFlowInfo unconditionalFieldLessCopy()
unconditionalInits followed by the
erasure of fields specific information, but leaving this flow info unaffected.public abstract UnconditionalFlowInfo unconditionalInits()
public abstract UnconditionalFlowInfo unconditionalInitsWithoutSideEffect()
unconditionalInits, but leaving
this info unaffected. Side effects on the result might affect this though
(consider it as read only).public abstract void resetAssignmentInfo(LocalVariableBinding local)
local - public static int tagBitsToNullStatus(long tagBits)
TagBits.AnnotationNonNull or TagBits.AnnotationNullable,
and answer the corresponding null status (NON_NULL etc.).