3.8 KiB
3.8 KiB
Execution Plan for Extended Analysis (Revised for Robustness)
Phase 0: Surgical Refactoring (The Enrichment Hook)
- Create
AnalysisResultandCodebaseMetadatamodels. - Update
ExportService.generateOutputsto acceptAnalysisResult. - Implement
EnrichmentServiceandAnalysisEnricherinterface. - Wrap current parser outputs in
AnalysisResultwithinExportService.
Phase 1: Foundation & Semantic Core
- JDT Binding Resolution: Configure
ASTParserwith project classpath andsetResolveBindings(true). - Workspace Scoping: Implement scanner with configurable exclude patterns (
test/,build/,node_modules/). - ConstantResolver: Implement lookup for
public static finalconstants across class boundaries using JDT bindings. - Basic PropertyResolver: Scan
application.properties/ymlfor simple key-value pairs. - Implement
JdtIntelligenceProvideras the primary semantic analyzer.
Phase 2: Trigger Discovery & Instance Identity
- GenericEventDetector: Find
sendEventcalls usingASTVisitor. - InstanceIdentifier: Detect which State Machine is being targeted (via
@Qualifier, bean names, or generic typesStateMachine<S, E>). - Trigger Filter: Link
sendEventcalls to specific SM instances to avoid noise in multi-SM projects. - Enhance
CodebaseContextto provide mapping fromMethodDeclarationto its callers using bindings.
Phase 3: Entry Point Mapping
- SpringMvcDetector: Detect REST endpoints (using
ConstantResolverfor paths). - MessageListenerDetector: Detect Kafka/JMS listeners (using
ConstantResolverfor topics/queues). - ConfigurableTriggerDetector: Support user-defined patterns for custom frameworks.
Phase 4: Call Graph Integration
- Develop a call graph builder to link
Entry PointstoTrigger Pointsvia intermediate service calls. - Support inheritance in call graph resolution (using JDT bindings to resolve method overrides).
Phase 5: Visualization & Diagnostics
- Update
ExportServiceto include trigger information. - Update DOT/SCXML exporters to show entry points.
- Diagnostic Nodes: Show "Potential/Unresolved Trigger" nodes when a
sendEventis found but the event name or SM instance cannot be resolved.
Phase 6: Validation (Milestone 1)
- Create a "Complex Sample Project" with REST controllers, services, and multiple state machines.
- Add unit tests for each detector and the aggregator.
- Verify that inheritance in both state machine config and controllers is correctly handled.
Phase 7: Advanced Resolution & Data Flow
- Complex ValueResolver: Handle string concatenations and variable references in annotations/logic.
- Payload Analysis: Extract payload types from entry points and track field usage in
sendEventcalls. - @Value Propagation: Track property values injected into fields and constructors.
Phase 8: Persistence & Lifecycle Mapping
- Detect persistence restoration logic (
persister.restore). - Map "Resume" points where the machine state is loaded from a DB based on external identifiers.
- Update metadata to distinguish between "New Instance" and "Restored Instance" triggers.
Phase 9: Advanced Ecosystem Support
- Reactive Chains: Analyze WebFlux/Project Reactor lambdas (
doOnNext,flatMap) for hidden triggers. - Interceptors & Filters: Detect
HandlerInterceptorandFilterimplementations and map them to endpoints.
Phase 10: External Dependency Interop
- Library Hints: Allow users to provide a JSON map of "Method -> Event" for third-party libraries where source is unavailable.
- External JAR Analysis: (Optional) Configure JDT to scan source-attachments of dependencies if available.