Repository navigation
processing: generalize processor machinery into a reusable codegen driver (#378) - #379
Merged
AndreasIgel merged 170 commits intoNov 1, 2026
Conversation
…tion, collection only finds
…ed from declaration, not duplicated
…r factory injected, no roaster/option coupling
…ntext — driver and domain share former-generated recognition
…-analyse-map-generate driver; BuilderProcessor collapses to domain hooks
…supported set; additive option seam for wrapper processors
…a JavaLangAnalyser
…thod default, extract findElements hook
devin-ai-integration
Bot
force-pushed
the
devin/1792924834-generic-processor-driver
branch
from
October 25, 2026 12:46
75e1134 to
25021b3
Compare
… strict and verbose commonly supported
…eLoader — driver defaults for logger/generator/formatter creation
…defaults for tag/kind/phase/options
… the 1:1 predictedTypeName map
…ation record passed to the base constructor
…ks the processor finished
…resolveGeneratedBuilder becomes dead
AndreasIgel
reviewed
Nov 1, 2026
AndreasIgel
reviewed
Nov 1, 2026
AndreasIgel
reviewed
Nov 1, 2026
AndreasIgel
reviewed
Nov 1, 2026
AndreasIgel
reviewed
Nov 1, 2026
AndreasIgel
reviewed
Nov 1, 2026
AndreasIgel
reviewed
Nov 1, 2026
AndreasIgel
reviewed
Nov 1, 2026
AndreasIgel
reviewed
Nov 1, 2026
AndreasIgel
reviewed
Nov 1, 2026
…st not keep MapStruct deferring
|
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 #378 — generalizes
BuilderProcessor's machinery into a reusable annotation-processing framework before the module move (#349). A neworg.javahelpers.codegen.processingpackage holds the generic pipeline;BuilderProcessorshrinks to the builder domain plugged into it via hooks. Generated output is byte-identical.The generic machinery (new package
codegen.processing)AbstractCodegenProcessor<C, K, D>— the driver. Owns the processing lifecycle so a new processor supplies only its domain hooks:CodegenProcessorConfiguration— static declarations in one record handed tosuper(...):elementCollector(required),optionRegistry,requiredSourceVersion,loggerPrefix(default: processor class name).ElementCollector/ElementSelector/ElementGroups— declarative element selection keyed by group name (annotation types, meta-markermetaMarked, opt-out); collection only finds, value reading stays inplanTasks.ProcessorOptionRegistry— supported options derived as aSetfrom the declaredCompilerOptions, including the wired verbose and formatter-profile options.CodegenTask<K>— the planned unit (element + resolved configuration + output package);PlannedGeneration(protected record) carries task + definition + target intoonTaskGenerated.CodegenConfiguration/CodegenDefinition— the domain contracts (targetTypeName()= the generated type's predicted name).SourceFormatterResolver— formatter profile resolved from the option registry.GenerationEnvironmentwiring (generationEnvironment(...)), target-exists guard, JDK gate (verifySupportedJdk), and the generated-type registry all live in the driver.BuilderProcessorafter the collapseOnly domain code remains:
ELEMENT_COLLECTOR/OPTION_REGISTRY/PROCESSOR_CONFIGURATIONconstants,createContext,createGenerator(RoasterCodeGenerator overgenerationEnvironment(...)),planTasks(config resolution,@SimpleBuilderForexpansion, scope/conflict rules),predictTaskResultTypeNames+onTaskResultRegistered(builder-name registration + SPI publication),analyse/mapToTargetSpecification,onTaskGenerated(Jackson accumulation + metrics),onProcessingOver(SPI flush, Jackson modules viagenerateTarget, perf report),isFinished/endRound(once-round marker + SPI finalization). ~600 lines of driver code left the class.Verification
mvn clean install— 567/567 tests green (processor 535); pinned diagnostic strings unchanged (domain keeps its "builder"/"Jackson module" nouns, framework messages use "target")mvn -pl example clean compileafter removinggenerated-example-builder— regenerated sources byte-identical (git statusclean)java/unused-parameterparams removed; the remaining ones are intentional extension-point parameters, dismissed as "won't fix" in the Security tab (CodeQL suppression comments are not honored by code scanning without an extra dismiss Action)This lands before the #368 module move: the move PR then carries a third artifact (
annotation-processing) holding this package plus the JSR-269-bound helpers, per the plan discussion.Lifecycle parity with main: a round with collected elements but an empty plan (e.g. every
@SimpleBuilderoutsidebuilderGenerationPackages) still runsendRound→finishCompilation(), so MapStruct maps such beans via setters instead of deferring until "No implementation was created" — pinned byMapStructSpiIntegrationTest.mapStruct_markedBeanOutsideGenerationScope_shouldMapViaSetters.