@JsType
public class A {
private B myB;
private List myList=new ArrayList();
public A(){
B b=new B();
myList.add(b);
}
@JsMethod
public void setB(B var1){
myB = var1;
}
@JsMethod
public List getMyListB(){
return myList;
}
@JsMethod
public String getMyBMessage(){
return myB.getMyName();
}
}
`
`package com.major.j2cl;
/**
@author $
@title $
@description $
*/
public class B {
private String name="myName";
public B(){}
public String getMyName(){
return name;
}
}
`
goog.module("App1") const A = goog.require("com.major.j2cl.A"); goog.exportSymbol("A",A) goog.exportSymbol("A.prototype.setB",Exported.prototype.setB) goog.exportSymbol("A.prototype.getMyListB",Exported.prototype.getMyListB) goog.exportSymbol("A.prototype.getMyBMessage",Exported.prototype.getMyBMessage)
When I package the above code to use
const myA = new A() const list = myA.getMyListB() myA.setB(list.g[0]) myA.getMyBMessage()
The first question is why the outer layer of the list is wrapped with a layer of G. Can g be removed or changed to other values?
The second problem is why myA.getMyBMessage() is not called. The investigation found that it was because there was also an extra layer of g packaging after class B packaging. How can I solve this problem?
Thank you very much
`package com.major.j2cl;
import jsinterop.annotations.JsMethod; import jsinterop.annotations.JsType;
import java.util.ArrayList; import java.util.List;
@JsType public class A { private B myB; private List myList=new ArrayList(); public A(){ B b=new B(); myList.add(b); } @JsMethod public void setB(B var1){ myB = var1; } @JsMethod public List getMyListB(){ return myList; } @JsMethod public String getMyBMessage(){ return myB.getMyName(); } } `
`package com.major.j2cl;
/**
goog.module("App1") const A = goog.require("com.major.j2cl.A"); goog.exportSymbol("A",A) goog.exportSymbol("A.prototype.setB",Exported.prototype.setB) goog.exportSymbol("A.prototype.getMyListB",Exported.prototype.getMyListB) goog.exportSymbol("A.prototype.getMyBMessage",Exported.prototype.getMyBMessage)
When I package the above code to use
const myA = new A() const list = myA.getMyListB() myA.setB(list.g[0]) myA.getMyBMessage()
The first question is why the outer layer of the list is wrapped with a layer of G. Can g be removed or changed to other values? The second problem is why myA.getMyBMessage() is not called. The investigation found that it was because there was also an extra layer of g packaging after class B packaging. How can I solve this problem? Thank you very much