[gwt-contrib] When Migrating JsInterop from GWT-Exporter to @JsInterface, JSORestrictionsChecker throws NullPointerException

2014-06-06 Thread
Hello,

I tried converted two projects we are currently using GWT Exporter to 
@JsInterface for interoperate with JS. The *first project* 

 only 
exports three interfaces, and translated successfully. 

The second project's first migration step translated successfully, here are 
the commit and compile log:
https://github.com/goodow/realtime-store/commit/643e5efc2a92ac9cbcbadc8b7dd1d97e456bfe92
https://travis-ci.org/goodow/realtime-store/builds/26914674

However, i encounter a strange NullPointerException when annotates more 
@JsInterface, here are the second commit and compile log:
https://github.com/goodow/realtime-store/commit/f9b2978c6a91d6afe9cd0d6d0ebd20adbf34480a
https://travis-ci.org/goodow/realtime-store/builds/26915260

Thanks for help :)

-- 
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/b7d8bf7e-a352-4a34-8778-6c6ae963b6d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[gwt-contrib] Re: When Migrating JsInterop from GWT-Exporter to @JsInterface, JSORestrictionsChecker throws NullPointerException

2014-06-14 Thread
Will JsInterop be released in June? Can't wait for it ;-)

On Friday, June 6, 2014 11:58:16 PM UTC+8, Ray Cromwell wrote:
>
>
> JsInterop is only half implemented and not for use right now. There are 
> several big patches that are going to land soon which change a lot about 
> it. I would hold off using it until then.
>
>
>
> On Fri, Jun 6, 2014 at 1:24 AM, 田传武 > wrote:
>
>>  Hello,
>>
>> I tried converted two projects we are currently using GWT Exporter to 
>> @JsInterface for interoperate with JS. The  *first project* 
>> <https://github.com/goodow/realtime-channel/commit/e809e7cf9ee81fb4f470336212abfe113550ac8d>
>>  only 
>> exports three interfaces, and translated successfully.  
>>
>>  The second project's first migration step  translated successfully, 
>> here are the commit and compile log:
>>  
>> https://github.com/goodow/realtime-store/commit/643e5efc2a92ac9cbcbadc8b7dd1d97e456bfe92
>>  
>>  https://travis-ci.org/goodow/realtime-store/builds/26914674 
>>  
>> However, i  encounter a strange  NullPointerException when annotates 
>> more  @JsInterface,  here are the second commit and compile log:
>>  
>> https://github.com/goodow/realtime-store/commit/f9b2978c6a91d6afe9cd0d6d0ebd20adbf34480a
>>  
>>  https://travis-ci.org/goodow/realtime-store/builds/26915260 
>>  
>> Thanks for help :)
>>
>
>

-- 
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/c06f41e8-5f0d-4b21-b81a-fe80bfb6726c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[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. 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
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, "田传武" > 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. 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
>>  
>> <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 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.


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 
> > 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. 
> > get(0); 
> > 
> > to: 
> > final CollaborativeOperation first = (CollaborativeOperation) 
> > operations. get(0); 
> > 
> > -Daniel 
> > 
> > 
> > On Mon, Jun 30, 2014 at 8:09 AM, 田传武 > 
> 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, "田传武"  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. 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) 
> >>>> 
> >>>> 
> >>>> -- 
> >>>&

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. 
> get(0);
>
> to:
> final CollaborativeOperation first = (CollaborativeOperation) 
> operations. 
> get(0);
>
> -Daniel
>
>
> On Mon, Jun 30, 2014 at 8:09 AM, 田传武 > 
> 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, "田传武"  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. 
>>>> 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=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 google-web-toolkit-cont

[gwt-contrib] Questions about @JsProperty and JsType.prototype()

2014-06-30 Thread
Hi, 
When i translate a pure java library to a javascript library using 
JsInterop, i get confused about @JsProperty and JsType.prototype().

The java code looks like this:

@JsType
@JsNamespace("$wnd.realtime.store")
public class TextInsertedEvent {

  /**
   * The index of the change.
   */
  public final int index;
  /**
   * The inserted text
   */
  public final String text;


  /**
   * @param serialized The serialized event object.
   */
  TextInsertedEvent(JsonObject serialized) {
this.index = (int) serialized.getNumber("index");
this.text = serialized.getString("text");
  }


  public int index() {
return index;
  }


  public String text() {
return text;
  }
}






This TextInsertedEvent class is not allowed to be instantiated directly in 
javascript, so do not need to export its constructor.

When someone using the translated js library in a pure javascript web 
application:

1. How to prevent the prototype name from obfuscated?
e.g. realtime.store.TextInsertedEvent.isPrototypeOf(evt) should returns true
evt is a TextInsertEvent instance created from the translated library


2. How to translate to dotted property accessor instead of method calls?
e.g. enable users to call evt.text to get the actual string value, not 
evt.text()


Thanks for help :)

-- 
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/51243cc7-d7f0-4f4a-a501-77dafe52b7c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[gwt-contrib] An Open Source implementation of Google Drive Realtime API

2014-07-14 Thread
Hi all,

I'd like to share an open-source project which implements nearly all 
features of the google drive realtime api. *Google Drive Realtime API* 
 provides Google Docs–style 
instant collaboration. It lets multiple people edit the same data 
simultaneously.

This project was inspired by Google Wave, the server runs on vert.x. Just 
like Google Drive Realtime API, the javascript client library is generated 
by GWT, and the Objective-C client library is generated by *J2ObjC* 
.
It is available on github at https://github.com/goodow/realtime-store

You can try out the features of the API on the *live playground* 
, or get the *Android demo App* 

 on 
google play.
There is also an *Objective-C client library 
* for iOS and Mac OS X, but it is not 
yet fully tested, so please use at your own risk!


Enjoy!

-- 
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/9d899a0a-2450-4148-9cd7-ab552b7aafc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[gwt-contrib] instanceof not working when upgrade from 2.7.0-SNAPSHOT to 2.7.0 (maybe caused by JsInterop changes)

2015-04-11 Thread
Hi all,

when i upgrade GWT from 2.7.0-SNAPSHOT to 2.7.0, the code below is not 
working:
obj instanceof CollaborativeObjectImpl and
obj instanceof JsonObject

Here are my type declarations:
@JsType interface EventTarget 
@JsType interface CollaborativeObject extends EventTarget
@JsType interface CollaborativeString extends CollaborativeObject
abstract class CollaborativeObjectImpl implements CollaborativeObject
class CollaborativeStringImpl extends CollaborativeObjectImpl implements 
CollaborativeString

class JsJsonValue extends JavaScriptObject
interface JsonElement extends java.io.Serializable
interface JsonObject extends JsonElement
class JsJsonElement extends JsJsonValue implements JsonElement
final class JsJsonObject extends JsJsonElement implements JsonObject

the full source code is hosted at github:
https://github.com/goodow/realtime-store/blob/master/src/main/java/com/goodow/realtime/store/impl/JsonSerializer.java#L60-L69
 
and 
https://github.com/goodow/realtime-json/blob/master/src/main/java/com/goodow/realtime/json/JsonObject.java

Thanks for help :)

-- 
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/1b763bef-1a2f-4ed0-8668-3c77151acba2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.