When two methods have the same implementation, either it was a mistake - something else was intended - or the duplication was intentional, but may be confusing to maintainers. In the latter case, one implementation should invoke the other.
private final static String CODE = "bounteous";
public String getCode() {
return CODE;
}
public String getName() { // Noncompliant
return CODE;
}
private final static String CODE = "bounteous";
public String getCode() {
return CODE;
}
public String getName() {
return getCode();
}
Methods that are not accessors (getters and setters), with fewer than 2 statements are ignored.