Friday, September 15, 2017

Data class in JsInterop

Hi, I need the following code needs to be generated:

function f(a,b) { return { a:a, b:b }; } 

This is super - easy in JSNI mode. However to be in the modern stream and to be portable I trying to do that using JsInterop

@JsType(namespace = JsPackage.GLOBAL)
public class JsClass {
  public String a,b; 

  public JsClass(String a, String b) { this.a=a; this.b=b; }

It seems to be working, however in the compiled code I see something super strange I can not understand:

function a_g$(){
  a_g$ = Object;

function Ezf_g$(){
  Ezf_g$ = Object;

function a3i_g$(a_0_g$, b_0_g$){
  this.a = a_0_g$;
  this.b = b_0_g$;

_.$init_1758_g$ = function Fzf_g$(){

where Ezf_g$ seems to be doing nothing, i_g$.call(this) is doing nothing, this.$init_1758_g$() is doing nothing, and a_g$() is doing nothing. 

What is this all for ? What am I missing? 
How go get the line I need with JsInterop ?


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
To post to this group, send email to
Visit this group at
For more options, visit

No comments:

Post a Comment