This behavior happens outside of GWT too in regular Java. This has nothing to do with GWT. HashMap does not support null values or keys
On Sun, Jan 2, 2011 at 1:37 PM, sinelaw <[email protected]> wrote: > 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 -- http://groups.google.com/group/Google-Web-Toolkit-Contributors
