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.
Using: Product Version: NetBeans IDE 6.0 M10 (build 200706281431) Java: 1.5.0_12; Java HotSpot(TM) Client VM 1.5.0_12-b04 System: Linux version 2.6.9-55.0.6.ELsmp running on i386; UTF-8; en_US (nb) Observed Behavior: Summary: Using the "Generate Code..." feature to create equals and hashCode, the generated hashCode will not compile. What the code generates: To generate a hashCode for the following fields: private String name; private Date date; results in the following: public int hashCode() { int hash = 5; hash = 59 * hash + this.name != null ? this.name.hashCode() : 0; hash = 59 * hash + this.date != null ? this.date.hashCode() : 0; return hash; } which causes the following compile-time error: Compiling 1 source file to /home/lorin/NetBeans Projects/IBS Portal Packages/build/classes Test.java:42: operator + cannot be applied to int,java.util.Date hash = 59 * hash + this.date != null ? this.date.hashCode() : 0; 1 error The code should read: public int hashCode() { int hash = 5; hash = 59 * hash + (this.name != null ? this.name.hashCode() : 0); hash = 59 * hash + (this.date != null ? this.date.hashCode() : 0); return hash; } which properly compiles.
This has been fixed some time ago, thanks for the report.
.