This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 111806 - generated hashCode method broken
Summary: generated hashCode method broken
Status: RESOLVED DUPLICATE of bug 105209
Alias: None
Product: java
Classification: Unclassified
Component: Unsupported (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@java
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-02 18:15 UTC by _ cliffwd
Modified: 2007-09-26 09:14 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ cliffwd 2007-08-02 18:15:51 UTC
I asked NetBeans 6.0M10 to Generate the equals and hashCode methods for me.  The hashCode method is almost right.
I have a field named "loginKey" which is a String.
The generated line was:
            hash = 29 * hash + this.loginKey != null ? this.loginKey.hashCode() : 0;
but parenthesis are needed.

The right code is:
            hash = 29 * hash + (this.loginKey != null ? this.loginKey.hashCode() : 0);
Comment 1 Jiri Prox 2007-08-03 07:27:40 UTC
This is fixed now in latest daily build. See issue 105209. Thanks for your report.



*** This issue has been marked as a duplicate of 105209 ***