[erlang-bugs] jinterface 1.4.2 : OtpErlangRef missing hashCode method

Paul Guyot <>
Mon Nov 24 07:07:33 CET 2008


OtpErlangRef class (and probably others) is missing the hashCode  
method, while it overrides the equal method. As a result, refs cannot  
be put in a hash structure (e.g. HashMap).

final HashMap<OtpErlangRef, Object> myMap = new HashMap<OtpErlangRef,  
myMap.put(ref1, obj1);
assertNotNull(myMap.get(ref1));	// <-- fails

The attached patch adds an implementation of hashCode for  
OtpErlangRef, which is compatible with the equal method.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-lib_jinterface_java_src_com_ericsson_otp_erlang_OtpErlangRef.java.diff
Type: application/octet-stream
Size: 772 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20081124/29efe486/attachment.obj>
-------------- next part --------------

More information about the erlang-bugs mailing list