Remove suppression and implement hashCode
Original commit: elastic/x-pack-elasticsearch@0505f28e78
This commit is contained in:
parent
390bbecf4b
commit
97e8cdc5f0
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue