trifork / erjang

A JVM-based Erlang VM
http://www.erjang.org
Apache License 2.0
726 stars 62 forks source link

EFun.hashCode() is abstract #76

Open eriksoe opened 10 years ago

eriksoe commented 10 years ago

EObject.hashCode() is declared abstract - which makes sense - but hashCode() is not implemented in the concrete subclasses of EFun. (Don't ask me how those classes get loaded anyway...!)

hashCode() is currently being used by phash2(), which is a temporary measure and perhaps an issue in itself.

More importantly, hashCode() is used by ets:

java.lang.AbstractMethodError
        at erjang.ETuple.hashCode(ETuple.java:555)
        at com.trifork.clj_ds.Util.hash(Unknown Source)
        at com.trifork.clj_ds.PersistentHashMap.assoc(Unknown Source)
        at erjang.m.ets.EPersistentInsertionOrderedSet.cons(EPersistentInsertionOrderedSet.java:107)
        at erjang.m.ets.EPersistentInsertionOrderedSet.cons(EPersistentInsertionOrderedSet.java:38)
        at erjang.m.ets.ETableBag$2.run(ETableBag.java:146)
        at erjang.m.ets.ETable$WithMap.call(ETable.java:244)
        at erjang.m.ets.ETable.in_tx(ETable.java)
        at erjang.m.ets.ETableBag.insert_one(ETableBag.java)
        at erjang.m.ets.Native.insert(Native.java)
krestenkrab commented 10 years ago

Hm; it should be relatively easy to add an implementation of hashCode in ETuple; just to fix this bug. Fixing phash2 is a serious project in itself.