Merge pull request elastic/elasticsearch#1495 from nik9000/checkstyle_equals_hashcode
Implement hashCode where we implement equals Original commit: elastic/x-pack-elasticsearch@2f7a2db799
This commit is contained in:
commit
46558ee3f7
|
@ -5,7 +5,4 @@
|
|||
|
||||
<suppressions>
|
||||
<!-- On Windows, Checkstyle matches files using \ path separator -->
|
||||
<!-- Hopefully temporary suppression of LineLength on files that don't pass it. We should remove these when we the
|
||||
files start to pass. -->
|
||||
<!-- -->
|
||||
</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