Skip to content

Commit 9ee143c

Browse files
committed
Refactor hashCode method in AclImpl
Extract magic number 31 to variable Signed-off-by: kimjg <[email protected]>
1 parent 8295c8a commit 9ee143c

File tree

1 file changed

+10
-8
lines changed
  • acl/src/main/java/org/springframework/security/acls/domain

1 file changed

+10
-8
lines changed

acl/src/main/java/org/springframework/security/acls/domain/AclImpl.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -298,15 +298,17 @@ public boolean equals(Object obj) {
298298
@Override
299299
public int hashCode() {
300300
int result = (this.parentAcl != null) ? this.parentAcl.hashCode() : 0;
301-
result = 31 * result + this.aclAuthorizationStrategy.hashCode();
302-
result = 31 * result
301+
int thirtyOne = 31;
302+
303+
result = thirtyOne * result + this.aclAuthorizationStrategy.hashCode();
304+
result = thirtyOne * result
303305
+ ((this.permissionGrantingStrategy != null) ? this.permissionGrantingStrategy.hashCode() : 0);
304-
result = 31 * result + ((this.aces != null) ? this.aces.hashCode() : 0);
305-
result = 31 * result + this.objectIdentity.hashCode();
306-
result = 31 * result + this.id.hashCode();
307-
result = 31 * result + ((this.owner != null) ? this.owner.hashCode() : 0);
308-
result = 31 * result + ((this.loadedSids != null) ? this.loadedSids.hashCode() : 0);
309-
result = 31 * result + (this.entriesInheriting ? 1 : 0);
306+
result = thirtyOne * result + ((this.aces != null) ? this.aces.hashCode() : 0);
307+
result = thirtyOne * result + this.objectIdentity.hashCode();
308+
result = thirtyOne * result + this.id.hashCode();
309+
result = thirtyOne * result + ((this.owner != null) ? this.owner.hashCode() : 0);
310+
result = thirtyOne * result + ((this.loadedSids != null) ? this.loadedSids.hashCode() : 0);
311+
result = thirtyOne * result + (this.entriesInheriting ? 1 : 0);
310312
return result;
311313
}
312314

0 commit comments

Comments
 (0)