commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Goran Hacek <>
Subject Re: svn commit: r825151 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/
Date Thu, 15 Oct 2009 12:24:33 GMT
On Wed, Oct 14, 2009 at 19:56, sebb <> wrote:
> Why not just remove the equals() and hashCode() methods?
> The defaults are just as good.

It is not the same because multiple instances of NOPClosure can exist.
This is because of serialization support.

By implementing readResolve() method which will always return INSTANCE
static member will ensure that no more then one instance of NOPClosure
exists at any given time. With this guaranty default equals() and
hashCode() will do their job as they should.

Javadoc comment on INSTANCE static member, which says "Singleton
predicate instance", is not correct because class doesn't implement
singleton pattern correctly. This would be fixed by implementing
readResolve() as previously described.

I have created a patch for this, it is in jira[1], so can someone review it?


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message