[jdom-interest] bugs with clone()

Jason Hunter jhunter at collab.net
Thu Nov 16 19:49:04 PST 2000


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-



More information about the jdom-interest mailing list