Monday, June 30, 2014

Fwd: [gwt-contrib] Translated to null.nullField when using JsInterop & @JsType

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:

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment