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

2014-06-30 Thread 田传武
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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
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.
For more options, visit https://groups.google.com/d/optout.


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

2014-06-30 Thread 'Ray Cromwell' via GWT Contributors
Can you post the full source for CollaborativeOperation? My guess is
the UserID and SessionID fields are being proven by the compiler to be
uninstantiated types. Are userId/sessionId simple Strings, or some
other type?

.

On Mon, Jun 30, 2014 at 8:18 AM, 'Daniel Kurka' via GWT Contributors
google-web-toolkit-contributors@googlegroups.com wrote:
 I have seen this happening before when the pruner removes a type that he
 does not consider live but actually is live.

 Fast try, can you change:
 final CollaborativeOperation first = operations.CollaborativeOperation
 get(0);

 to:
 final CollaborativeOperation first = (CollaborativeOperation)
 operations.CollaborativeOperation get(0);

 -Daniel


 On Mon, Jun 30, 2014 at 8:09 AM, 田传武 i...@goodow.com wrote:

 I'm sure this is an optimizer bug.

 null.nullField causes the following error at runtime:
 SEVERE: (TypeError) : Cannot read property 'nullField' of
 nullcom.google.gwt.core.client.JavaScriptException: (TypeError) : Cannot
 read property 'nullField' of null
 at
 Unknown.$compose(http://localhost:63342/realtime/app/bower_components/realtime-store/realtime-store.js@41)

 However, the draft compilation javascript works very well.

 On Monday, June 30, 2014 10:58:08 PM UTC+8, John A. Tamplin wrote:

 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, 田传武 i...@goodow.com 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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
 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.
 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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/google-web-toolkit-contributors/362b0daf-c174-4021-9bc8-acee19af0cfc%40googlegroups.com.

 For more options, visit https://groups.google.com/d/optout.




 --
 Google Germany GmbH
 Dienerstr. 12
 80331 München

 Registergericht und -nummer: Hamburg, HRB 86891
 Sitz der Gesellschaft: Hamburg
 Geschäftsführer: Graham Law, Katherine Stephens

 --
 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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/google-web-toolkit-contributors/CALLujirJ7CD%2B_fRDFyE9kUX%2BCLeeaMbd8JQraWMMp6CWQKtNMQ%40mail.gmail.com.

 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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAPVRV7fodJL3qBmJGSMXm_sEidYypd0B22GQt9n1O_DzVbaKAA%40mail.gmail.com.
For more options, 

[gwt-contrib] Dropping IE8 support in useragent-less GWT

2014-06-30 Thread 'Goktug Gokdogan' via GWT Contributors
We are planning to drop support for IE8 if the application doesn't inherit
c.g.gwt.useragent.UserAgent and hence not have browser permutations.

Nearly all of today's apps inherit User so they will not be affected by
this change. In the future more apps will only inherit Core however they
shouldn't need to pay price of IE8 support (currently they do because there
are no permutations in Core).

Let me know if you have any concerns.

 - Goktug

-- 
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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA3AoWrKnXUKp_6jVF_1bWMRqWUq5QJ%2BURZnrCUqeUeZzg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


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

2014-06-30 Thread 田传武
Hi Ray,

Here is the source for CollaborativeOperation:
https://github.com/goodow/realtime-operation/blob/master/src/main/java/com/goodow/realtime/operation/impl/CollaborativeOperation.java

the final project which depends on realtime-operation:
https://github.com/goodow/realtime-store (Using the ./gwt-compile.sh to 
compile)

and the live playground:
http://realtimeplayground.goodow.com/

Thanks!


