ImmutableACL extends AbstractAccessControlList { @Override public int hashCode() { if (hashCode == 0) { hashCode = Objects.hashCode(getOakPath(), entries); } return hashCode; } ImmutableACL(@Nullable String oakPath,
                        @NotNull List<? extends JackrabbitAccessControlEntry> entries,
                        @NotNull RestrictionProvider restrictionProvider,
                        @NotNull NamePathMapper namePathMapper);  ImmutableACL(@NotNull AbstractAccessControlList accessControlList); @Override void removeAccessControlEntry(AccessControlEntry ace); @Override boolean addEntry(@NotNull Principal principal, @NotNull Privilege[] privileges,
                            boolean isAllow, @Nullable Map<String, Value> restrictions); @Override boolean addEntry(@NotNull Principal principal, @NotNull Privilege[] privileges, boolean isAllow, @Nullable Map<String, Value> restrictions, @Nullable Map<String, Value[]> mvRestrictions); @Override void orderBefore(@NotNull AccessControlEntry srcEntry, @Nullable AccessControlEntry destEntry); @NotNull @Override List<JackrabbitAccessControlEntry> getEntries(); @NotNull @Override RestrictionProvider getRestrictionProvider(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testHashCode() throws Exception { RestrictionProvider rp = getRestrictionProvider(); ACE ace1 = createEntry(false, PrivilegeConstants.JCR_VERSION_MANAGEMENT); ACE ace2 = createEntry(true, PrivilegeConstants.JCR_READ, PrivilegeConstants.JCR_ADD_CHILD_NODES); ACE ace2b = createEntry(true, PrivilegeConstants.REP_READ_NODES, PrivilegeConstants.REP_READ_PROPERTIES, PrivilegeConstants.JCR_ADD_CHILD_NODES); JackrabbitAccessControlList acl = createACL(ace1, ace2); JackrabbitAccessControlList repoAcl = createACL((String) null, ace1, ace2); int hc = acl.hashCode(); assertTrue(hc == createACL(ace1, ace2).hashCode()); assertTrue(hc == createACL(ace1, ace2b).hashCode()); assertTrue(repoAcl.hashCode() == createACL((String) null, ace1, ace2b).hashCode()); assertFalse(hc == createACL(ace2, ace1).hashCode()); assertFalse(hc == repoAcl.hashCode()); assertFalse(hc == createEmptyACL().hashCode()); assertFalse(hc == createACL("/anotherPath", ace1, ace2).hashCode()); assertFalse(hc == new TestACL("/anotherPath", rp, getNamePathMapper(), ace1, ace2).hashCode()); assertFalse(hc == new TestACL("/anotherPath", rp, getNamePathMapper(), ace1, ace2).hashCode()); assertFalse(hc == new TestACL("/anotherPath", rp, getNamePathMapper()).hashCode()); assertFalse(hc == new TestACL(getTestPath(), rp, getNamePathMapper(), ace1, ace2).hashCode()); }