Generally, null.nullField means the compiler can prove the value is null at
that point, and draft compile skills the optimization that defects a lot of
that.  So either it really is always null, or there is an optimizer bug.
On Jun 30, 2014 10:31 AM, "田传武" <[email protected]> wrote:

> Hello,
> The newest @JsType feature is really very fascinating, and works in most
> cases. The only issue i found was the wrong null.nullField javascript
> output.
>
> the compile command:
>
> java -cp xxx com.google.gwt.dev.Compiler -war xxx -XnoclassMetadata
> -XnocheckCasts -XjsInteropMode JS -XclosureCompiler -style
> PRETTY com.goodow.realtime.store.StoreProd
>
>
> Java code:
>
> public CollaborativeOperation compose(JsonArray operations) {
>     final CollaborativeOperation first =
> operations.<CollaborativeOperation> get(0);
>     if (operations.length() == 1) {
>       return first;
>     }
>     final JsonArray components = Json.createArray();
>     operations.forEach(...);
>     return new CollaborativeOperation(first.userId, first.sessionId,
> components);
>   }
>
>
> translated to the following javascript:
>
>  function $compose(operations) {
>   var components;
>   components = operations[0];
>   if (1 == operations.length) {
>     return components;
>   }
>   components = [];
>   $forEach(operations, new CollaborativeTransformer$1(components));
>   return new CollaborativeOperation(null.nullField, null.nullField,
> components);
> }
>
>
>
> There's an easy workaround to fix this: using the -draftCompile options
> when compilation. Here is the full compilation log:
> https://travis-ci.org/goodow/realtime-store/builds/28777579 (search
> for ./gwt-compile.sh)
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "GWT Contributors" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/google-web-toolkit-contributors/35eb8ed2-588b-484a-b2f4-b58b5bb01f46%40googlegroups.com
> <https://groups.google.com/d/msgid/google-web-toolkit-contributors/35eb8ed2-588b-484a-b2f4-b58b5bb01f46%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAM5k6X_%3DVAodXd3MJaF%3DQ4GxQuuG-Uq4Lpg%3D0%2BrPJDPsa5rtrQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to