New JsInterop document

2,531 views
Skip to first unread message

Goktug Gokdogan

unread,
Oct 23, 2015, 3:13:55 AM10/23/15
to google-web-toolkit-contributors
As we are getting close to 2.8 release I wrote a new document that is concentrating on jsinterop features to be released in 2.8:

Thanks,

Goktug

Jens

unread,
Oct 23, 2015, 4:57:06 AM10/23/15
to GWT Contributors
What about method overloading on Java side? Doesn't seem to be mentioned in the doc so I guess its not supported and we would need to rename methods on Java side? E.g.

class Foo {
 
@JsMethod(name = "send")
 
public native void sendString(String s)

 
@JsMethod(name = "send")
 
public native void sendBlob(Blob b)
}


-- J.

Goktug Gokdogan

unread,
Oct 23, 2015, 5:08:03 AM10/23/15
to google-web-toolkit-contributors
Yes, no overloads in Java side as we don't automatically generate dispatch.
Either you need to rename or you can create a send(Object) and dispatch manually to other methods.

--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/90a200f5-07b3-4beb-934f-d90dc1d7f33c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cristian Rinaldi

unread,
Nov 9, 2015, 8:57:28 AM11/9/15
to GWT Contributors
Goktug:
   Nice Work!!!!!!

   How can we handle constructors of native types that receive parameters?
   By Example Promise in JS:
   
new Promise(executor);
new Promise(function(resolve, reject) { ... });
   
I resolve with a static method and JSNI:

public final static native Promise createPromise(PromiseFn fn) /*-{
        return new $wnd.Promise(fn);
 }-*/
;

@FunctionalInterface
@JsFunction
public interface PromiseFn {
   
void call(ResolveFn resolve, RejectedFn rejected);
}

@FunctionalInterface
@JsFunction
public interface RejectedFn {
   
void rejected(Object objs);
}


@FunctionalInterface
@JsFunction
public interface ResolveFn {
   
void resolve(Object objs);
}

There is a more correct way to do this?

Julien Dramaix

unread,
Nov 9, 2015, 9:12:36 AM11/9/15
to GWT Contributors
Create a native JsType (isNative=true)  named Promise with namespace set to GLOBAL and define both constructors. It should work.

@JsType(isNative = true, namespace = JsPackage.GLOBAL)
public class Promise {
public Promise(PromiseFn fn){};
}

--
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-co...@googlegroups.com.

Cristian Rinaldi

unread,
Nov 9, 2015, 9:40:52 AM11/9/15
to GWT Contributors
Thanks Julien!!!

This work fine!!


El viernes, 23 de octubre de 2015, 4:13:55 (UTC-3), Goktug Gokdogan escribió:

Manuel Carrasco Moñino

unread,
Nov 10, 2015, 11:15:20 AM11/10/15
to google-web-tool...@googlegroups.com
Seems that method overloading is not working anymore with JS_RC mode, it was working in JS mode though:

Example:

   boolean validate()
   boolean validate(String foo)

Is it a feature not implemented yet, or it is not in the specification?

Thanks
- Manolo


--
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-co...@googlegroups.com.

Julien Dramaix

unread,
Nov 10, 2015, 11:33:16 AM11/10/15
to google-web-tool...@googlegroups.com
Method overloading works in native JsType JsType(isNative=true)

Manuel Carrasco Moñino

unread,
Nov 10, 2015, 11:53:33 AM11/10/15
to google-web-tool...@googlegroups.com
I see, it works, thanks.

Any plan to work as well with gwt exported classes ?

Roberto Lublinerman

unread,
Nov 10, 2015, 11:59:23 AM11/10/15
to google-web-tool...@googlegroups.com

No plan to support through Java implementors, although there are plans to support varargs which would let you accomplish something similar.

Manuel Carrasco Moñino

unread,
Nov 10, 2015, 12:11:19 PM11/10/15
to google-web-tool...@googlegroups.com
var args sounds pretty good, but some kind of overloading based on the number of parameters like we had in gwt-exporter should cover many use cases, compiler could give an error (like it does now) when it sees two methods with the same-number-of-parameters signature.



