Repository navigation
processor: decouple codegen layer from builder internals (phase 0) - #299
Open
igel-devin-ai wants to merge 1 commit into
Open
igel-devin-ai wants to merge 1 commit into
igel-devin-ai wants to merge 1 commit into
Conversation
devin-ai-integration
Bot
force-pushed
the
devin/1790369750-codegen-decoupling
branch
from
September 25, 2026 21:23
353c73d to
4dde491
Compare
Introduce a small SPI seam inside the processor so the Roaster-based code generator and the analysis helpers no longer depend on builder internals: - ClassCodeGenerator SPI: BuilderProcessor now talks to the generator through the interface; RoasterCodeGenerator implements it and receives a GenerationEnvironment (processing environment, logger, performance tracker, issue reporter) plus a RoasterSourceFormatterFactory instead of the whole ProcessingContext. - GenerationIssueReporter abstracts strict-mode reporting out of the context. - MapperOptions record carries the mapper's needs (copyTypeAnnotations flag + generated-type resolver function), replacing mapper reads of the builder scope resolver and configuration; BuilderDefinitionCreator supplies them. - findConstructorForBuilder takes the constructor marker annotation as a parameter instead of hardcoding SimpleBuilderConstructor. - ProcessingLogger no longer reads compiler options itself: a private Verbosity enum plus a verbose(ProcessingEnvironment) factory replace the implicit flag (callers decide the verbosity; the -Averbose option is read once in BuilderProcessor). - CompilerOption interface decouples CompilerArgumentsReader from the builder option enum; readBuilderConfiguration moved to BuilderConfigurationReader. - Phase constants moved out of the PerformanceTracker protocol into ProcessingPhases (pipeline phases + hierarchy) and GenerationPhases (codegen sub-phases); ActivePerformanceTracker takes them as constructor arguments. No behavior change: generated example builders are unchanged.
devin-ai-integration
Bot
force-pushed
the
devin/1790369750-codegen-decoupling
branch
from
October 12, 2026 00:34
4dde491 to
df5d937
Compare
This was referenced Oct 12, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #347. Part of #233.
Pure refactor, zero behavior change — decouples the code-generation layer inside
processorso it no longer depends on builder-specific internals. This is Phase 0 of extracting a reusablesimple-codegenlibrary (~40 files) into its own module/artifact: do the decoupling before anygit mvso the move commits stay rename-safe.ClassCodeGeneratorSPI (new):BuilderProcessornow talks to the generator through the interface.RoasterCodeGenerator implementsit and receives aGenerationEnvironment(processing environment, logger, performance tracker,GenerationIssueReporter) plus aRoasterSourceFormatterFactoryinstead of the wholeProcessingContext. Strict-mode reporting keeps its semantics viacontext::reportBasedOnStrictModewired as the issue reporter.MapperOptionsrecord (new): carries the mapper's needs (copyTypeAnnotationsflag + a generated-type resolver function), replacing mapper reads of the builder scope resolver and the builder configuration.BuilderDefinitionCreatorsupplies them in one place.findConstructorForBuildertakes the constructor marker annotation as a parameter instead of hardcodingSimpleBuilderConstructor(the builder caller passes it in).ProcessingLoggerno longer reads compiler options itself: a privateVerbosityenum plus averbose(ProcessingEnvironment)named factory replace the implicit flag — callers decide the verbosity; the-Averboseoption is read once inBuilderProcessor.CompilerOptioninterface (new) decouplesCompilerArgumentsReaderfrom the builder option enum;readBuilderConfigurationmoved toBuilderConfigurationReadernext to the other configuration sources.PerformanceTracker(now a pure protocol) intoProcessingPhases(pipeline phases + hierarchy) andGenerationPhases(codegen sub-phases);ActivePerformanceTrackertakes them as constructor arguments.Out of scope (next PRs)
ProcessingContextinto a genericAnnotationProcessingContext+ builder-specific context (separate PR — it touches many files on its own).git mvof the decoupled classes intosimple-codegen/simple-codegen-roastermodules (Phase 1).Test plan
mvn test -pl processor— all 528 tests passmvn -pl example clean compile— regeneratedgenerated-example-builder/tree is byte-identical (confirms zero behavior change)license:check— all new files carry the license header