Fix bug in key hashcode with null names or metric

This commit is contained in:
oowekyala
2017-07-27 01:18:31 +02:00
parent bccaabb00d
commit 1ee8cc4e8d
2 changed files with 2 additions and 2 deletions

View File

@ -111,7 +111,7 @@ public enum JavaClassMetricKey implements MetricKey<ASTAnyTypeDeclaration> {
@Override
public int hashCode() {
return metric.hashCode() * 31 + name.hashCode();
return (metric != null ? metric.hashCode() * 31 : 0) + (name != null ? name.hashCode() : 0);
}
};
}

View File

@ -115,7 +115,7 @@ public enum JavaOperationMetricKey implements MetricKey<ASTMethodOrConstructorDe
@Override
public int hashCode() {
return metric.hashCode() * 31 + name.hashCode();
return (metric != null ? metric.hashCode() * 31 : 0) + (name != null ? name.hashCode() : 0);
}
};