Manuel Carrasco Moñino

unread,
Nov 10, 2015, 7:19:21 PM11/10/15
to google-web-tool...@googlegroups.com

Another issue in the new implementation is that it's not supported any more static shared fields in JsType native interfaces, I think if we support static methods we should support static fields as well, or is there i any reason to prevent it ?.

Goktug Gokdogan

unread,
Nov 11, 2015, 12:26:09 AM11/11/15
to google-web-toolkit-contributors
In native types, the support for static methods are same as the support for static fields; only overlays are supported because we don't modify the native types. Can you give an example that works with static methods and doesn't work with static field but should work as well? What do you mean by "static shared fields"?


wrt. overloading: we are not planning to support automatic dispatches per argument count in this version. And btw, method overloading never worked earlier and we recently added support and just for native types.

Ümit Seren

unread,
Nov 13, 2015, 9:28:26 AM11/13/15
to GWT Contributors

Is there a way to add dynamic properties to a JsType without relying on JSNI ?

With the experimental JSInterop version I had following solution:

@JsTyp
interface Options {

   @JsProperty void getSomeProp();

   @JsProperty String getSomeProp2();
   @JsProperty void setSomeProp2(String prop);

    void setSeries(String series, SeriesOptions options);
}

OptionsImpl implements Options {

     ....

     @Override
     public final native void setSeries(String series, SeriesOptions options) /*-{
           this['series'] = options;
     }*-/;
}

Or generally what’s the best practice regarding generic JS properties ?

To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

Goktug Gokdogan

unread,
Nov 13, 2015, 1:30:11 PM11/13/15
to google-web-toolkit-contributors
On Fri, Nov 13, 2015 at 6:28 AM, Ümit Seren <uemit...@gmail.com> wrote:

Is there a way to add dynamic properties to a JsType without relying on JSNI ?

With the experimental JSInterop version I had following solution:

@JsTyp
interface Options {

   @JsProperty void getSomeProp();

   @JsProperty String getSomeProp2();
   @JsProperty void setSomeProp2(String prop);

    void setSeries(String series, SeriesOptions options);
}

OptionsImpl implements Options {

     ....

     @Override
     public final native void setSeries(String series, SeriesOptions options) /*-{
           this['series'] = options;
     }*-/;
}

Or generally what’s the best practice regarding generic JS properties ?


If you are not implementing an interface with JsProperty, the best way is simply putting a JsProperty field in your class.

If you are implementing an interface, you can do what you did here but I would recommend having a separate generic utility class so that you can reuse what you have here in many places. We will probably provide a similar utility class as part of jsinterop at some stage.
 
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/f81c9a1e-a0c3-4087-882e-8fb99e7b799c%40googlegroups.com.

Paul Stockley

unread,
Nov 13, 2015, 4:21:17 PM11/13/15
to GWT Contributors
A number of the new frameworks (Angular 2, Aurelia)  are planning on using ES6 and ES7 features such as Modules, Decorators, Generators and Async functions etc. Are there plans to support these on the 2.x code base or would these only be supported by j2cl in the future? 

Ray Cromwell

unread,
Nov 13, 2015, 4:23:21 PM11/13/15
to google-web-toolkit-contributors

You could probably support Modules via a GWT linker. Generators and Async functions could be done by a GWT Generator/Linker combo + BabelJS.  There's no real plans to support ES6 in GWT, but you could arrange enough hacks with Generator/Linker/Library stuff to make GWT 2.x stuff consumable from ES6 code.

--
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-co...@googlegroups.com.

Paul Stockley

unread,
Nov 13, 2015, 4:27:36 PM11/13/15
to GWT Contributors
Do you plan on supporting these features in j2cl in the future?


On Friday, November 13, 2015 at 4:23:21 PM UTC-5, Ray Cromwell wrote:

You could probably support Modules via a GWT linker. Generators and Async functions could be done by a GWT Generator/Linker combo + BabelJS.  There's no real plans to support ES6 in GWT, but you could arrange enough hacks with Generator/Linker/Library stuff to make GWT 2.x stuff consumable from ES6 code.
On Fri, Nov 13, 2015 at 1:21 PM, Paul Stockley <pstoc...@gmail.com> wrote:
A number of the new frameworks (Angular 2, Aurelia)  are planning on using ES6 and ES7 features such as Modules, Decorators, Generators and Async functions etc. Are there plans to support these on the 2.x code base or would these only be supported by j2cl in the future? 

On Friday, October 23, 2015 at 3:13:55 AM UTC-4, Goktug Gokdogan wrote:
As we are getting close to 2.8 release I wrote a new document that is concentrating on jsinterop features to be released in 2.8:

Thanks,

Goktug

--
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+unsubscribe@googlegroups.com.

John Stalcup

unread,
Nov 13, 2015, 4:51:42 PM11/13/15
to google-web-tool...@googlegroups.com
Generally speaking J2CL seeks to support Java language features and in the process of doing so make use of modern ES6 features. When it comes to the separate topic of making advanced ES6 features (that don't exist in the Java language) available to J2CL users the path for that is via the JsInterop spec.

To be specific:

- J2CL currently outputs Closure goog.module()s instead of ES6 modules because no browser yet supports ES6 modules and we like having our output immediately runnable in the browser without a ES6to5 downsampling. When browsers support ES6 modules we are likely to switch.
- When/if the Java language provides Decorators/Generators/Async functions we will transpile them
- The JsInterop spec does not currently provide sugar for Decorators/Generators/Async functions but it might in a future revision
- You can already take advantage of Generators and Async functions (but probably not Decorators) by using JsInterop to expose a JS library to Java where that JS library exposes utility functions for Generators and Async functions


On Fri, Nov 13, 2015 at 1:27 PM, Paul Stockley <pstoc...@gmail.com> wrote:
Do you plan on supporting these features in j2cl in the future?

On Friday, November 13, 2015 at 4:23:21 PM UTC-5, Ray Cromwell wrote:

You could probably support Modules via a GWT linker. Generators and Async functions could be done by a GWT Generator/Linker combo + BabelJS.  There's no real plans to support ES6 in GWT, but you could arrange enough hacks with Generator/Linker/Library stuff to make GWT 2.x stuff consumable from ES6 code.
On Fri, Nov 13, 2015 at 1:21 PM, Paul Stockley <pstoc...@gmail.com> wrote:
A number of the new frameworks (Angular 2, Aurelia)  are planning on using ES6 and ES7 features such as Modules, Decorators, Generators and Async functions etc. Are there plans to support these on the 2.x code base or would these only be supported by j2cl in the future? 

On Friday, October 23, 2015 at 3:13:55 AM UTC-4, Goktug Gokdogan wrote:
As we are getting close to 2.8 release I wrote a new document that is concentrating on jsinterop features to be released in 2.8:

Thanks,

Goktug

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/b5adb853-08d2-42b1-a69a-fccc2d81004d%40googlegroups.com.

Ray Cromwell

unread,
Nov 13, 2015, 5:53:28 PM11/13/15
to google-web-toolkit-contributors

I think you might be able to get away with Async functions something like this:

@JsFunction
interface AsyncFunction<T> {
   T execute();
}

public class Foo {
   Promise<String> fetchJson() {
       return Async.await(Xhr.fetch("/someJson")); // returns a Promise<String>
   }
}

public class Async {
   @MustBeInlined
   public static native <T> Promise<T> await(Promise<T> x) /*-{ yield x; }-*/;
   public static native void makeFooAsync(Foo f) /*-{
     var old = f.@Foo::fetchJson;
     f.@Foo::fetchJson = function*() { return old.apply(f, arguments); } 
   }-*/;
}

