On Sun, Apr 11, 2010 at 9:36 PM, Ray Cromwell <cromwell...@gmail.com> wrote:

> Doh, you've right, boy do I love Javascript.
>
> "If you specify any object, including a Boolean object whose value is
> false, as the initial value of a Boolean object, the new Boolean
> object has a value of true."


That is the primary reason DevMode doesn't unbox primites for you (we do for
Strings, because in every way they are used in generated JS they behave the
same, plus you have little control over when you get a string pimitive vs a
String object).

private native boolean getFlag() /*-{
  return Boolean(false);
}-*/;

private native void useFlag(boolean flag) /*-{
  window.alert(flag ? "true" : "false");
}-*/;

private void showFlag() {
  useFlag(getFlag());
}

will show false in web mode, and there really isn't anything we can do about
it without adding code to potentially unbox all over the place.  If we
automatically handled boxing/unboxing in DevMode, this would show true.  So
instead, we let it fail in DevMode to alert you that there is a problem.

-- 
John A. Tamplin
Software Engineer (GWT), Google

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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to