YARN-7336. Unsafe cast from long to int Resource.hashCode() method

(Contributed by Miklos Szegedi via Daniel Templeton)
This commit is contained in:
Daniel Templeton 2017-10-30 12:40:29 -07:00
parent 9a7e810838
commit d64736d589
2 changed files with 3 additions and 6 deletions

View File

@ -463,11 +463,11 @@ public String toString() {
@Override
public int hashCode() {
final int prime = 47;
long result = 0;
int result = 0;
for (ResourceInformation entry : resources) {
result = prime * result + entry.hashCode();
}
return (int) result;
return result;
}
/**

View File

@ -155,9 +155,6 @@ public int compareTo(Resource other) {
@Override
public int hashCode() {
final int prime = 47;
long result = prime + getMemorySize();
result = prime * result + getVirtualCores();
return (int) result;
return prime * (prime + Long.hashCode(getMemorySize())) + getVirtualCores();
}
}