Remove suppression and implement hashCode

Original commit: elastic/x-pack-elasticsearch@0505f28e78
This commit is contained in:
Nik Everett 2016-02-09 21:49:13 -05:00
parent 390bbecf4b
commit 97e8cdc5f0
5 changed files with 20 additions and 4 deletions

View File

@ -5,8 +5,4 @@
<suppressions>
<!-- On Windows, Checkstyle matches files using \ path separator -->
<suppress files="shield[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]shield[/\\]SystemUser.java" checks="EqualsHashCode" />
<suppress files="shield[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]shield[/\\]XPackUser.java" checks="EqualsHashCode" />
<suppress files="watcher[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]watcher[/\\]condition[/\\]always[/\\]ExecutableAlwaysCondition.java" checks="EqualsHashCode" />
<suppress files="watcher[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]watcher[/\\]condition[/\\]never[/\\]ExecutableNeverCondition.java" checks="EqualsHashCode" />
</suppressions>

View File

@ -32,6 +32,11 @@ public class SystemUser extends User {
return o == INSTANCE;
}
@Override
public int hashCode() {
return System.identityHashCode(this);
}
public static boolean is(User user) {
return INSTANCE.equals(user);
}

View File

@ -68,6 +68,11 @@ public class XPackUser extends User {
return INSTANCE == o;
}
@Override
public int hashCode() {
return System.identityHashCode(this);
}
public static boolean is(User user) {
return INSTANCE.equals(user);
}

View File

@ -35,4 +35,9 @@ public class ExecutableAlwaysCondition extends ExecutableCondition<AlwaysConditi
return obj instanceof ExecutableAlwaysCondition;
}
@Override
public int hashCode() {
// All instances has to produce the same hashCode because they are all equal
return 0;
}
}

View File

@ -35,4 +35,9 @@ public class ExecutableNeverCondition extends ExecutableCondition<NeverCondition
return obj instanceof ExecutableNeverCondition;
}
@Override
public int hashCode() {
// All instances has to produce the same hashCode because they are all equal
return 0;
}
}