Manifest copy constructor does not deeply copy individual section Attributes
Lance Andersen
lance.andersen at oracle.com
Mon Jan 21 22:50:30 UTC 2019
Hi Philipp,
This is going to take some further discussion/input as this has been documented for sometime as a shallow copy.
If there is a consensus to move this forward, it will also require a CSR. I can help with that and sponsoring the updates, if the decision is to go ahead with the proposed change
Best
Lance
> On Jan 19, 2019, at 2:34 PM, Philipp Kunz <philipp.kunz at paratix.ch> wrote:
>
> Hi again,
> Just after having sent the previous mail I found Manifest::clone
> explicitly says it creates a shallow copy which is true only to a
> certain extent. It deeply copies main attributes as well as individual
> sections map already now and only shallowly copies individual sections
> attributes maps.
> I don't know about the background of it or why clone should only do a
> shallow copy but if clone should really create a shallow copy, it
> should probably create an even more shallow copy. In any case I figure
> some potential for clarification at least.
> Probably mostly because I already began a patch in the previous
> message, I continued and attached another patch for a deep copy
> approach. There might still be some reason not to deeply copy manifests
> which I don't intend to forestall.
> Philipp
>
> On Sat, 2019-01-19 at 19:32 +0100, Philipp Kunz wrote:
>> Hi,
>>
>> Creating a new manifest as a copy from an existing one using the copy
>> constructor assigns the new manifest individual sections entries map
>> the same values which are references to attributes as the original
>> rather than copying them as well deeply resulting in two manifests
>> pointing to the same attributes instances modifications to which
>> always affect both manifests. See test and proposed fix in the
>> attached patch.
>>
>> Regards,
>> Philipp
> <manifestcopyconstructorandclone.patch>
<http://oracle.com/us/design/oracle-email-sig-198324.gif>
<http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
<http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering
1 Network Drive
Burlington, MA 01803
Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>
More information about the core-libs-dev
mailing list