Reports calls to equals() or compareTo() where an object is compared for equality with itself.

According to the method contracts, these operations will always return true for equals() or 0 for compareTo(). The inspection also checks the calls to Objects.equals(), Objects.deepEquals(), Arrays.equals(), Comparator.compare, and the like.

Example:

  class Foo {
    boolean foo(Object o) {
        return o.equals(o); // warning
    }

    boolean bar(String[] ss) {
        return Arrays.equals(ss, ss); // warning
    }
}