But I'm not sure. I prototyped a Linker approach to doing this by running the output JS through the linker, finding all functions declared as @Async, and adding 'async' keyword in front of them, then invoking BabelJS at the end. I wrote about it in a G+ post and it works.

ES7 is quite a ways off so I'd probably suggest that for J2Cl this has to be done with some kind of similar genrule to post process the JS.

It doesn't seem a stretch to imagine that Java annotations could be harnessed to output decorators. @JsProperty is already a kind of decorator.

Personally, I think Symbols, Iterators, and Generators should be part of a future JsInterop revision, regardless of whether Java has first class support for them, there are always annotated or library based approaches that can be used.


Manuel Carrasco Moñino

unread,
Nov 14, 2015, 3:46:59 AM11/14/15
to google-web-tool...@googlegroups.com
Goktug, this is an example perfectly working with jsInteropMode=JS but not working with JS_RC :
  (Errors : Native JsType field 'String MyComponent.TAG' cannot have initializer &  Native JsType method 'String MyComponent.getTagName()' should be native or abstract)

@com.google.gwt.core.client.js.JsType

@jsinterop.annotations.JsType(isNative=true)

public interface MyComponent {

 public static String TAG = "my-component";

 public static String getTagName() {

   return TAG;

 }


 @jsinterop.annotations.JsProperty

