Hello Dominique, these Clone methods are shallow anyway.
The only bit which is not shallow is that the Vectors held internally by the patternset are cloned. The vector elements themselves are not cloned. So you can add a PatternSet.NameEntry to a clone of a PatternSet without changing the original. But if you change a PatternSet.NameEntry in the clone, which is coming from the original, this will affect the original. Do you think this level of detail should be in the javadoc ? Regards, Antoine -------- Original-Nachricht -------- Datum: Wed, 1 Nov 2006 09:57:15 -0600 Von: "Dominique Devienne" <[EMAIL PROTECTED]> An: "Ant Developers List" <dev@ant.apache.org> Betreff: Re: svn commit: r469781 - in /ant/core/trunk/src/main/org/apache/tools/ant: ProjectComponent.java types/AbstractFileSet.java types/DataType.java types/PatternSet.java > > I have decided that PatternSet.clone() should return also a reference > rather than the referenced object if the object is a reference. > > > > When the object is used, the different getters will bring the user back > to the referenced object. > > The only little concern I had with this approach was that if the > referenced object was changed between the moment the referencer is > cloned, and the moment it effectively accesses the cloned referencer > instance (and thus the modified referenced instance), accessing the > cloned reference may gives a false sense of "security", the user > thinking the clone is private and won't change, despite the fact that > it's still "just" a proxy (reference in Ant terms) to another > instance, that one not cloned. > > Confusing statement, I know ;-) --DD > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]