Skip to content

Support static factory methods for referenced builder creation #309

Description

@igel-devin-ai

Sub-task of #301.

Goal

Accept a public static parameterless factory (e.g. create(), MapStruct-style) as an instantiation path alongside B(). When a factory taking the value exists (e.g. create(T) / of(T)), prefer it over the copy constructor. Generated helper code calls the factory instead of new when present.

Why

Generated builders expose create(), but the contract only recognizes constructors — generated code always instantiates via new, so own builders' static creation paths are unusable when referenced across compilation units.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions