2.6 KiB
2.6 KiB
Phase 11: Formal Compiler & Static Analysis Alignment (Limitations & Missing Features)
While the custom AST-based JdtDataFlowModel supports advanced OOP data flow (like flow-sensitive local mutations, fluent builders, and polymorphic union fallbacks), the following compiler/static analysis behaviors are missing or simplified:
-
Full Pointer & Alias Analysis:
- If two variables alias the same object (e.g.,
Command cmd1 = cmd2;), a mutation oncmd1(e.g.,cmd1.setEvent("A")) is not reflected when reading the fields ofcmd2unless they resolve to the exact same AST node reference. A formal pointer/alias analysis (like Anderson's or Steensgaard's algorithm) would map abstract heap locations rather than AST nodes.
- If two variables alias the same object (e.g.,
-
Advanced Loop Fixpoints for Fields:
- If a loop mutates a field based on its previous values (e.g.,
while(cond) { builder.count(builder.getCount() + 1); }), a simple sequential pass will miss the cyclic dependency. A formal data flow framework uses a mathematical lattice and runs a fixpoint iteration algorithm (using meet/join operators) to compute the stable approximation of values.
- If a loop mutates a field based on its previous values (e.g.,
-
Exception Path Analysis (Exception CFG):
- Edges for exception flows (
throwstatements,try-catch-finallyblocks, and implicit unchecked runtime exceptions likeNullPointerException) are not modeled. Consequently, mutations or return paths within catch/finally blocks may be missed or evaluated out of order.
- Edges for exception flows (
-
Collection & Array Tracking:
- Arrays and Collections (such as
List,Map,Set) are treated as opaque objects, and their operations (likelist.add(val)ormap.put(key, val)) are evaluated as general method calls. Modifying a collection does not propagate the values to its getter calls (e.g.list.get(0)).
- Arrays and Collections (such as
-
Field Shadowing and Inheritance Semantics:
- If a subclass shadows a superclass field (declaring a field with the same name), our resolver might resolve the wrong field binding. Also, implicit superclass constructors and field initializers from superclass hierarchies are not fully simulated.
-
Static Initialization Blocks and Static Mutable State:
- Class loading execution order (i.e. static block initializations
static { ... }) is not modeled. A mutation on a static field in one method is not propagated to reads in another method.
- Class loading execution order (i.e. static block initializations
-
Type Erasure & Generics Precision:
- Generics type bounds (e.g., wildcards
? extends T, type parameter replacements) are not fully tracked, which can result in incorrect polymorphic resolution when method signatures differ slightly from erased bindings.
- Generics type bounds (e.g., wildcards