Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f915433a authored by Ian Rogers's avatar Ian Rogers Committed by Andre Eisenbach
Browse files

Fix divergent equals and hashCode behavior

Calling Objects.hash with a byte[] will call the identity hashCode on the
byte[] (data, data_mask) and this doesn't agree with the use of
Objects.deepEquals in equals.
Bug caught by error prone.

Bug: 27723540
Change-Id: Ic33f9a341165db6c9339321f81f7af63d627a2cb
parent b7f8c070
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -61,8 +61,10 @@ import java.util.UUID;

        @Override
        public int hashCode() {
            return Objects.hash(address, addr_type, type, uuid, uuid_mask, name, company,
                    company_mask, data, data_mask);
            return Objects.hash(address, addr_type, type, uuid, uuid_mask,
                                name, company, company_mask,
                                Arrays.hashCode(data),
                                Arrays.hashCode(data_mask));
        }

        @Override