Re: JsInterop and Java collections?

2016-06-13 Thread Thomas Broyer
On Tuesday, June 7, 2016 at 12:58:53 AM UTC+2, 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 V

Re: JsInterop and Java collections?

2016-06-10 Thread Kirill Prazdnikov
Hi Performance also matters. We build the clint for 3 platforms: iOS, Android, GWT. Storing data in nio.Buffers has HUGE performance impact on mobile platforms. I see no problem with java->C++ interop with byte[] and float[] for mobile platforms (RoboVM, Android) and desktop. I can do the sa

Re: JsInterop and Java collections?

2016-06-10 Thread Thomas Broyer
On Friday, June 10, 2016 at 11:12:27 AM UTC+2, Kirill Prazdnikov wrote: > > Hi Thomas > > Lets forget about java.util, what about simple arrays ? > > It seems that we already have java [] array -> JS Array marshalling. > And It would be very nice if we had these type of marshalling with zero >

Re: JsInterop and Java collections?

2016-06-10 Thread Kirill Prazdnikov
Hi Thomas Lets forget about java.util, what about simple arrays ? It seems that we already have java [] array -> JS Array marshalling. And It would be very nice if we had these type of marshalling with zero performance penalty: java byte[] -> Int8ArrayNative java short[] -> Int16ArrayNative

Re: JsInterop and Java collections?

2016-06-10 Thread Vassilis Virvilis
Hi all, I have already stated that I also believe it is not possible - but as a thought experiment I believe it would be possible if the two statements below could hold: 1) The implementations of java.util.List (isNative=true, namespace = JsPackage.GLOBAL, name = "Array") (and all other types) c

Re: JsInterop and Java collections?

2016-06-10 Thread Thomas Broyer
Except that there is NO marshaling! There are so many cases where it just won't work that it's not even worth trying if you ask me.You need to think about isNative vs. "exported" types, method return values vs. parameters vs. fields (which can be both get and set); object identities (calling t

Re: JsInterop and Java collections?

2016-06-09 Thread David Becker
I very much like the idea of being able to specify a mapper in the annotation. In fact, I'd like to see that in general for any type marshaling through JsInterop. That could be useful for a variety of situations, such as custom enum mappings. On Thursday, June 9, 2016 at 4:51:59 PM UTC-7, Hri

Re: JsInterop and Java collections?

2016-06-09 Thread Hristo Stoyanov
Paul, Yes, it boils down to JSInterop automatically handling some well-known implementations of java.util.List (LinkedList,ArrayList) as JS arrays. The direction Java->JS is easy: the JsInterop will map anything implementing java.util.List into js array. JS developers only see arrays on the othe

Re: JsInterop and Java collections?

2016-06-09 Thread Paul Stockley
As Thomas says, it will be impossible to support passing any of the collection interfaces directly through to JS code. You might think however, that you could change the implementation of ArrayList to actually be a JS Array. I don't think this is possible either because an instance of ArrayList

Re: JsInterop and Java collections?

2016-06-09 Thread Paul Stockley
As Thomas, says it will be impossible to support passing any of the collection interfaces directly through to JS code. You might think however, that you could change the implementation of ArrayList to actually be a JS Array. I don't think this is possible because an instance ArrayList needs to

Re: JsInterop and Java collections?

2016-06-07 Thread Juan Pablo Gardella
Someone know what is the blocker on finishing elemental 2? On Tue, 7 Jun 2016 at 14:03 Hristo Stoyanov wrote: > Here is another example > > of project that could wait no longer for Elem

Re: JsInterop and Java collections?

2016-06-07 Thread Hristo Stoyanov
Here is another example of project that could wait no longer for Elemental 2. As you can see, similar stuff, but incompatible. Let's hope Elemental 2 comes out soon enough to prevent

Re: JsInterop and Java collections?

2016-06-07 Thread Vassilis Virvilis
+1 for elemental 2.0 One project that I know of is https://github.com/workingflows/gwt-jquery that requires https://github.com/workingflows/gwt-jscore that re-implements Node for example @JsType(isNative = true) public class Node extends EventTarget { public native void bind(String property, JsOb

Re: JsInterop and Java collections?

2016-06-06 Thread Hristo Stoyanov
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

Re: JsInterop and Java collections?

2016-06-06 Thread Thomas Broyer
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 the

Re: JsInterop and Java collections?

2016-06-06 Thread Hristo Stoyanov
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

Re: JsInterop and Java collections?

2016-06-06 Thread Kirill Prazdnikov
> > Let me try to explain the issue better: > > All we need is the JsInterop to map an List (or Java array) from the Java > world into plain array in the JavaScript world. *Transparently**.* > I do not agree. About transparency. Conversion form Java List (see Linked list)to plain Js array is

Re: JsInterop and Java collections?

2016-06-05 Thread Vassilis Virvilis
As somebody that has also written js wrappers for arrays in jsinterop: While I am not an expert I believe that what you are looking for simply it is not possible. The other software cases you mention are copying values around (or serializing as already said). But with @jsinterop a collection must

Re: JsInterop and Java collections?

2016-06-05 Thread Hristo Stoyanov
Thanks Jen, Let me try to explain the issue better: In your example, JsArray must have a bunch of native methods mapped to the native JavaScript Array API. None of these methods bring much value to the Jav

Re: JsInterop and Java collections?

2016-06-05 Thread Jens
> When you think about it, other Java APIs (jaxb, jpa, Jackson) do go the > extra mile to accommodate Java collections Well kind of bad comparison right? These Java APIs either serialize/deserialize based on a defined principle or stay in Java land anyways. > , and the example above look

Re: JsInterop and Java collections?

2016-06-04 Thread Hristo Stoyanov
Thanks for the confirmation, Jen! When you think about it, other Java APIs (jaxb, jpa, Jackson) do go the extra mile to accommodate Java collections, and the example above looks like can be exported to js object (could use a helper annotation @JsX or two). As a result, now I see why Paul is tryi

Re: JsInterop and Java collections?

2016-06-04 Thread Jens
You are not missing anything. JsInterop does not do any conversion (nor does JSNI). -- 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+unsu

JsInterop and Java collections?

2016-06-03 Thread Hristo Stoyanov
Hi all, I might have missed this in the JsInterop specs, but how is JsInterop handling Java collections, e.g is this going to work at all and what will the browser's JS engine see? @JsType(isNative = true, namespace = JsPackage.GLOBAL) > public class Somethin{ > @JsProperty > public Stri