Thursday, February 9, 2017

Re: List of native JsType


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.

Native JsTypes consume existing Javascript. In your JS file however you only have a JS function returning some generic JS object. JsInterop expects that you have also defined $wnd.com.test.client.interop.InteropTest because you have only annotated your class with @JsType(isNative = true) which defaults to a full qualified class name / constructor function in JS. For a generic JS object you would need to use @JsType(isNative = true, namespace = GLOBAL, name = "Object"). That way your InteropTest class is treated as a generic JS object like you return from your function.

AFAICT your working case should have also failed but I guess somehow no casting has been emitted to JS.

-- J.

--
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