http://gwt-code-reviews.appspot.com/1407802/diff/6001/user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java
File user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java
(right):

http://gwt-code-reviews.appspot.com/1407802/diff/6001/user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java#newcode61
user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java:61:
As an aside, some optimizations in the GWT compiler seem to be able to
turn "if(referenceType != null)" into if(referenceType).  When this
occurs, if you have the Splittable backed by directly by a non-null
unwrapped false value ("", 0, or boolean false), such checks fail.  This
means comparing a JsoSplittable to null, or sticking it into an API that
might do so (e.g. collection) can have unpredictable results.  This is
fine as long as usage of the type is strictly controlled by you.

http://gwt-code-reviews.appspot.com/1407802/diff/6001/user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java#newcode70
user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java:70:
private static native Splittable create0(String object) /*-{
You can use Object(string) to wrap and object.valueOf() to unwrap.

http://gwt-code-reviews.appspot.com/1407802/diff/6001/user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java#newcode87
user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java:87:
public native double asNumber() /*-{
+this also works except false/true won't be coerced to 0/1

http://gwt-code-reviews.appspot.com/1407802/diff/6001/user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java#newcode147
user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java:147:
public native boolean isBoolean() /*-{
In rare cases, instanceof checks can fail if the value is coming from
another frame. I don't see any explicit wrapping via Boolean(val), so I
don't know why this check is here, but if the Boolean came from a
$wnd.Boolean, instanceof will fail.

http://gwt-code-reviews.appspot.com/1407802/diff/6001/user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java#newcode155
user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java:155:
public native boolean isIndexed() /*-{
This can fail if the json payload ever comes from the host page, e.g.
via a JSONP request, because $wnd.Array != Array. I don't know if you
intend to ever support that (e.g. take a JsoSplittable passed to a
public API method for decoding) A check that works regardless can be
found here:
http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/

http://gwt-code-reviews.appspot.com/1407802/diff/6001/user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java#newcode247
user/src/com/google/gwt/autobean/client/impl/JsoSplittable.java:247:
private native String stringifyFast() /*-{
Caution, if the JsoSplittable ever has hashCode() invoked on it (e.g. it
is put into a collection), a field of $H will be present and get
serialized.

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

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

Reply via email to