Java:S2097 raises a false positive in
import java.util.Objects;
public class Foo {
private final boolean bar = false;
public boolean equals(Object o) {
if (o == null) {
return false;
}
if (!Objects.equals(o.getClass(), getClass())) {
return false;
}
Foo other = (Foo) o;
return bar == other.bar;
}
}
in sonarlint 9.1.0.75538 in Intellij Ultimate 232.10072.27
Using the Objects method there is a bit gratuitous, but I somewhat habitually type it for equality checks. It’d be better if the rule could recognize it.