sebb schrieb:
I think I've found a fix to LANG-459 - which is to borrow some code
from Apache Axis.

The required code is a single short class - IDKey (e.g.
http://www.jdocs.com/axis/1.4/org/apache/axis/utils/IDKey.html)

It could be added as a private class of HashCodeBuilder, but it has
wider use, so should probably be added as a public class.
Seems reasonable to me. It does look like it will solve LANG-459. And as you say, this problem may be reasonably common.

What about making the IDKey class final? One thing that does concern me is that HashSet lookup using an Integer object as the key should be pretty fast. Using an IDKey object as the key may not perform as well. Making IDKey final would at least help. And I cannot see any reason why someone would want to subclass IDKey.

One other concern is regarding garbage collection. From a brief look at the code, this thread-local registry object contains a set of Integer hashcodes. With this change, the set will now contain real hard references to objects, preventing them from being garbage-collected while they are in the set. Does this matter?
Seems to me it would also be useful to add IdentityHashMap and
IdentityHashSet classes as well, given that LANG still targets Java
1.3.

WDYT?

And do these classes need a new package, or would the top-level package be OK?

No opinion.

Cheers,
Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to