 @com.google.gwt.core.client.js.JsProperty

 public String getFoo();


 @jsinterop.annotations.JsProperty

 @com.google.gwt.core.client.js.JsProperty

 public void setFoo(String foo);

}



public void onModuleLoad() {

 assert MyComponent.getTagName() == MyComponent.TAG;

 Element elem = Document.get().createElement(MyComponent.TAG);

 Document.get().getBody().appendChild(elem);


 MyComponent comp = (MyComponent) elem;

 comp.setFoo("bar");

}






Goktug Gokdogan

unread,
Nov 14, 2015, 9:06:10 AM11/14/15
to google-web-toolkit-contributors
I think there was a misunderstanding. You mentioned "if we support static methods we should support static fields as well" and I said both should NOT work without JsOverlay. It seems like your examples correctly gives an error for both static method and the static field because they don't have the JsOverlay.
Any method or field addition to a native type (anything doesn't already exist in the underlying native type) requires you to overlay them hence you need to put @JsOverlay.

Also note that your example uses JsType without prototype on old style annotations but uses JsType with isNative on JS_RC annotations. There are not equivalent.  If you remove the isNative, it should work same. Only difference is, you can get away with compile time constants in old style annotations as they don't need clinit.

As a clarification; you need to use native JsType classes when there is a corresponding natively provided JavaScript type and use native JsType interfaces when the corresponding native type doesn't matter or unknown.


Ümit Seren

unread,
Nov 16, 2015, 5:59:25 AM11/16/15
to GWT Contributors
Thanks for the info. 

AFAIK JSNI syntax will go away at some point. I guess I would then rely on a utility class to do that. 

One more question: 
Are there any restrictions regarding @JsProperty fields and Arrays ? 

somehow following thing dosn't work (it's not set on the object , stays undefined) 

@JsProperty void setLabels(String[] labels);

To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

Goktug Gokdogan

unread,
Nov 16, 2015, 6:26:32 AM11/16/15
to google-web-toolkit-contributors
On Mon, Nov 16, 2015 at 2:59 AM, Ümit Seren <uemit...@gmail.com> wrote:
Thanks for the info. 

AFAIK JSNI syntax will go away at some point. I guess I would then rely on a utility class to do that. 


There is going to be a replacement for JSNI by supplying supplementary js files. So if you have a class with JSNI you can still keep it future compatible but it is a good idea to minimize such classes.
 
One more question: 
Are there any restrictions regarding @JsProperty fields and Arrays ? 

somehow following thing dosn't work (it's not set on the object , stays undefined) 

@JsProperty void setLabels(String[] labels);


There is no limitation on this. Most of the time when there is such limitation, compiler gives an error or warning.
However there is a bug with respect to non public instance methods; perhaps you are hitting that. Can you provide a full snippet so that I can take a look?
 
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/1f976d9f-6882-409c-8682-fbae0d896683%40googlegroups.com.

Ümit Seren

unread,
Nov 16, 2015, 7:29:59 AM11/16/15
to GWT Contributors

