Revision: 10149
Author:   sco...@google.com
Date:     Thu May  5 10:51:52 2011
Log:      StringKey hashCode inconsistent across VMs.

This is causing PersistentUnitCache to never re-use generated types. The deserialized ContentId hashCodes don't match the in-memory ContentId hashCodes because getClass().hashCode() isn't stable across VM instances.

http://gwt-code-reviews.appspot.com/1435801/

Review by: zun...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=10149

Modified:
 /trunk/dev/core/src/com/google/gwt/dev/util/StringKey.java

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/util/StringKey.java Wed Feb 16 11:06:56 2011 +++ /trunk/dev/core/src/com/google/gwt/dev/util/StringKey.java Thu May 5 10:51:52 2011
@@ -38,7 +38,7 @@
    */
   protected StringKey(String value) {
     this.value = value;
-    this.hashCode = getClass().hashCode() * 13
+    this.hashCode = getClass().getName().hashCode() * 13
         + (value == null ? 0 : value.hashCode());
   }

@@ -66,9 +66,6 @@
     if (o == null) {
       return false;
     }
-    if (getClass() != o.getClass()) {
-      return false;
-    }
     return compareTo((StringKey) o) == 0 ? true : false;
   }

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

Reply via email to