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
    }
}

Use the option to report test assertions report only on non-extendable library classes (like String) and primitive types. This option could be useful, when tests check equals methods.