AbstractEntry extends ACE implements PrincipalAccessControlList.Entry { @Override public int hashCode() { if (hashCode == 0) { hashCode = Objects.hashCode(oakPath, getPrincipal().getName(), getPrivilegeBits(), Boolean.TRUE, getRestrictions()); } return hashCode; } AbstractEntry(@Nullable String oakPath, @NotNull Principal principal, @NotNull PrivilegeBits privilegeBits, @NotNull Set<Restriction> restrictions, @NotNull NamePathMapper namePathMapper); @Override @Nullable String getEffectivePath(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testHashCode() throws Exception { assertNotEquals(entryA.hashCode(), entryB.hashCode()); assertEquals(entryA.hashCode(), entryA.hashCode()); assertEquals(entryA.hashCode(), new TestEntry(entryA).hashCode()); assertEquals(entryB.hashCode(), new TestEntry(entryB).hashCode()); AbstractEntry differentRestriction = new TestEntry(entryA.getOakPath(), entryA.getPrincipal(), entryA.getPrivilegeBits(), restriction); assertNotEquals(entryA.hashCode(), differentRestriction.hashCode()); AbstractEntry differentPath = new TestEntry(PathUtils.ROOT_PATH, entryA.getPrincipal(), entryA.getPrivilegeBits(), entryA.getRestrictions().toArray(new Restriction[0])); assertNotEquals(entryA.hashCode(), differentPath.hashCode()); AbstractEntry differentPrincipal = new TestEntry(entryB.getOakPath(), EveryonePrincipal.getInstance(), entryB.getPrivilegeBits(), entryB.getRestrictions().toArray(new Restriction[0])); assertNotEquals(entryB.hashCode(), differentPath.hashCode()); AbstractEntry differentPrivs = new TestEntry(entryB.getOakPath(), entryB.getPrincipal(), bitsProvider.getBits(PrivilegeConstants.JCR_READ), entryB.getRestrictions().toArray(new Restriction[0])); assertNotEquals(entryB.hashCode(), differentPrivs.hashCode()); }