[freenet-cvs] r18966 - in trunk/freenet/src/freenet: crypt support support/math
Matthew Toseland
toad at amphibian.dyndns.org
Sat Apr 5 10:44:39 UTC 2008
On Saturday 05 April 2008 03:34, Florent Daignière wrote:
> * Matthew Toseland <toad at amphibian.dyndns.org> [2008-04-04 19:09:01]:
>
> > On Friday 04 April 2008 06:20, nextgens at freenetproject.org wrote:
> > > Author: nextgens
> > > Date: 2008-04-04 05:20:31 +0000 (Fri, 04 Apr 2008)
> > > New Revision: 18966
> > >
> > > Modified:
> > > trunk/freenet/src/freenet/crypt/SHA1.java
> > > trunk/freenet/src/freenet/support/DoublyLinkedListImpl.java
> > > trunk/freenet/src/freenet/support/math/DecayingKeyspaceAverage.java
> > > trunk/freenet/src/freenet/support/math/RunningAverage.java
> > >
trunk/freenet/src/freenet/support/math/SimpleBinaryRunningAverage.java
> > > Log:
> > > implement Cloneable where we have a clone() method
> >
> > Why?
> >
> > public interface Cloneable
> >
> > A class implements the Cloneable interface to indicate to the
Object.clone()
> > method that it is legal for that method to make a field-for-field copy of
> > instances of that class.
> >
> > Invoking Object's clone method on an instance that does not implement the
> > Cloneable interface results in the exception CloneNotSupportedException
being
> > thrown.
> >
> > By convention, classes that implement this interface should override
> > Object.clone (which is protected) with a public method. See Object.clone()
> > for details on overriding this method.
> >
> > Note that this interface does not contain the clone method. Therefore, it
is
> > not possible to clone an object merely by virtue of the fact that it
> > implements this interface. Even if the clone method is invoked
reflectively,
> > there is no guarantee that it will succeed.
> >
>
> Okay, it's a bad idea in SHA1.java; I meant to do it in JavaSHA1.java
> (r18972) and forgot to revert that bit afterwards...
>
> Fixed in r18998
>
> I think that the patch is revelant for other classes.
I don't. Cloneable does not even contain a public clone(). Its ONLY purpose is
to indicate to the JVM that it can do a field for field copy.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://emu.freenetproject.org/pipermail/cvs/attachments/20080405/1136e53c/attachment.pgp
More information about the cvs
mailing list