Remove dep on Impl::getNextHashId() by Martin Letis
https://reviews.apache.org/r/38785/
As of
https://gwt.googlesource.com/gwt/+/6d27b4615004569c68c7bbf2b3d04a6c942cd493
the method is no longer available.
Calling Object#hashCode() should "Just Work (TM)" both for jso and java,
as the 'emul' implementation both before and after dankurka's change
default to the previous implementation in JsIdentity{Map,Set}.
diff --git a/src/org/waveprotocol/wave/client/common/util/JsIdentityMap.java b/src/org/waveprotocol/wave/client/common/util/JsIdentityMap.java
index d321b1e..53e7dbe 100644
--- a/src/org/waveprotocol/wave/client/common/util/JsIdentityMap.java
+++ b/src/org/waveprotocol/wave/client/common/util/JsIdentityMap.java
@@ -93,14 +93,10 @@
/**
* Get the unique id for the object
- *
- * TODO(danilatos): See if just calling .hashCode() will "Just Work (TM)"
- * both for jso and "java' objects at the same time. Then we won't need to
- * do it manually.
*/
- private native int getId(K key) /*-{
- return key.x$h || (key.x$h = @com.google.gwt.core.client.impl.Impl::getNextHashId()());
- }-*/;
+ private int getId(K key) {
+ return key.hashCode();
+ }
/** {@inheritDoc} */
@Override
diff --git a/src/org/waveprotocol/wave/client/common/util/JsIdentitySet.java b/src/org/waveprotocol/wave/client/common/util/JsIdentitySet.java
index 9f7f6e1..da4300d 100644
--- a/src/org/waveprotocol/wave/client/common/util/JsIdentitySet.java
+++ b/src/org/waveprotocol/wave/client/common/util/JsIdentitySet.java
@@ -78,14 +78,10 @@
/**
* Get the unique id for the object
- *
- * TODO(danilatos): See if just calling .hashCode() will "Just Work (TM)"
- * both for jso and "real java" objects at the same time. Then we won't need
- * to do it manually.
*/
- private native int getId(T key) /*-{
- return key.x$h || (key.x$h = @com.google.gwt.core.client.impl.Impl::getNextHashId()());
- }-*/;
+ private int getId(T key) {
+ return key.hashCode();
+ }
private final native void eachInner(IntMapJsoView<T> elements, Proc<? super T> proc) /*-{
for (var k in elements) {