The EHC Class should implement both equals(Object) and hashCode() methods. EHC warnings appear if an equals() method was specified without a hashCode() method, or vice versa. This warning appears if a hashCode() is specified without an equals(). This may cause a problem with some collections that expect equal objects to have equal hashcodes.

Example 1

  public class EHC_EQ_Sample_1 {
      private int seed;
     public EHC_EQ_Sample_1(int seed) {
         this.seed = seed;
     public int hashCode() {
         return seed;
     // no equals(Object o) method defined

EHC.EQ is reported for class declaration on line 8: Class defines hashCode() but does not define equals().

Related checkers