jaxb2-rich-contract-plugin icon indicating copy to clipboard operation
jaxb2-rich-contract-plugin copied to clipboard

Builder methods use copyOf to generate a new Builder but doesn't build the object

Open SvenBunge opened this issue 8 months ago • 2 comments

With Version 4.2.0.0 and compiling the xbau 2.3.1 xsd set I struggled about this issue:

It is creating methods like:

        public Builder(final _B _parentBuilder, final Bauvorhaben _other, final boolean _copy, final PropertyTree _propertyTree, final PropertyTreeUse _propertyTreeUse) {
            this._parentBuilder = _parentBuilder;
            if (_other!= null) {
                if (_copy) {
                    _storedValue = null;
                    final PropertyTree bezeichnungDesBauvorhabensPropertyTree = ((_propertyTree == null)?null:_propertyTree.get("bezeichnungDesBauvorhabens"));
                    if (((_propertyTreeUse == PropertyTreeUse.INCLUDE)?(bezeichnungDesBauvorhabensPropertyTree!= null):((bezeichnungDesBauvorhabensPropertyTree == null)||(!bezeichnungDesBauvorhabensPropertyTree.isLeaf())))) {
                        this.bezeichnungDesBauvorhabens = _other.bezeichnungDesBauvorhabens;
                    }
                    final PropertyTree beteiligtePropertyTree = ((_propertyTree == null)?null:_propertyTree.get("beteiligte"));
                    if (((_propertyTreeUse == PropertyTreeUse.INCLUDE)?(beteiligtePropertyTree!= null):((beteiligtePropertyTree == null)||(!beteiligtePropertyTree.isLeaf())))) {
                        this.beteiligte = ((_other.beteiligte == null)?null:BeteiligteBauprojekt.<Bauvorhaben.Builder<_B> >copyOf(_other.beteiligte, beteiligtePropertyTree, _propertyTreeUse));
                    }
                    final PropertyTree gegenstandPropertyTree = ((_propertyTree == null)?null:_propertyTree.get("gegenstand"));
                    if (((_propertyTreeUse == PropertyTreeUse.INCLUDE)?(gegenstandPropertyTree!= null):((gegenstandPropertyTree == null)||(!gegenstandPropertyTree.isLeaf())))) {
                        this.gegenstand = ((_other.gegenstand == null)?null:Bauvorhaben.Gegenstand.<Bauvorhaben.Builder<_B> >copyOf(_other.gegenstand, gegenstandPropertyTree, _propertyTreeUse)
                        ....

Correct from my perspective would be to call copy(..).build() but the .build() is missing in the generated sources.

SvenBunge avatar Jun 19 '24 20:06 SvenBunge