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. Numerical and string literals are not taken into
account.
Noncompliant Code Example
private String code = 'bounteous';
public String calculateCode() {
doTheThing();
return code;
}
public String getName() { // Noncompliant
doTheThing();
return code;
}
Compliant Solution
private String code = 'bounteous';
public String getCode() {
doTheThing();
return code;
}
public String getName() {
return getCode();
}
Exceptions
Methods that are not accessors (getters and setters), with fewer than 2 statements are ignored.