Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shouldn't error when fields don't conflict with accessor methods #54

Open
niloc132 opened this issue Mar 14, 2023 · 0 comments
Open

Shouldn't error when fields don't conflict with accessor methods #54

niloc132 opened this issue Mar 14, 2023 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@niloc132
Copy link
Member

niloc132 commented Mar 14, 2023

Given this class

@JsType
public class Company {
  public String name;
  public String getName() {
    return name;
  }
  public void setName(String name) {
    this.name = name;
  }
}

We get the error message

/path/to/the/Company.java: Public field with public accessors not allowed in in JS exports
    public String name;
                  ^

However, this shouldn't be an error, since getName and setName aren't marked as @JsProperty. Instead, we should get this ts output:

class Company {
  name:string;
  getName():string;
  setName(name:string):void;
}

Note that adding @JsIgnore to the getter/setter methods doesn't avoid this issue.

@niloc132 niloc132 added the bug Something isn't working label Mar 14, 2023
@niloc132 niloc132 added this to the 1.1 milestone Mar 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant