ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 23090] - AbstractFileSet copy-constructor makes shallow copy
Date Thu, 11 Sep 2003 19:22:37 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23090>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23090

AbstractFileSet copy-constructor makes shallow copy





------- Additional Comments From gthb@dimon.is  2003-09-11 19:22 -------
For reference, here's a snippet from the Object.clone() "contract" (javadoc):

    By convention, the object returned by this method should be independent
    of this object (which is being cloned). To achieve this independence, it
    may be necessary to modify one or more fields of the object returned by
    super.clone before returning it. Typically, this means copying any mutable
    objects that comprise the internal "deep structure" of the object being
    cloned and replacing the references to these objects with references to
    the copies.

It's your call of course -- these specifications are marked "by convention" --
but this does seem to lean strongly towards changing the clone() method (and
perhaps introducing a shallowClone() method, if somebody actually wants that)
rather than leaving clone() unchanged and introducing deepClone(). I can't
think of a compelling use case for a FileSet clone() implementation that
leaves the clone and original fileset coupled.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message