[gwt-contrib] Re: 2.7.0 RC1 SDM not working when using java.util.List - Example attached

2014-11-20 Thread Jan Thewes
Ok thanks so far.
Because the List.size() call is executed from GXT I don't have the 
possibility to change that call.
I've rewritten my JsArrayListWrapper and it's not a JSO any more.
So I'm good to go.

Cheers,
Jan

Am Montag, 17. November 2014 20:22:29 UTC+1 schrieb John Stalcup:

 A fix for this is now committed. Which means this code snippet will now 
 be rejected all the time.

 To accomplish the same thing you need to execute the .size() function 
 dispatch (or really any function dispatch on a List instance since you've 
 used the List interface on a JSO type) inside of a *Java* not inside of a 
 JSNI function. This is relatively straight forward if you make a static 
 Java function that takes a List instance and calls size() on it, and you 
 can call this static Java function inside of your JSNI.


 On Wed Nov 12 2014 at 4:05:26 PM John Stalcup sta...@google.com 
 javascript: wrote:

 It's more like, 50% of the time.

 Here's what's going on:

 It's currently illegal to call foo.blah() in JSNI if the variable foo is 
 either a JSO type or interface that is implemented by some JSO type.

 The error you're seeing is JsniReferenceResolver enforcing this 
 requirement, the weird part is that it should enforce it all the time but 
 it's only enforcing it 50% of the time.

 The reason this is occurring is that depending on the order that JDT 
 processes types we may or may not yet have collected the knowledge to know 
 that the java.util.List interface is used on a JSO before 
 JsniReferenceResolver performns its check.

 We need to move the correctness check to some later stage, late enough 
 that is JSO checks will always be accurate.

 In the 50% of compiles that are succeeding for you right now you're 
 actually vulnerable to runtime errors because it's outputting code that 
 attempts to call the size() function on the prototype of the list 
 parameter (and that will fail if the instance that is passed in happens to 
 be a JsArrayListWrapper).


 On Wed Nov 12 2014 at 1:27:42 PM John Stalcup sta...@google.com 
 javascript: wrote:

 I'm able to repro this both with -noincremental and -incremental, but 
 only randomly (seems about 30% of the time).

 Still looking into it.
 On Wed Nov 12 2014 at 8:24:43 AM Thomas Broyer t.br...@gmail.com 
 javascript: wrote:

 [+cc stalcup@]

 This might be because of incremental compilation: when 
 JsArrayListWrapper is in another module, that module is precompiled, so 
 the compiler knows about the type. When it's in the same module, because 
 it's the module being compiled, it can be pruned (unused) and as 
 consequence doesn't interfere with the JSNI checks.

 The workaround would be to call a static method passing the List as 
 argument, and call the size() method in that static method, in Java-land, 
 outside of JSNI.


 On Wednesday, November 12, 2014 1:39:55 PM UTC+1, Jan Thewes wrote:

 Hello guys,

 we're currently running in problems related to the SDM in GWT 2.7. 
 We've attached two examples.
 JsListWrapperWorking is an example project where everything is working 
 fine. It is CODE IDENTICAL to JsListWrapperNotWorking.
 In the latter one we've moved the source for the two classes 
 JsArrayListWrapper and JsArrayWrapper to another module.
 No source code has been touched.

 When starting SDM for JsListWrapperWorking everything is working fine.
 When starting SDM for JsListWrapperNotWorking we get following 
 exception:

 [ERROR] Errors in 'file:~/JsListWrapperNotWorking/src/
 de/gad/list/client/JsListWrapperNotWorking.java'

 [ERROR] Line 19: Referencing interface method 'java.util.List.size()': 
 implemented by 'de.gad.list.client.myListImpl.JsArrayListWrapper'; 
 references to instance methods in overlay types are illegal; use a 
 stronger 
 type or a Java trampoline method


 If you need any further information I'll provide them as soon as 
 possible!


 Cheers,

 Jan



-- 
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/21699301-33e5-4bed-a793-3ca461d681a9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[gwt-contrib] Re: 2.7.0 RC1 SDM not working when using java.util.List - Example attached

2014-11-17 Thread 'John Stalcup' via GWT Contributors
A fix for this is now committed. Which means this code snippet will now
be rejected all the time.

To accomplish the same thing you need to execute the .size() function
dispatch (or really any function dispatch on a List instance since you've
used the List interface on a JSO type) inside of a *Java* not inside of a
JSNI function. This is relatively straight forward if you make a static
Java function that takes a List instance and calls size() on it, and you
can call this static Java function inside of your JSNI.


On Wed Nov 12 2014 at 4:05:26 PM John Stalcup stal...@google.com wrote:

 It's more like, 50% of the time.

 Here's what's going on:

 It's currently illegal to call foo.blah() in JSNI if the variable foo is
 either a JSO type or interface that is implemented by some JSO type.

 The error you're seeing is JsniReferenceResolver enforcing this
 requirement, the weird part is that it should enforce it all the time but
 it's only enforcing it 50% of the time.

 The reason this is occurring is that depending on the order that JDT
 processes types we may or may not yet have collected the knowledge to know
 that the java.util.List interface is used on a JSO before
 JsniReferenceResolver performns its check.

 We need to move the correctness check to some later stage, late enough
 that is JSO checks will always be accurate.

 In the 50% of compiles that are succeeding for you right now you're
 actually vulnerable to runtime errors because it's outputting code that
 attempts to call the size() function on the prototype of the list
 parameter (and that will fail if the instance that is passed in happens to
 be a JsArrayListWrapper).


 On Wed Nov 12 2014 at 1:27:42 PM John Stalcup stal...@google.com wrote:

 I'm able to repro this both with -noincremental and -incremental, but
 only randomly (seems about 30% of the time).

 Still looking into it.
 On Wed Nov 12 2014 at 8:24:43 AM Thomas Broyer t.bro...@gmail.com
 wrote:

 [+cc stalcup@]

 This might be because of incremental compilation: when
 JsArrayListWrapper is in another module, that module is precompiled, so
 the compiler knows about the type. When it's in the same module, because
 it's the module being compiled, it can be pruned (unused) and as
 consequence doesn't interfere with the JSNI checks.

 The workaround would be to call a static method passing the List as
 argument, and call the size() method in that static method, in Java-land,
 outside of JSNI.


 On Wednesday, November 12, 2014 1:39:55 PM UTC+1, Jan Thewes wrote:

 Hello guys,

 we're currently running in problems related to the SDM in GWT 2.7.
 We've attached two examples.
 JsListWrapperWorking is an example project where everything is working
 fine. It is CODE IDENTICAL to JsListWrapperNotWorking.
 In the latter one we've moved the source for the two classes
 JsArrayListWrapper and JsArrayWrapper to another module.
 No source code has been touched.

 When starting SDM for JsListWrapperWorking everything is working fine.
 When starting SDM for JsListWrapperNotWorking we get following
 exception:

 [ERROR] Errors in 'file:~/JsListWrapperNotWorking/src/
 de/gad/list/client/JsListWrapperNotWorking.java'

 [ERROR] Line 19: Referencing interface method 'java.util.List.size()':
 implemented by 'de.gad.list.client.myListImpl.JsArrayListWrapper';
 references to instance methods in overlay types are illegal; use a stronger
 type or a Java trampoline method


 If you need any further information I'll provide them as soon as
 possible!


 Cheers,

 Jan



-- 
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/CAFw3gJ91Eqd-Ovxcy9EUADsm-BStJO9hkNvKd1t_oMyBTrHv2Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[gwt-contrib] Re: 2.7.0 RC1 SDM not working when using java.util.List - Example attached

2014-11-12 Thread Thomas Broyer
[+cc stalcup@]

This might be because of incremental compilation: when JsArrayListWrapper 
is in another module, that module is precompiled, so the compiler knows 
about the type. When it's in the same module, because it's the module being 
compiled, it can be pruned (unused) and as consequence doesn't interfere 
with the JSNI checks.

The workaround would be to call a static method passing the List as 
argument, and call the size() method in that static method, in Java-land, 
outside of JSNI.

On Wednesday, November 12, 2014 1:39:55 PM UTC+1, Jan Thewes wrote:

 Hello guys,

 we're currently running in problems related to the SDM in GWT 2.7. We've 
 attached two examples.
 JsListWrapperWorking is an example project where everything is working 
 fine. It is CODE IDENTICAL to JsListWrapperNotWorking.
 In the latter one we've moved the source for the two classes 
 JsArrayListWrapper and JsArrayWrapper to another module.
 No source code has been touched.

 When starting SDM for JsListWrapperWorking everything is working fine.
 When starting SDM for JsListWrapperNotWorking we get following exception:

 [ERROR] Errors in 
 'file:~/JsListWrapperNotWorking/src/de/gad/list/client/JsListWrapperNotWorking.java'

 [ERROR] Line 19: Referencing interface method 'java.util.List.size()': 
 implemented by 'de.gad.list.client.myListImpl.JsArrayListWrapper'; 
 references to instance methods in overlay types are illegal; use a stronger 
 type or a Java trampoline method


 If you need any further information I'll provide them as soon as possible!


 Cheers,

 Jan


-- 
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/fbf7c9f5-003b-427d-96ad-c2ab0c485af1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.