Ok, I think the issue regarding setLabels(String[] labels) is my fault.

Previously I had an interface that was annotated with @JsType and a class that was implementing it and when I switched to the latest JS_RC JsInterop I re-created the implementing class from scratch but with empty function bodies (don’t know why I did that):

@JsType
public interface Options {

  @JsProperty void setLabels(String[] labels);
}

class OptionsImpl implements Options {

  @Override
  public void setLabels(String[] labels) { 
  }
}

I guess that’s the reason why labels wasn’t set, I probably need to add a field and assign it in the OptionsImpl class.

But I decided to drop the interface anyways and just move everything into the OptionsImpl class (easier to maintain).

Sorry for the inconvenience 

To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

...

Ümit Seren

unread,
Nov 17, 2015, 4:49:57 AM11/17/15
to GWT Contributors

Ok I can confirm that the issue was my fault. After moving everything to a JsTyp annotated classes, everything works fine.

I have a last question regarding code size and the use if isNative=true.
I guess isNative=true is preferred and will make sure that code size stays low by not exposing the Java contract to JS.

For example I have a JS library that takes configuration settings as an configuration object:

options = { option1:'some string',option2: 24, option3:[],..}

and I want to use JsInterop to write a type safe wrapper for this that is only used by GWT/Java code, I would create a class like this (using isNative=true instead of just an empty @JsType):

@JsType(isNative=true,namespace=JsPackage.GLOBAL,name="Object")
public class Options {
   public String option1;
   public int option2;
   ...
}

Thanks in advance


P.S:: Great work btw, the new JsInterop is a pleasure to work with. 

To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

...

Julien Dramaix

unread,
Nov 17, 2015, 6:27:50 AM11/17/15
to GWT Contributors
Your example is correct, this is the way to do. You can also add some logic to your object (for initialization for instance) by using overlay methods

@JsType(isNative=true,namespace=JsPackage.GLOBAL,name="Object") 
public class Options { 
  public String option1; 
  public int option2;

  @JsOverlay
  public Options init(String option1, int option2) {
    this.option1 = option1;
    this.option2 = option2;

   return this;
  } 
}

Options options = new Options().init("some string", 24);

Julien

To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

...

--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/1092818f-d58c-43b2-8dbb-5041e6626c90%40googlegroups.com.

Jens

unread,
Nov 17, 2015, 7:18:27 AM11/17/15
to GWT Contributors

Options options = new Options().init("some string", 24);

Its not directly mentioned in the new spec document but I hope static methods are also valid for @JsOverlay? E.g.

Options options = Options.create("some string", 24); 

-- J.

Ümit Seren

unread,
Nov 17, 2015, 7:50:03 AM11/17/15
to GWT Contributors
Seems to be work ;-) 

Goktug Gokdogan

unread,
Nov 17, 2015, 11:30:16 AM11/17/15
to google-web-toolkit-contributors
Instance methods, static methods and compile time constants can be marked with JsOverlay. Feel free to send a patch for updating the javadoc if it is not already there :)

--
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-co...@googlegroups.com.

Goktug Gokdogan

unread,
Nov 17, 2015, 11:50:13 AM11/17/15
to google-web-toolkit-contributors
If the type is native, we don't generate code for the class we assume it exists somewhere. If it is not native, we generate code for the class like we do for every other class. The best way to think about how jsinterop works is thinking with ES6 classes.
@JsType
class X {
  static void m() { .. }
  @JsProperty void setK(int k) { .. }
}

X x = new X();
x.k = 42;

results w/ code equlivant to following ES6 code:

// JavaScript
class X {
  static m() { ... }
  set k() { ... }
}

var x = new X();
x.k = 42;

if you use is isNative=true,  then it would just look like:
// No class is generated, assume X is defined somewhere else
var x = new X(); 
x.k = 42;
Also thinking them as ES6 classes is useful because then you would see another problem with your example if you don't use isNative=true:
Because there is a corresponding class, assigning instances from Object literal is not safe; "{k: 42} instanceof X" is "false" even in javascript.


To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

...

