Fix JsoSplittable (AutoBeans) to work with boolean/double
With the new unboxing patches, boolean and number primitives are
no longer considered JSOs. JsoSplittable uses a hack similar to
elementable to 'cast' primitives to JSOs. This no longer works,
therefore JsoSplittable is updated to use boxed boolean/number.
Change-Id: Iac51aad7ccc940f5744d619ab6e738b1e263dbbc
diff --git a/user/src/com/google/web/bindery/autobean/gwt/client/impl/JsoSplittable.java b/user/src/com/google/web/bindery/autobean/gwt/client/impl/JsoSplittable.java
index a809c6e..43588db 100644
--- a/user/src/com/google/web/bindery/autobean/gwt/client/impl/JsoSplittable.java
+++ b/user/src/com/google/web/bindery/autobean/gwt/client/impl/JsoSplittable.java
@@ -63,11 +63,11 @@
}
private static native Splittable create0(boolean object) /*-{
- return Boolean(object);
+ return Object(object);
}-*/;
private static native Splittable create0(double object) /*-{
- return Number(object);
+ return Object(object);
}-*/;
private static native Splittable create0(String object) /*-{
@@ -104,11 +104,11 @@
};
public native boolean asBoolean() /*-{
- return this == true;
+ return this && this.valueOf();
}-*/;
public native double asNumber() /*-{
- return Number(this);
+ return this && this.valueOf();
}-*/;
public void assign(Splittable parent, int index) {
@@ -168,7 +168,7 @@
}
public native boolean isBoolean() /*-{
- return Object.prototype.toString.call(this) == '[object Boolean]';
+ return this && typeof(this.valueOf()) === 'boolean';
}-*/;
public native boolean isFunction() /*-{
@@ -192,7 +192,7 @@
}-*/;
public native boolean isNumber() /*-{
- return Object.prototype.toString.call(this) == '[object Number]';
+ return this && typeof(this.valueOf()) === 'number';
}-*/;
public native boolean isReified(String key) /*-{