import java.util.List; import lombok.Builder; @Builder(toBuilder = true) @lombok.experimental.Accessors(prefix = "m") class BuilderWithToBuilder { private String mOne, mTwo; @Builder.ObtainVia(method = "rrr", isStatic = true) private T foo; @lombok.Singular private List bars; public static K rrr(BuilderWithToBuilder x) { return x.foo; } } @lombok.experimental.Accessors(prefix = "m") class ConstructorWithToBuilder { private String mOne, mTwo; private T foo; @lombok.Singular private List bars; @Builder(toBuilder = true) public ConstructorWithToBuilder(String mOne, @Builder.ObtainVia(field = "foo") T bar) { } } @lombok.experimental.Accessors(prefix = "m") class StaticWithToBuilder { private String mOne, mTwo; private T foo; private K bar; @lombok.Singular private List bars; @Builder(toBuilder = true) public static StaticWithToBuilder test(String mOne, @Builder.ObtainVia(field = "foo") Z bar) { return new StaticWithToBuilder(); } }