Correction of equals(Object) and hashCode() methods.

This commit is contained in:
Ben Alex
2007-12-04 12:44:40 +00:00
parent 85085abf9e
commit 949205b369
3 changed files with 54 additions and 25 deletions

View File

@@ -141,11 +141,15 @@ public final class BasePermission implements Permission {
}
public boolean equals(Object arg0) {
if (!(arg0 instanceof BasePermission)) {
if (arg0 == null) {
return false;
}
BasePermission rhs = (BasePermission) arg0;
if (!(arg0 instanceof Permission)) {
return false;
}
Permission rhs = (Permission) arg0;
return (this.mask == rhs.getMask());
}

View File

@@ -47,12 +47,18 @@ public class CumulativePermission implements Permission {
return this;
}
public boolean equals(Object arg0) {
if (!(arg0 instanceof CumulativePermission)) {
if (arg0 == null)
{
return false;
}
if (!(arg0 instanceof Permission)) {
return false;
}
CumulativePermission rhs = (CumulativePermission) arg0;
Permission rhs = (Permission) arg0;
return (this.mask == rhs.getMask());
}