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 may cause a problem with some collections that expect equal objects to have equal hashcodes.

Example 1

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

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

Related checkers