Closed GoogleCodeExporter closed 9 years ago
Thanks for reporting. Yes, this is a bug in the new Tree support in 2.0.0. deep
cloning uses a Tree capability to detect leaves but this capability is not
correctly set up for sequences (and maps too) so it claims that these are
leaves. The crash occurs when the rewriter tries to copy the (not really) leaf
node.
I think the fix should be pretty easy. I should have time to try it and test in the next few days.
Original comment by inkytonik
on 5 Feb 2015 at 11:16
Original comment by inkytonik
on 5 Feb 2015 at 11:17
Actually the cause of this bug turns out not to be the Tree support as
indicated above.
The real cause is a problem in the way that some nodes are duplicated (which
is used by the generic rewriting and the deepcloner).
The specific case of the bug report is where a Nil value is duplicated. It
crashes because the duplicator goes looking for a constructor to use but there
is no public one.
In fact, this circumstance suggests that duplicating the Nil is not the right
thing to do anyway, since that value is intended to be a singleton and it
doesn't really make sense to have more than one instance of Nil.
Extending this to user-land, we can also argue that case objects should not be
duplicated or cloned either since they are supposed to be singletons too.
All of this means that a fix will take loner to arrive at since these cases
have to be supported properly and it's non-trivial to detect these situations
dynamically.
Original comment by inkytonik
on 11 Feb 2015 at 2:32
As part of a recently pushed batch of fixes, revision d49539e22a6a fixes this
problem.The crash due to singletons being cloned (or duplicated in general) has
been removed. In these cases the same instance is returned, applying the logic
that it doesn't make sense to clone a singleton.
A new snapshot with these changes has been published on the Sonatype OSS repo.
It would be good if you could try it and let us know if the problem is fixed
from your perspective also. (I have run your test case here and it is fine now.)
Original comment by inkytonik
on 13 Feb 2015 at 2:13
The new snapshop looks good to me. We had 3 scenarios where the problem
occurred and all now work as expected.
Original comment by msbra...@gmail.com
on 13 Feb 2015 at 12:46
Great. Thanks for the feedback.
Original comment by inkytonik
on 13 Feb 2015 at 10:49
Original issue reported on code.google.com by
msbra...@gmail.com
on 2 Feb 2015 at 11:46Attachments: