[
https://issues.apache.org/jira/browse/TIKA-2472?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16195284#comment-16195284
]
Eugene Kirpichov commented on TIKA-2472:
----------------------------------------
It is not consistent with equals(), so it is definitely incorrect - Java
requires hashCode() to be consistent with equals():
https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html#hashCode() _If
two objects are equal according to the equals(Object) method, then calling the
hashCode method on each of the two objects must produce the same integer
result._
This is not the case for the code as written. Try the following:
Metadata a = new Metadata();
a.set("foo", "bar");
Metadata b = new Metadata();
b.set("foo", "bar");
a.equals(b) ==> true
a.hashCode() == b.hashCode() ==> false - and this is incorrect
> Implement Metadata.hashCode
> ---------------------------
>
> Key: TIKA-2472
> URL: https://issues.apache.org/jira/browse/TIKA-2472
> Project: Tika
> Issue Type: Improvement
> Affects Versions: 1.16
> Reporter: Sergey Beryozkin
> Assignee: Sergey Beryozkin
> Priority: Trivial
> Fix For: 1.17
>
>
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)