autogenerated equals() and hashCode() bug
hello,
this might have been discussed before, but I had some problems with the auto-generated equals() and hashCode() when my class contains arrays...
I'm using IntelliJ 7.0.2 and Java 1.4. Java 1.4 contains the method Arrays.equals(), whereas Arrays.hashCode() was introduced in Java 5. So when IntelliJ generates the equals()-method, Arrays.equals() is used for the array, but in the hashCode()-method, the hashCode() of the array is calculated by using Object.hashCode(). A bit difficult to explain, maybe it is easier if you look at the attached file.
Anyway, I believe this is a "bug" in IntelliJ as this breaks the contract of the hashCode()-method which says that object value equality implies hash code equality.
Any thoughts?
BTW: Eclipse generated a correct equals() and hashCode() :)
Attachment(s):
SpotTheError.java
请先登录再写评论。
Hello pj,
This is indeed a bug. Could you please file a bug report at http://www.jetbrains.net/jira
?
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
hello Dmitry,
I created a jira-issue, but I'm not sure the tags are correct...
http://www.jetbrains.net/jira/browse/IDEA-17192
/pj