使用 Lombok, spotbugs 报 Class inherits equals() and uses Object.hashCode()错误

报错信息如下

Class inherits equals() and uses Object.hashCode()(https://spotbugs.readthedocs.io/en/latest/bugDescriptions.html#HE_INHERITS_EQUALS_USE_HASHCODE)

This class inherits `equals(Object)` from an abstract superclass, and `hashCode()` from `java.lang.Object` (which returns the identity hash code, an arbitrary value assigned to the object by the VM).  Therefore, the class is very likely to violate the invariant that equal objects must have equal hashcodes.

If you don't want to define a hashCode method, and/or don't believe the object will ever be put into a HashMap/Hashtable, define the `hashCode()` method to throw `UnsupportedOperationException`.

**Bug kind and pattern: HE - HE_INHERITS_EQUALS_USE_HASHCODE**

解决方案
在类上面添加注解 @EqualsAndHashCode(callSuper = true)

你可能感兴趣的:(使用 Lombok, spotbugs 报 Class inherits equals() and uses Object.hashCode()错误)