Thanks Thomas, Yes, your are very close to what I am thinking! Note, that if such mapping cannot be "special-cased" with some jsinterop cleverness, it could be refined by an additional @JsX annotation (or two).
... Other than that, releasing Elemental 2.0 is becoming an urgent matter, IMHO. I noticed at least 2 gwt frameworks that could not wait and started rolling out their custom jsinterop-enabled basic DOM "stuff", which would otherwise belong to a proper GWT 2.8/Elemental 2 release. I also assume that Elemental 2 will include some of the "jsinterop helper/utils" discussed in this forum. On Monday, June 6, 2016 at 3:58:53 PM UTC-7, Thomas Broyer wrote: > > > > On Monday, June 6, 2016 at 9:15:43 PM UTC+2, Hristo Stoyanov wrote: >> >> Kirrill, >> I did not suggest to *convert*, but *map*. That means that if/when a >> JSInter-oped class is exported into the JS Engine (let's say V8) , the JS >> developer will see plain old js arrays, so s/he can work with them as they >> have been for ages. When Java/JsInterop developers work with the same >> structure, they can chose to view it as java.util.ArrayList, java array or >> some other java.util.Collection, thus using familiar Java APIs. It is the >> same structure in the JS Engine memory, but viewed differently. But no >> conversion involved. >> > > Some of those might work, but not all. > I.e. "seeing" a JS Array as a java.util.List might work, but not the > reverse; at least not with any java.util.List, only the one implementing > type(s) that directly map (@JsType(isNative=true)) to a JS Array. More > precisely, that means using that specific JsType on setting (and on > getting, though possibly JsInterop could special-case it; I think that's > what you're asking for); specifically, a setter taking any java.util.List > wouldn't work, as you could pass, say, a LinkedList, and GWT would be > unable to simply "map" it to a JS Array: we're compiling to JS here, > there's no boundary like with a plugin. > Currently, you could use elemental.util.ArrayOf, and I believe there will > be equivalents in due time (either GWT 2.8 proper, or Elemental 2). This is > more or less what Jens and Vassilis were talking about already. > > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.
