innerbuilder
innerbuilder copied to clipboard
Feature: add option to use default JVM contructor if the constructor is empty
Can you add an option to use default JVM contructor if the constructor is empty
According to squid:S1186 is having a empty body method a coding anti-pattern.
This is behavior now:
private String name;
private int age;
public Builder() {
}
public Builder withName(String name) {
this.name = name;
return this;
}
public Builder withAge(int age) {
this.age = age;
return this;
}
public Person build() {
return new Person(this);
}
and this is the requested result
private String name;
private int age;
public Builder withName(String name) {
this.name = name;
return this;
}
public Builder withAge(int age) {
this.age = age;
return this;
}
public Person build() {
return new Person(this);
}