Thursday, February 9, 2017

Re: List of native JsType

Thanks for your hints.

Unfortunately neither String nor  @JsProperty works.

Looking at the js output the problem seems to be this line:

for (t$iterator = new ArrayList$1(list); t$iterator.i < t$iterator.this$01.array.length;) {
    castToNative($next(t$iterator), $wnd.com.test.client.interop.InteropTest);
  }

The variable $wnd.com.test.client.interop.InteropTest does not exist.

How can I fix this?

Am Mittwoch, 8. Februar 2017 22:34:12 UTC+1 schrieb Vassilis Virvilis:
Wild guess mode:

ints are weird in jsinterop. Basically js does not have ints. I would suggest first try with String not int and if that work with Double.

If this is not the problem:
  • Compile with preety flags so you understand what's going on
  • Start a debugging session with chrome. Other browser may work too but Chrome gives the better insights.

Step to the error (enable pause on exceptions) and try to figure out what happens. If you are like me at first you will understand nothing but later on with enough meditation you will start see patterns.

As a general notice (that doesn't apply here) jsinterop works better with generics than casts. So don't afraid to use generics but avoid casts.

Hope that helps.

    Vassilis



On Wed, Feb 8, 2017 at 8:26 PM, Kirill Prazdnikov <pki...@gmail.com> wrote:
Hi, 

You can use @JsProperty instead of "int value;":

  @JsProperty
  public abstract int getValue();


--
You received this message because you are subscribed to the Google Groups "GWT Users" 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-we...@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.



--
Vassilis Virvilis

--
You received this message because you are subscribed to the Google Groups "GWT Users" 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 https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment