Repository navigation
Description
Preparatory step for #349, before the model move lands.
Goal: simple-codegen must contain only framework-agnostic codegen — no builder vocabulary. Generation consumes only the generic base (GenerationTargetClassDto); the builder-domain layer stays processor-side.
Seam changes (interfaces to genericize first)
TypeMappingContext.resolveGeneratedType— currentlyOptional<ResolvedBuilder>; needs a neutral return (Optional<TypeName>or a generic generated-type ref). Design needed for whatResolvedBuilder.buildCall(...)/setterPrefixprovide to callers (builder instantiation emission).TypeName.resolvedBuilderfield — neutral type + name.BuilderInstantiation— generic instantiation-strategy vocabulary (ConstructorCall/StaticFactoryCallare generic-shaped;AnchorFactoryCallis builder-specific).GeneratedBuildersregistry — generic generated-types registry (Map<TypeName, TypeName>semantics already).
Builder model placement
Builder-domain types stay processor-side (processor.model), never move to codegen: BuilderConfiguration, BuilderDefinitionDto, BuilderMethodDto, BuilderNestedTypeDto, BuilderToGenerationTypeMapper, ResolvedBuilder, BuilderInstantiation, GeneratedBuilders.
Preference order for modelling the split: separate type + mapping > composition > inheritance (last resort). Builder DTOs may freely use codegen vocabulary (TypeName, FieldDto, MethodDto) as field types or produce them at the boundary (BuilderToGenerationTypeMapper → GenerationTargetClassDto at finalization, as today). Where a builder type needs generic-shaped state, prefer holding it (BuilderDefinitionDto already holds/produces a GenerationTargetClassDto) over inheriting it — inheritance between the two model families only if neither mapping nor composition fits. (Extending a DTO to add a property remains a good pattern; this rule targets model-family hierarchies, not the extends mechanism.)
Genuine duplication only where codegen cannot see the other side (anti-corruption seam): the codegen.enums mirror of core.enums is the pattern — correct for the future repo split (#363).
Acceptance
simple-codegen/simple-codegen-roastercompile with zero*Builder*types and zero builder references.- SPI boundary remains
generateClass(GenerationTargetClassDto, SourceFormatter). - Generated output byte-identical; all tests green.
Activity
model/analysis: move builder conventions out of genericized types (ja…
Genereralize codegen classes; keep builder model processor-side (#369) (