processor: decouple codegen layer from builder internals (phase 0) - #299
Open
igel-devin-ai wants to merge 2 commits into
Open
igel-devin-ai wants to merge 2 commits into
igel-devin-ai wants to merge 2 commits into
Conversation
Prepares the code-generation layer for extraction into a separate simple-codegen library. No file moves, no behavior change; only dependency direction changes inside the processor module. - AnnotationProcessingContext: new base class holding env/Elements/ Types/logger/tracker + element helpers; ProcessingContext extends it and keeps builder-only state (config reader, scope resolver, registry) - ProcessingLogger: takes debugEnabled flag instead of reading CompilerArgumentsEnum - CompilerOption: new interface; CompilerArgumentsEnum implements it; CompilerArgumentsReader reads CompilerOption; readBuilderConfiguration moved to BuilderConfigurationReader - JavaLangAnalyser/JavaLangMapper/FieldAnnotationExtractor: depend on AnnotationProcessingContext; findConstructorForBuilder takes the marker annotation class as a parameter; new MapperOptions carries copyTypeAnnotations + generated-type resolution into the mapper - ClassCodeGenerator SPI + GenerationEnvironment introduced; RoasterCodeGenerator implements it; BuilderProcessor goes through the interface - Phase constants split: ProcessingPhases (builder pipeline) + GenerationPhases (codegen sub-phases); PerformanceTracker is a pure protocol interface; ActivePerformanceTracker takes its phase hierarchy at construction Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
Co-Authored-By: Andreas Igel <andreas.igel@computacenter.com>
devin-ai-integration
Bot
force-pushed
the
devin/1790369750-codegen-decoupling
branch
from
September 25, 2026 21:23
353c73d to
4dde491
Compare
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
Pure refactor, zero behavior change — decouples the code-generation layer inside
processorso it no longer imports 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.ProcessingContextsplit: newAnnotationProcessingContextbase (env/Elements/Types/logger/tracker + element helpers);ProcessingContext extendsit and keeps only builder state (config reader, scope resolver, generator registry, formatter profile).ProcessingLogger(processingEnv, debugEnabled)— reads no compiler enum itself;BuilderProcessorpassesVERBOSEin.CompilerOptioninterface;CompilerArgumentsEnum implementsit;readBuilderConfiguration()moved fromCompilerArgumentsReadertoBuilderConfigurationReader(static).JavaLangAnalyser/JavaLangMapper/FieldAnnotationExtractornow takeAnnotationProcessingContext;findConstructorForBuilder(type, markerAnnotation, ctx)is parameterized by the annotation class. NewMapperOptionsrecord carriescopyTypeAnnotations+ ageneratedTypeResolverfunction into the mapper — replacing itscontext.getConfiguration()/getBuilderScopeResolver()reads.ClassCodeGeneratorSPI +GenerationEnvironmentinclassgen;RoasterCodeGenerator implements ClassCodeGenerator;BuilderProcessortalks to the interface — the seam a future JavaPoet/custom backend plugs into.PerformanceTrackeris now a pure protocol interface. Phase names moved:ProcessingPhases(builder pipeline) +GenerationPhases(codegen sub-phases);ActivePerformanceTrackertakes its display hierarchy at construction.Rebased onto
formatterProfile(#284):ProcessingContextstill owns formatter creation (createSourceFormatter), but it's injected into the generator as aRoasterSourceFormatterFactoryinstead of the generator holdingProcessingContext— preserves the decoupled dependency direction while keeping the profile feature.mvn test -pl processor: 428 tests, 0 failures.