Class FlowInfo
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.flow.FlowInfo
- Direct Known Subclasses:
ConditionalFlowInfo,UnconditionalFlowInfo
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final UnconditionalFlowInfostatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intintstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract FlowInfoaddInitializationsFrom(FlowInfo otherInits) Add other inits to this flow info, then return this.abstract FlowInfoaddNullInfoFrom(FlowInfo otherInits) Add all null information from otherInits to this flow info and return this.abstract FlowInfoaddPotentialInitializationsFrom(FlowInfo otherInits) Compose other inits over this flow info, then return this.booleanCheck 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.booleancannotBeNull(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.booleanCheck 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 FlowInfoconditional(FlowInfo initsWhenTrue, FlowInfo initsWhenFalse) abstract FlowInfocopy()Return a deep copy of the current instance.abstract booleanCheck if any null info has been recorded for a given local variable.static UnconditionalFlowInfoinitial(int maxFieldCount) abstract FlowInfoReturn the flow info that would result from the path associated to the value false for the condition expression that generated this flow info.abstract FlowInfoReturn the flow info that would result from the path associated to the value true for the condition expression that generated this flow info.abstract booleanisDefinitelyAssigned(FieldBinding field) Check status of definite assignment for a field.abstract booleanCheck status of definite assignment for a local.abstract booleanCheck status of definite non-null value for a given local variable.abstract booleanCheck status of definite null value for a given local variable.abstract booleanCheck status of definite unknown value for a given local variable.abstract booleanCheck status of potential assignment for a field.abstract booleanCheck status of potential assignment for a local variable.abstract booleanCheck status of potential null assignment for a local.abstract booleanCheck status of potential null assignment for a local.abstract booleanReturn true if the given local may have been assigned to an unknown value.abstract booleanReturn true if the given local is protected by a test against a non null value.abstract booleanReturn true if the given local is protected by a test against null.abstract voidRecord that a local variable got checked to be non null.abstract voidRecord that a local variable got checked to be null.abstract voidRecord a field got definitely assigned.abstract voidRecord a local got definitely assigned.abstract voidRecord a local got definitely assigned to a non-null value.abstract voidRecord a local got definitely assigned to null.abstract voidRecord a local got definitely assigned to an unknown value.voidmarkNullStatus(LocalVariableBinding local, int nullStatus) Mark the null status of the given local according to the given statusabstract voidRecord a local may have got assigned to non-null (set the bit on existing info).abstract voidRecord a local may have got assigned to null (set the bit on existing info).abstract voidRecord a local may have got assigned to unknown (set the bit on existing info).abstract UnconditionalFlowInfomergeDefiniteInitsWith(UnconditionalFlowInfo otherInits) static UnconditionalFlowInfomergedOptimizedBranches(FlowInfo initsWhenTrue, boolean isOptimizedTrue, FlowInfo initsWhenFalse, boolean isOptimizedFalse, boolean allowFakeDeadBranch) Merge branches using optimized boolean conditionsstatic UnconditionalFlowInfomergedOptimizedBranchesIfElse(FlowInfo initsWhenTrue, boolean isOptimizedTrue, FlowInfo initsWhenFalse, boolean isOptimizedFalse, boolean allowFakeDeadBranch, FlowInfo flowInfo, IfStatement ifStatement, boolean reportDeadCodeInKnownPattern) Merge if-else branches using optimized boolean conditionsabstract UnconditionalFlowInfomergedWith(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 intmergeNullStatus(int nullStatus1, int nullStatus2) Merge two single bits (NULL, NON_NULL, POTENTIALLY*..) into one.abstract UnconditionalFlowInfoReturn a copy of this unconditional flow info, deprived from its null info.intnullStatus(LocalVariableBinding local) Answer the null status of the given localintFind out the reachability mode of this flowInfo.abstract voidResets the definite and potential initialization info for the given local variableabstract voidReset all null-information about a given local.abstract FlowInfoReturn a flow info that carries the same information as the result ofinitsWhenTrue, but warrantied to be different from this.
Caveat: side effects on the result may affect components of this.abstract FlowInfosetReachMode(int reachMode) Set this flow info reach mode and return this.static inttagBitsToNullStatus(long tagBits) Check whether 'tagBits' contains eitherTagBits.AnnotationNonNullorTagBits.AnnotationNullable, and answer the corresponding null status (NON_NULLetc.).toString()abstract UnconditionalFlowInfoReturn a new flow info that holds the same information as this would after a call to unconditionalInits, but leaving this info unaffected.abstract UnconditionalFlowInfoReturn a new flow info that holds the same information as this would after a call tounconditionalInitsfollowed by the erasure of fields specific information, but leaving this flow info unaffected.abstract UnconditionalFlowInfoReturn a flow info that merges the possible paths of execution described by this flow info.abstract UnconditionalFlowInfoReturn a new flow info that holds the same information as this would after a call tounconditionalInits, but leaving this info unaffected.
-
Field Details
-
tagBits
public int tagBits -
REACHABLE
public static final int REACHABLE- See Also:
-
UNREACHABLE_OR_DEAD
public static final int UNREACHABLE_OR_DEAD- See Also:
-
UNREACHABLE_BY_NULLANALYSIS
public static final int UNREACHABLE_BY_NULLANALYSIS- See Also:
-
UNREACHABLE
public static final int UNREACHABLE- See Also:
-
NULL_FLAG_MASK
public static final int NULL_FLAG_MASK- See Also:
-
UNKNOWN
public static final int UNKNOWN- See Also:
-
NULL
public static final int NULL- See Also:
-
NON_NULL
public static final int NON_NULL- See Also:
-
POTENTIALLY_UNKNOWN
public static final int POTENTIALLY_UNKNOWN- See Also:
-
POTENTIALLY_NULL
public static final int POTENTIALLY_NULL- See Also:
-
POTENTIALLY_NON_NULL
public static final int POTENTIALLY_NON_NULL- See Also:
-
UNROOTED
public static final int UNROOTED- See Also:
-
FREE_TYPEVARIABLE
public static final int FREE_TYPEVARIABLE- See Also:
-
DEAD_END
-
-
Constructor Details
-
FlowInfo
public FlowInfo()
-
-
Method Details
-
addInitializationsFrom
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
-
addNullInfoFrom
-
addPotentialInitializationsFrom
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 thanaddInitializationsFrom.- Parameters:
otherInits- other inits to compose over this- Returns:
- this, modified according to otherInits information
-
asNegatedCondition
-
conditional
-
cannotBeDefinitelyNullOrNonNull
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 check- Returns:
- true iff this flow info prevents local from being promoted to definite non null or definite null against an enclosing flow info
-
cannotBeNull
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
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
Return a deep copy of the current instance.- Returns:
- a deep copy of this flow info
-
initial
-
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 ofConditionalFlowInfo. 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
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 ofConditionalFlowInfo. 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
Check status of definite assignment for a field. -
isDefinitelyAssigned
Check status of definite assignment for a local. -
isDefinitelyNonNull
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
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
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
-
hasNullInfoFor
Check if any null info has been recorded for a given local variable. Here even recording of 'UNKNOWN' is considered as null info. -
isPotentiallyAssigned
Check status of potential assignment for a field. -
isPotentiallyAssigned
Check status of potential assignment for a local variable. -
isPotentiallyNonNull
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
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
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
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
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
Record that a local variable got checked to be non null.- Parameters:
local- the checked local variable
-
markAsComparedEqualToNull
Record that a local variable got checked to be null.- Parameters:
local- the checked local variable
-
markAsDefinitelyAssigned
Record a field got definitely assigned. -
markAsDefinitelyNonNull
Record a local got definitely assigned to a non-null value. -
markAsDefinitelyNull
Record a local got definitely assigned to null. -
resetNullInfo
Reset all null-information about a given local. -
markPotentiallyUnknownBit
Record a local may have got assigned to unknown (set the bit on existing info). -
markPotentiallyNullBit
Record a local may have got assigned to null (set the bit on existing info). -
markPotentiallyNonNullBit
Record a local may have got assigned to non-null (set the bit on existing info). -
markAsDefinitelyAssigned
Record a local got definitely assigned. -
markAsDefinitelyUnknown
Record a local got definitely assigned to an unknown value. -
markNullStatus
Mark the null status of the given local according to the given status- Parameters:
nullStatus- bitset of FLowInfo.UNKNOWN ... FlowInfo.POTENTIALLY_NON_NULL
-
nullStatus
Answer the null status of the given local- Returns:
- bitset of FlowInfo.UNKNOWN ... FlowInfo.POTENTIALLY_NON_NULL
-
mergeNullStatus
public static int mergeNullStatus(int nullStatus1, int nullStatus2) Merge two single bits (NULL, NON_NULL, POTENTIALLY*..) into one. This method implements a simpler logic than the 4-bit encoding used in FlowInfo instances. -
mergedOptimizedBranches
public static UnconditionalFlowInfo mergedOptimizedBranches(FlowInfo initsWhenTrue, boolean isOptimizedTrue, FlowInfo initsWhenFalse, boolean isOptimizedFalse, boolean allowFakeDeadBranch) Merge branches using optimized boolean conditions -
mergedOptimizedBranchesIfElse
public 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 -
reachMode
public int reachMode()Find out the reachability mode of this flowInfo.- Returns:
- REACHABLE if this flow info is reachable, otherwise either UNREACHABLE_OR_DEAD or UNREACHABLE_BY_NULLANALYSIS.
-
safeInitsWhenTrue
Return a flow info that carries the same information as the result ofinitsWhenTrue, 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
Set this flow info reach mode and return this.- Parameters:
reachMode- one ofREACHABLE,UNREACHABLE_OR_DEAD,UNREACHABLE_BY_NULLANALYSISorUNREACHABLE- Returns:
- this, with the reach mode set to reachMode
-
mergedWith
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.
- Parameters:
otherInits- the flow info to merge with this- Returns:
- the intersection of this and otherInits.
- the receiver updated in the following way:
-
mergeDefiniteInitsWith
-
nullInfoLessUnconditionalCopy
Return a copy of this unconditional flow info, deprived from its null info.DEAD_ENDis returned unmodified.- Returns:
- a copy of this unconditional flow info deprived from its null info
-
toString
-
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
Return a new flow info that holds the same information as this would after a call tounconditionalInitsfollowed 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
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
Return a new flow info that holds the same information as this would after a call tounconditionalInits, 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
-
resetAssignmentInfo
Resets the definite and potential initialization info for the given local variable -
tagBitsToNullStatus
public static int tagBitsToNullStatus(long tagBits) Check whether 'tagBits' contains eitherTagBits.AnnotationNonNullorTagBits.AnnotationNullable, and answer the corresponding null status (NON_NULLetc.).
-