On Tuesday, July 1, 2014 1:18:33 AM UTC+8, Ray Cromwell wrote:

 Can you post the full source for CollaborativeOperation? My guess is 
 the UserID and SessionID fields are being proven by the compiler to be 
 uninstantiated types. Are userId/sessionId simple Strings, or some 
 other type? 

 . 

 On Mon, Jun 30, 2014 at 8:18 AM, 'Daniel Kurka' via GWT Contributors 
 google-web-toolkit-contributors@googlegroups.com javascript: wrote: 
  I have seen this happening before when the pruner removes a type that he 
  does not consider live but actually is live. 
  
  Fast try, can you change: 
  final CollaborativeOperation first = operations.CollaborativeOperation 
  get(0); 
  
  to: 
  final CollaborativeOperation first = (CollaborativeOperation) 
  operations.CollaborativeOperation get(0); 
  
  -Daniel 
  
  
  On Mon, Jun 30, 2014 at 8:09 AM, 田传武 i...@goodow.com javascript: 
 wrote: 
  
  I'm sure this is an optimizer bug. 
  
  null.nullField causes the following error at runtime: 
  SEVERE: (TypeError) : Cannot read property 'nullField' of 
  nullcom.google.gwt.core.client.JavaScriptException: (TypeError) : 
 Cannot 
  read property 'nullField' of null 
  at 
  Unknown.$compose(
 http://localhost:63342/realtime/app/bower_components/realtime-store/realtime-store.js@41)
  

  
  However, the draft compilation javascript works very well. 
  
  On Monday, June 30, 2014 10:58:08 PM UTC+8, John A. Tamplin wrote: 
  
  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, 田传武 i...@goodow.com 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 
 google-web-toolkit-contributors+unsubscr...@googlegroups.com javascript:. 

  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.
  

  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 google-web-toolkit-contributors+unsubscr...@googlegroups.com 
 javascript:. 
  To view this discussion on the web visit 
  
 https://groups.google.com/d/msgid/google-web-toolkit-contributors/362b0daf-c174-4021-9bc8-acee19af0cfc%40googlegroups.com.
  

  
  For more options, visit https://groups.google.com/d/optout. 
  
  
  
  
  -- 
  Google Germany GmbH 
  Dienerstr. 12 
  80331 München 
  
  Registergericht und -nummer: Hamburg, HRB 86891 
  Sitz der Gesellschaft: Hamburg 
  Geschäftsführer: Graham Law, Katherine Stephens 
  
  -- 
  You received this message because you are subscribed to the Google 
 Groups 
  GWT Contributors group. 
  To unsubscribe from this 

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

2014-06-30 Thread 田传武
Hi Daniel,
I just tried the code you provided, unfortunately, the explicit class cast 
workaround 
does not solve this issue. The translated javascript code is the same as 
before.

Thanks!

On Monday, June 30, 2014 11:18:12 PM UTC+8, Daniel Kurka wrote:

 I have seen this happening before when the pruner removes a type that he 
 does not consider live but actually is live.

 Fast try, can you change:
 final CollaborativeOperation first = operations.CollaborativeOperation 
 get(0);

 to:
 final CollaborativeOperation first = (CollaborativeOperation) 
 operations.CollaborativeOperation 
 get(0);

 -Daniel


 On Mon, Jun 30, 2014 at 8:09 AM, 田传武 i...@goodow.com javascript: 
 wrote:

 I'm sure this is an optimizer bug. 

 null.nullField causes the following error at runtime:
 SEVERE: (TypeError) : Cannot read property 'nullField' of nullcom.google.
 gwt.core.client.JavaScriptException: (TypeError) : Cannot read property 
 'nullField' of null
 at Unknown.$compose(http:
 //localhost:63342/realtime/app/bower_components/realtime-store/realtime-store.js@41
 )

 However, the draft compilation javascript works very well.

 On Monday, June 30, 2014 10:58:08 PM UTC+8, John A. Tamplin wrote:

 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, 田传武 i...@goodow.com 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 google-web-toolkit-contributors+unsubscribe@
 googlegroups.com.
 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=emailutm_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 google-web-toolkit-contributors+unsubscr...@googlegroups.com 
 javascript:.
  To view this discussion on the web visit 
 https://groups.google.com/d/msgid/google-web-toolkit-contributors/362b0daf-c174-4021-9bc8-acee19af0cfc%40googlegroups.com
  
 https://groups.google.com/d/msgid/google-web-toolkit-contributors/362b0daf-c174-4021-9bc8-acee19af0cfc%40googlegroups.com?utm_medium=emailutm_source=footer
 .

 For more options, visit https://groups.google.com/d/optout.




 -- 
 Google Germany GmbH
 *Dienerstr. 12*
 *80331 München*

 Registergericht und -nummer: Hamburg, HRB 86891
 Sitz der Gesellschaft: Hamburg
 Geschäftsführer: Graham Law, Katherine Stephens
  

-- 
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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/cbad255d-7413-4c26-929f-ecd8256b6260%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[gwt-contrib] Re: Dropping IE8 support in useragent-less GWT

2014-06-30 Thread Colin Alworth
Sounds great, but is there a reason that we're now starting at IE9+ and not 
IE10+, thus giving us typed arrays, web workers, web sockets, etc? I only 
ask because the kind of case where you are giving up User (and Widget, RPC, 
Timer, and other fairly high-level apis) seems to suggest that you might 
not be writing for a browser at all (htmlunit, nashorn, web worker, 
node.js).

Dan definitely has a point that if we're supporting modern browsers for a 
core chunk of functionality, we really shouldn't let 'modern' be 'whatever 
junk still happens to be running rather tha updating'. And besides, I can't 
always be That Guy pushing to keep all versions forever, just because IE8 
is still 11% of North America's browser usage (really: 
http://theie8countdown.com/). 

If we're cutting a browser for being old/bad/whatever in Core, but leaving 
support for it still in User, we should consider carefully why we *aren't* 
cutting deeper.

On Monday, June 30, 2014 2:59:12 PM UTC-5, Goktug Gokdogan wrote:

 We are planning to drop support for IE8 if the application doesn't inherit 
 c.g.gwt.useragent.UserAgent and hence not have browser permutations.

 Nearly all of today's apps inherit User so they will not be affected by 
 this change. In the future more apps will only inherit Core however they 
 shouldn't need to pay price of IE8 support (currently they do because there 
 are no permutations in Core).

 Let me know if you have any concerns.

  - Goktug


