A HashMap bug with a Proxy value?

Alan Bateman Alan.Bateman at oracle.com
Wed Jan 12 16:59:10 UTC 2011


Chris Hegarty wrote:
> Are you referring to java.net.Proxy? Proxy.equals depends on the
> resolution of its address. Address resolution could change over time,
> depending on the caching policy. java.net.URL has a similar issue.
>
> Strangely,I would have expected containsValue and containsKey to behave
> in a similar fashion. I think the specification for these methods is
> very clear, they should use equals(). I'm not sure if containsKey is
> correct if it accepts key equality.
>
> -Chris
>   
I assume he is talking about java.lang.reflect.Proxy as it forwards the 
hashCode and equals methods to the invocation handler.

-Alan



More information about the core-libs-dev mailing list