Problem can be reproduced with four lines of code:

                HashMap<String,Object> testMap = new HashMap<String, Object>();
                testMap.put("me", testMap);
                HashMap<Object,Object> testMap2 = new HashMap<Object, Object>();
                testMap2.put(testMap, null); // <---- causes a stack overflow.


The problem is in the following line of HashMap.hashCode():
> result += keyHashCode(unmaskNullKey(key)) ^ valueHashCode(values[i]);
since value[i] could equal this (the current instance), valueHashCode
will recurse into hashCode causing an infinite recursion and stack
overflow. It can be fixed by not calling valueHashCode on values that
are this instance.

Is this a bug or a "feature"?


Thanks!

EntireOne, Inc.

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to