Skip to content

Review collection-builder API in generated builders: adopt flat consumer style? Is the generated API surface getting too complicated? #446

Backlog

Description

@igel-devin-ai

Summary

#429 introduced a flat, stream-friendly collection API on the hand-committed DTO builders:

  • single-element consumer overloads x(el -> el.fieldName(...)) (append semantics) replacing the nested x(xs -> xs.add(el -> ...)) style — both shapes cannot coexist due to Java erasure of Consumer
  • varargs-consumer overloads x(f -> ..., f -> ...) for multi-element adds
  • x(Element...) element varargs dropped for DTO-element collections (ambiguous with consumer varargs for 2+ lambda arguments)

The generated builders (what the processor emits for user DTOs) still emit the old Consumer<ArrayListBuilderWithElementBuilders<T, B>> shapes.

Questions to review

  1. Should generated builders adopt the same flat single-element/varargs consumer API as the feat: generate fluent builders for codegen model DTOs (#415) #429 DTO builders? The flat style removes one nesting level in streamed construction, which was the main readability complaint in feat: generate fluent builders for codegen model DTOs (#415) #429 review.
  2. Does the current generated API surface get too complicated? Per collection property we potentially emit: wholesale setter overloads (collection, supplier, consumer-of-list-builder, varargs), element adds (add2X), update (xUpdate), plus now single/varargs consumers. That is a lot of methods per property — review which combinations are actually pulled their weight, and whether some should be dropped or made conditional.
  3. If adopted: interaction with Rename generated element-add methods add2X → addToX (breaking) #443 (add2X → addToX rename) should be settled in the same design pass.
  4. Backwards compatibility: replacing the Consumer<ArrayListBuilderWithElementBuilders> overloads is a breaking change for generated code — same breaking-change policy as Rename generated element-add methods add2X → addToX (breaking) #443 (release-notes callout), or keep both where erasure allows?

Related: #415, #429, #443

Activity

  1. added this to the v0.7.0 milestone on Nov 24, 2026
  2. added theissue type on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions