Files
spring-state-machine-renderer/plan-extended-anaylis/PLAN.md
2026-06-27 20:07:24 +02:00

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:

  1. Full Pointer & Alias Analysis:

    • If two variables alias the same object (e.g., Command cmd1 = cmd2;), a mutation on cmd1 (e.g., cmd1.setEvent("A")) is not reflected when reading the fields of cmd2 unless 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.
  2. 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.
  3. Exception Path Analysis (Exception CFG):

    • Edges for exception flows (throw statements, try-catch-finally blocks, and implicit unchecked runtime exceptions like NullPointerException) are not modeled. Consequently, mutations or return paths within catch/finally blocks may be missed or evaluated out of order.
  4. Collection & Array Tracking:

    • Arrays and Collections (such as List, Map, Set) are treated as opaque objects, and their operations (like list.add(val) or map.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)).
  5. 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.
  6. 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.
  7. 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.