Hi
Version :
Sonarqube: 7.0, SonarJava: 5.6
Description:
The equals method invocation on variable of type lombok.val as shown below incurs a Sonar squid:S2159 which is incorrect. Given lombok’s val is type inferred; this error must be filtered out
Actal Error Message:
Remove this call to “equals”; comparisons between unrelated types always return false.
Snippet:
import lombok.val;
class LombokValSillyEqualsIssue {
public void s2159OccursForValEquals() {
val weblabTreatment = getWeblabTreatment(); // Returns a string which is either CONTROL or EXPERIMENT
if (weblabTreatment.equals("CONTROL")) {
//...This equals comparison is signalled as S2159 which is incorrect.
}
}
}