-- 
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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/45b68163-0d07-4a6c-9932-412232e2f71d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [gwt-contrib] Re: Dropping IE8 support in useragent-less GWT

2014-06-30 Thread 'Goktug Gokdogan' via GWT Contributors
On Mon, Jun 30, 2014 at 8:46 PM, Colin Alworth niloc...@gmail.com wrote:

 Sounds great, but is there a reason that we're now starting at IE9+ and
 not IE10+, thus giving us typed arrays, web workers, web sockets, etc? I
 only ask because the kind of case where you are giving up User (and Widget,
 RPC, Timer, and other fairly high-level apis) seems to suggest that you
 might not be writing for a browser at all (htmlunit, nashorn, web worker,
 node.js).


A cross-compiled app is a good example that doesn't need User where you
can, for example, use closure to develop the UI.

I specifically pointed IE8 as it is the only supported browser missing
Object.create functionality and such apps that just depends on java.emul
are paying the price of IE8. On the other hand by just inheriting
useragent.UserAgent (not necessarily the User) an app can target older
browsers.


 Dan definitely has a point that if we're supporting modern browsers for a
 core chunk of functionality, we really shouldn't let 'modern' be 'whatever
 junk still happens to be running rather tha updating'. And besides, I can't
 always be That Guy pushing to keep all versions forever, just because IE8
 is still 11% of North America's browser usage (really:
 http://theie8countdown.com/).

 If we're cutting a browser for being old/bad/whatever in Core, but leaving
 support for it still in User, we should consider carefully why we *aren't*
 cutting deeper.


Can you be more specific?



 On Monday, June 30, 2014 2:59:12 PM UTC-5, Goktug Gokdogan wrote:

 We are planning to drop support for IE8 if the application doesn't
 inherit c.g.gwt.useragent.UserAgent and hence not have browser permutations.

 Nearly all of today's apps inherit User so they will not be affected by
 this change. In the future more apps will only inherit Core however they
 shouldn't need to pay price of IE8 support (currently they do because there
 are no permutations in Core).

 Let me know if you have any concerns.

  - Goktug

  --
 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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/google-web-toolkit-contributors/45b68163-0d07-4a6c-9932-412232e2f71d%40googlegroups.com
 https://groups.google.com/d/msgid/google-web-toolkit-contributors/45b68163-0d07-4a6c-9932-412232e2f71d%40googlegroups.com?utm_medium=emailutm_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 google-web-toolkit-contributors+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-web-toolkit-contributors/CAN%3DyUA3RE5rhniA4t23odWbGxwXeo0Fdfbsz2n1SPyRN4E_1jg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.