Skip to content

Unexported classes are packaged with multiple layers of packaging g #256

Description

@wowoName

`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;

/**

  • @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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions