How openrewrite/rewrite works
Main Components
a. Core Components:
• Core Engine (rewrite-core)
• Language-specific Parsers
• Java (rewrite-java-8/11/17/21)
• XML (rewrite-xml)
• YAML (rewrite-yaml)
• Properties (rewrite-properties)
• Maven (rewrite-maven)
• Gradle (rewrite-gradle)
• Others (Groovy, TOML, Protobuf, etc.)
• Recipe System
• Visitor Pattern Implementation
• Type System
b. Integration Points:
• Build Tool Plugins
• External Services Integration
• Cache Systems
• Parser Implementations
Relationship Flows
• Source code input flow
• Parsing process
• Recipe execution flow
• AST transformation
• Result generation
Architectural Layers
┌─────────────────────────────────────────┐
• Build Tool Plugins │
• (Gradle, Maven Integration) │
• ┤
• Recipe Execution Layer │
• (Recipe Registry & Orchestration) │
• ┤
• Language-Specific Parsers │
• (Java, XML, YAML, Maven, etc.) │
• ┤
• Core Engine │
• (AST, Visitors, Type System) │
• ┤
• Storage & Caching Layer │
• (Results, Types, Parser Cache) │
• ┘
Key Components Detail
a. Core Engine:
• AST (Abstract Syntax Tree) Management
• Visitor Pattern Implementation
• Type System
• Results Handling
b. Recipe System:
• Recipe Registry
• Recipe Execution Pipeline
• Recipe Configuration
• Results Collection
c. Parser Framework:
• Language-Specific Parsers
• Parser Caching
• AST Generation
• Symbol Resolution
Cross-Cutting Concerns
• Security
• Logging
• Metrics
• Error Handling
• Configuration Management
External Integrations
Connections to:
• Build Systems
• Version Control
• CI/CD Systems
• Moderne Platform (optional integration)
Implementation Notes
Callouts for:
• Key interfaces
• Extension points
• Plugin architecture
• Cache mechanisms
Metrics and Monitoring
Sections for:
• Performance monitoring
• Error tracking
• Usage statistics
• Health checks
Integration capabilities
• Clear and readable
• Well-organized
• Properly labeled
• Easily maintainable
Remember to maintain a balance between detail and clarity, focusing on the most important architectural aspects while avoiding overwhelming detail that might obscure the main system structure.