[jdom-interest] bugs with clone()

Jason Hunter jhunter at collab.net
Fri Dec 8 17:03:06 PST 2000

Since I couldn't think of a reason for clone() be final nor could anyone
else, I just changed all clone() methods to no longer be final.


Jason Hunter wrote:
> Michael Skells wrote:
> >
> > There are a number of bugs with the implementations of clone()
> >
> > 1. The implementation of clone in Entity is final, but the class
> > is not
> > which is not much help for an subclass of Entity and breaks the
> > specification of clone() from Object.
> > 2. The same is true of CDATA and Comment, Attribute, Document,
> > ProcessingInstruction
> OK, having final clone() methods does seem kind of crazy to me at this
> point too.  I remember deciding to make hashCode and equals final, but
> not clone.  If anyone knows why clone must be final, speak now.
> > 3. Specification of clone() [from Element] is that it should perform a
> > deep clone. however the implementation of clone() in Entity performs a
> > shallow clone as does ProcessingInstruction
> OK, entity's clone() being shallow has been added to TODO.txt.  If you
> already wrote code that fixes it, please send it in.
> -jh-
> _______________________________________________
> To control your jdom-interest membership:
> http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhost.com

More information about the jdom-interest mailing list