felix-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reto Bachmann-Gmür <reto.bachm...@trialox.org>
Subject Re: possible framework bug in hashCode() function
Date Fri, 06 Mar 2009 11:37:33 GMT
Alexander.Berger@finnova.ch said the following on 03/06/2009 12:04 PM:
> [...] As to my understanding hashCode() should never throw an exception and always return
the same integer value for the same object instance. If this contract is violated classes
like HashMap will not work correctly, possibly introducing memory leaks if the Map (Set or
whatever) entries are not removed due to changing hash codes or thrown exceptions.
>   
Just as a side note: while it what you describe is probably the best
practice it is not mandated by the java-spec. In fact java the classes
from the collection framework would violate this contract: the hashcode
changes when the collection changes and hashcode() throws an exception
when the collection is self-containing.

Regards,
Reto

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Mime
View raw message