Skip to content

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

@niloc132

Description

@niloc132

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions