@@ -1755,8 +1755,12 @@ public interface [tb.nameBuildFinal][type.generics] {
17551755 [atCanIgnoreReturnValue type]
17561756 public final [builderReturnType type] [type.names.from]([type.typeImmutable.relative] instance) {
17571757 [requireNonNull type](instance, "instance");
1758+ [if type.dynamicBuildFromTypes]
17581759 mergeInternal(instance);
17591760 return [builderReturnThis type];
1761+ [else]
1762+ return [type.names.from](([type.typeAbstract.relative]) instance);
1763+ [/if]
17601764 }
17611765
17621766 /**
@@ -1767,7 +1771,13 @@ public interface [tb.nameBuildFinal][type.generics] {
17671771 [atCanIgnoreReturnValue type]
17681772 public final [builderReturnType type] [type.names.from]([type.typeAbstract.relative] instance) {
17691773 [requireNonNull type](instance, "instance");
1774+ [if type.dynamicBuildFromTypes]
17701775 mergeInternal(instance);
1776+ [else]
1777+ [for v in setters]
1778+ [buildFromAttribute v]
1779+ [/for]
1780+ [/if]
17711781 return [builderReturnThis type];
17721782 }
17731783 [else]
@@ -1780,13 +1790,24 @@ public interface [tb.nameBuildFinal][type.generics] {
17801790 [atCanIgnoreReturnValue type]
17811791 public final [builderReturnType type] [type.names.from]([s.type] instance) {
17821792 [requireNonNull type](instance, "instance");
1793+ [if type.dynamicBuildFromTypes]
17831794 mergeInternal(instance);
1795+ [else]
1796+ [for v in s.attributes]
1797+ [if v.nullableInSupertype]
1798+ [buildFromAttributeNullableSupertype v]
1799+ [else]
1800+ [buildFromAttribute v]
1801+ [/if]
1802+ [/for]
1803+ [/if]
17841804 return [builderReturnThis type];
17851805 }
17861806 [/if]
17871807 [/for]
1788-
1808+ [if type.dynamicBuildFromTypes]
17891809[for bs = type.buildFromTypes]
1810+
17901811[if bs.hasWildcards andnot type.suppressesUncheckedWarning]
17911812 @SuppressWarnings("unchecked")
17921813[/if]
@@ -1882,6 +1903,7 @@ public interface [tb.nameBuildFinal][type.generics] {
18821903 [/for]
18831904[/if]
18841905[/for]
1906+ [/if][--dynamic--]
18851907 [else]
18861908
18871909 /**
0 commit comments