--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/1092818f-d58c-43b2-8dbb-5041e6626c90%40googlegroups.com.

Ümit Seren

unread,
Nov 18, 2015, 4:22:15 AM11/18/15
to GWT Contributors
Great thanks, that makes it much clearer. 

To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

...

<div title="MDH:T2sgSSBjYW4gY29uZmlybSB0aGF0IHRoZSBpc3N1ZSB3YXMgbXkgZmF1bHQuIEFmdGVyIG1vdmlu ZyBldmVyeXRoaW5nIHRvIGEgSnNUeXAgYW5ub3RhdGVkIGNsYXNzZXMsIGV2ZXJ5dGhpbmcgd29y a3MgZmluZS7CoDxkaXY+PGJyPjwvZGl2PjxkaXY+SSBoYXZlIGEgbGFzdCBxdWVzdGlvbiByZWdh cmRpbmcgY29kZSBzaXplIGFuZCB0aGUgdXNlIGlmIGlzTmF0aXZlPXRydWUuIDxicj5JIGd1ZXNz IGlzTmF0aXZlPXRydWUgaXMgcHJlZmVycmVkIGFuZCB3aWxsIG1ha2Ugc3VyZSB0aGF0IGNvZGUg c2l6ZSBzdGF5cyBsb3cgYnkgbm90IGV4cG9zaW5nIHRoZSBKYXZhIGNvbnRyYWN0IHRvIEpTLiZu YnNwOzwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+Rm9yIGV4YW1wbGUgSSBoYXZlIGEgSlMgbGli cmFyeSB0aGF0IHRha2VzIGNvbmZpZ3VyYXRpb24gc2V0dGluZ3MgYXMgYW4gY29uZmlndXJhdGlv biBvYmplY3Q6Jm5ic3A7PC9kaXY+PGRpdj48YnI+PC9kaXY+PGRpdj5gYGA8L2Rpdj48ZGl2Pm9w dGlvbnMgPSB7IG9wdGlvbjE6J3NvbWUgc3RyaW5nJyxvcHRpb24yOiAyNCwgb3B0aW9uMzpbXSwu Ln08L2Rpdj48ZGl2PmBgYDwvZGl2Pjxka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L2Rpdj48L3NwYW4+PGRpdj48ZGl2PjxkaXY+PGJyPjxk aXY+T24gTW9uLCBOb3YgOSwgMjAxNSBhdCAzOjQwIFBNLCBDcmlzdGlhbiBSaW5hbGRpIDxzcGFu IGRpcj0ibHRyIj4mbHQ7PGEgcmVsPSJub2ZvbGxvdyI+Y3NyaS4uLkBnbWFpbC5jb208L2E+Jmd0 Ozwvc3Bhbj4gd3JvdGU6PGJyPjxibG9ja3F1b3RlIHN0eWxlPSJtYXJnaW46MCAwIDAgLjhleDti b3JkZXItbGVmdDoxcHggI2NjYyBzb2xpZDtwYWRkaW5nLWxlZnQ6MWV4Ij48ZGl2IGRpcj0ibHRy Ij5UaGFua3MgSnVsaWVuISEhPGRpdj48YnI+PC9kaXY+PGRpdj5UaGlzIHdvcmsgZmluZSEhPHNw YW4+PGJyPjxicj5FbCB2aWVybmVzLCAyMyBkZSBvY3R1YnJlIGRlIDIwMTUsIDQ6MTM6NTUgKFVU Qy0zKSwgR29rdHVnIEdva2RvZ2FuIGVzY3JpYmnDszo8L3NwYW4+PHNwYW4+PGJsb2NrcXVvdGUg c3R5bGU9Im1hcmdpbjowO21hcmdpbi1sZWZ0OjAuOGV4O2JvcmRlci1sZWZ0OjFweCAjY2NjIHNv bGlkO3BhZGRpbmctbGVmdDoxZXgiPjxkaXYgZGlyPSJsdHIiPkFzIHdlIGFyZSBnZXR0aW5nIGNs b3NlIHRvIDIuOCByZWxlYXNlIEkgd3JvdGUgYSBuZXcgZG9jdW1lbnQgdGhhdCBpcyBjb25jZW50 cmF0aW5nIG9uIGpzaW50ZXJvcCBmZWF0dXJlcyB0byBiZSByZWxlYXNlZCBpbiAyLjg6PGRpdj48 YSBocmVmPSJodHRwczovL2RvY3MuZ29vZ2xlLmNvbS9kb2N1bWVudC9kLzEwZm1sRVlJSGN5ZWFk

Paul Stockley

unread,
Nov 19, 2015, 9:22:33 AM11/19/15
to GWT Contributors
We wrote our own RPC mechanism that is based entirely on JSON, mainly for performance reasons on mobile. The client works with JS Overlay representation of the server DTO objects. We have a tool that automatically generates the JSO's, Looking at the new interop spec's it would be really nice for the client and server to work with the same Java DTO objects. I can see how most of it could work with the new system. However, we handle Java object representations for ints, doubles, booleans and also enumerations by generating code in the JSO's such as :

public class ContractDoJSO extends PersistentDataObjectBaseJSO {

protected ContractDoJSO() {}

    public final native ContractType getContractTypeDv() /*-{
               return (this.contractTypeDv == null) ? null : @com.ocs.shared.businesslogic.contract.ContractType::valueOf(Ljava/lang/String;)(this.contractTypeDv); 
    }-*/;

public final native void setContractTypeDv(ContractType v) /*-{ this.contractTypeDv = (v == null) ? null : v.@com.ocs.shared.businesslogic.contract.ContractType::name()(); }-*/;

public final native java.lang.Integer getPreferredEmployerId() /*-{ 
          return (this.preferredEmployerId == null) ? null : @java.lang.Integer::valueOf(I)(this.preferredEmployerId); 
}-*/;
public final native void setPreferredEmployerId(java.lang.Integer v) /*-{ 
     this.preferredEmployerId = (v == null) ? null : v.@java.lang.Integer::intValue()(); 
}-*/;

In addition, if the DTO's contain arrays the client code has to access them using the JsArray class rather than the java collection API. Do you think there is some way to have a single representation using the new Interop mechanism?
 

On Friday, October 23, 2015 at 3:13:55 AM UTC-4, Goktug Gokdogan wrote:

Goktug Gokdogan

unread,
Nov 19, 2015, 1:15:35 PM11/19/15
to google-web-toolkit-contributors
Instead of JsArray, you can use Object[] or JsType[] (will be ready by 2.8), instead of Integer, you can Double (in 2.8 release, Double exactly maps to number in javascript).

--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/1155c295-ecd1-4cdd-86a2-ddf3cffb618c%40googlegroups.com.

Slava Pankov

unread,
Nov 20, 2015, 10:56:06 PM11/20/15
to GWT Contributors
And it would be nice to generate java code with new jsinterop annotations based on typescript d.ts files. Dart team is going to implement such tool, probably it can be adopted for GWT as well: https://github.com/dart-lang/sdk/issues/24874
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

Goktug Gokdogan

unread,
Nov 20, 2015, 11:02:13 PM11/20/15
to google-web-toolkit-contributors
dramaix@ is writing such a tool; that's how we are planning to generate Elemental2.

To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.

--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/44c98d88-8d67-4f17-b942-4f7202aeac3b%40googlegroups.com.

Ümit Seren

unread,
Dec 4, 2015, 10:23:31 AM12/4/15
to GWT Contributors
I guess I can't  put native JsInterop classes and interfaces in Java Collections ? 
I get a ClassCastException and I checked the official JsInterop documentation and couldn't find anthing about that ?
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

Goktug Gokdogan

unread,
Dec 4, 2015, 2:49:02 PM12/4/15
to google-web-toolkit-contributors
That's not fixed yet. Should be fixed before RC1.

To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/cd869b99-e7c5-4caa-b105-ce1e533ff8a8%40googlegroups.com.

Grzegorz Nowak

unread,
Dec 6, 2015, 3:38:34 PM12/6/15
to GWT Contributors
I've been testing JsInterop for 'export java lib to js' use case and two things came up:

1. Annotations have RetentionPolicy.RUNTIME which means the library I'm exporting must have compile time dependency on gwt-user. There are 2 ways to fix it: change the retention to 'source' (AutoValue does that so there is no need for compile time dependency on AutoValue annotations) or generate separate artifact with jsinterop annotations only. I guess nicer way to accomplish this would be the former but I'm not sure if it's possible. For now I'm hiding* the annotations in my base artifact.
2. The library I'm trying to export has several overloads of constructors and methods. Write now for methods I'm using @JsMethod with name to describe parameter types. For constructors there are 2 approaches I took so far. One recommended is having one @JsConstructor which is called from other @JsIgnored. The other approach is hiding* all constructors and providing single @JsConstructor Constructor(Objects...) which detects number of params and their types and mimics overloaded constructors. This generates a WARN 'unusable-by-js' which can be suppressed. Accessing such constructor from js works but requires wrapping of params with array: 'new namespace.Constructor([param1, param2, paramN]);'

* by hiding I mean automatic commenting out from base source so the alternative artifact doesn't have them.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-contributors+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

--
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+unsubscribe@googlegroups.com.

Thomas Broyer

unread,
Dec 6, 2015, 4:09:13 PM12/6/15
to GWT Contributors
We now produce a jsinterop-annotations artifact, but our deployment to Sonatype OSSRH is currently broken.

Goktug Gokdogan

unread,
Dec 6, 2015, 6:13:56 PM12/6/15
to google-web-toolkit-contributors
On Sun, Dec 6, 2015 at 12:38 PM, Grzegorz Nowak <grz3gor...@gmail.com> wrote:
I've been testing JsInterop for 'export java lib to js' use case and two things came up:

1. Annotations have RetentionPolicy.RUNTIME which means the library I'm exporting must have compile time dependency on gwt-user. There are 2 ways to fix it: change the retention to 'source' (AutoValue does that so there is no need for compile time dependency on AutoValue annotations) or generate separate artifact with jsinterop annotations only. I guess nicer way to accomplish this would be the former but I'm not sure if it's possible. For now I'm hiding* the annotations in my base artifact.
2. The library I'm trying to export has several overloads of constructors and methods. Write now for methods I'm using @JsMethod with name to describe parameter types. For constructors there are 2 approaches I took so far. One recommended is having one @JsConstructor which is called from other @JsIgnored. The other approach is hiding* all constructors and providing single @JsConstructor Constructor(Objects...) which detects number of params and their types and mimics overloaded constructors. This generates a WARN 'unusable-by-js' which can be suppressed. Accessing such constructor from js works but requires wrapping of params with array: 'new namespace.Constructor([param1, param2, paramN]);'

Support for varargs will be available before RC1, so the warning will be gone and you won't need to create an array.
 
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.

--
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-co...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-web-toolkit-contributors/e63f9a61-7f1c-415e-8a5e-34b0f1b04679%40googlegroups.com.

Brandon Donnelson

unread,
Dec 9, 2015, 4:59:30 PM12/9/15
to GWT Contributors
I noticed that isNative has been removed and exists in the doc. 

Thomas Broyer

unread,
Dec 9, 2015, 5:07:43 PM12/9/15
to GWT Contributors


On Wednesday, December 9, 2015 at 10:59:30 PM UTC+1, Brandon Donnelson wrote:
I noticed that isNative has been removed and exists in the doc. 


This commit is about com.google.gwt.core.client.js.JsType (i.e. the old annotation), not jsinterop.annotations.JsType.

Rene Hangstrup Møller

unread,
Dec 9, 2015, 5:13:04 PM12/9/15
to GWT Contributors
That is the old (and to be deleted) JsType annotation. The jsinterop.annotations.JsType still has isNative as per the spec

Brandon Donnelson

unread,
Dec 9, 2015, 5:35:27 PM12/9/15
to GWT Contributors
Turns out I imported the wrong JsType. Thanks for the help. 
Reply all
Reply to author
Forward
0 new messages