Interface AbstractValue
- All Known Implementing Classes:
BottomValue, ConstantValue, ExcludesConstantValue, RangeValue, SetStateValue, TopValue
public sealed interface AbstractValue
permits TopValue, BottomValue, ConstantValue, RangeValue, SetStateValue, ExcludesConstantValue
Represents an abstract value in the value-tracking lattice for flow analysis.
The lattice has the following structure:
TOP (unknown / no information)
/ | \
Constant Range SetState
\ | /
BOTTOM (unreachable / contradiction)
Phase 1 implements: TOP, BOTTOM, and ConstantValue (Integer, Boolean, String). Phase 2 adds RangeValue for integer range constraints from condition narrowing. Phase 3 adds SetStateValue for isSet/unset tracking from guards and literals.
-
Method Summary
Modifier and TypeMethodDescriptionevaluateCondition(String operator, AbstractValue operand) Evaluate whether this abstract value satisfies a comparison condition.booleanisBottom()Check if this value represents an unreachable program point.booleanisKnown()Check if this value represents a known state (not TOP and not BOTTOM).default booleanCheck if this value is known to represent a SET variable.join(AbstractValue other) Join this value with another at a branch convergence point.
-
Method Details
-
join
Join this value with another at a branch convergence point. Returns the least upper bound of the two values.Key rules:
- BOTTOM join X = X (unreachable path is ignored)
- X join BOTTOM = X
- TOP join X = TOP
- Constant(a) join Constant(a) = Constant(a) (both agree)
- Constant(a) join Constant(b) = TOP (disagreement)
-
evaluateCondition
Evaluate whether this abstract value satisfies a comparison condition.- Parameters:
operator- the comparison operator (==, <>, <, >, etc.)operand- the right-hand side value to compare against- Returns:
- TRUE if condition is always satisfied, FALSE if never satisfied, UNKNOWN if indeterminate
-
isKnown
boolean isKnown()Check if this value represents a known state (not TOP and not BOTTOM). -
isBottom
boolean isBottom()Check if this value represents an unreachable program point. -
isKnownSet
default boolean isKnownSet()Check if this value is known to represent a SET variable. Constants and range-constrained values are implicitly SET.- Returns:
- true if the variable is provably SET, false otherwise
-