Giuseppe Miscione created CLEREZZA-727:
------------------------------------------
Summary: Error in hashCode implementation in
org.apache.clerezza.rdf.core.impl.TripleImpl
Key: CLEREZZA-727
URL: https://issues.apache.org/jira/browse/CLEREZZA-727
Project: Clerezza
Issue Type: Bug
Components: rdf.core
Reporter: Giuseppe Miscione
Priority: Minor
hashCode of --- class is implemented as
public int hashCode() {
return (subject.hashCode() >> 1) ^ subject.hashCode() ^ (subject.hashCode()
<< 1);
}
and it's using only the subject part of the triple. It's correct implementation
should be:
public int hashCode() {
return (subject.hashCode() >> 1) ^ predicate.hashCode() ^
(object.hashCode() << 1);
}
The actual implementation works well with its corresponding equals method (the
methods are coherent) but it can yield to performance degradation when using a
lot of TripleImpl objects with the same subject as HashMap key.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira