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.
NetBeans 6.1 beta. I find the new equals/hashCode insert UI to be very non-intuitive. It requires the user to tick on which fields to include in the equals... and then again for the hashCode. I would intuitively expect to be able to select the fields once for equals and have them included in the hashCode automatically. I have been stung by forgetting to recheck the fields for inclusion in the hashCode. The case where the user wants the fields to be a part of both equals and hashCode is *much* more regular than the corner-case where it is not. I strongly suggest a rethink into the UI of this dialog... with my recommendation being to have a single selection box for inclusion of fields in both equals and hashCode. If the user wishes to customise it any further, they can edit the generated source code!
Max volunteered :)
Also, the generate equals/hashcode dialog doesn't have checkboxes for superclass fields.
I guess ideally, it should look a bit more like the "Generate Getters and Setters" dialog, only split on two sides: one for equals and one for hashCode. Checking or unchecking one box on either side should have the same effect on the other side.
"Checking or unchecking one box on either side should have the same effect on the other side." Then why have 2 sides? I really don't think there is a need to have 2 sides... the coder should be smart enough to remove the lines of code that are irrelevant. Nowadays, I use Google Collections' Objects class and ignore the Netbeans auto-generate code because it is so ugly and the process is so painful that it is actually quicker to write the code by hand! (Or have a macro)
I guess having two sides would be more flexible, but not required. To your point, developers generally use exactly the same fields for equals and hashCode implementation so having a one-sided dialog would be simpler for typical case. And as you state, the developer could modify the generated code by hand afterwards to achieve some different result.
I was generating the equals/hashcode methods for a class with many significant fields and it's a bit tedious to check every box. It would be great if the UI supported a "check all" / "uncheck all" feature like the one for generating getters and setters does.