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.
Summary: | Create toString, equals, hashCode | ||
---|---|---|---|
Product: | java | Reporter: | zwollner <zwollner> |
Component: | Editor | Assignee: | Dusan Balek <dbalek> |
Status: | RESOLVED FIXED | ||
Severity: | blocker | CC: | abien |
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
zwollner
2005-07-05 17:35:16 UTC
also if anyone wants a copy of the project let me know, I'd be happy to email it to you. sorry that last comment was ment for another issue please ingnore it or delete it Ctrl-I does not work for you? Well thanks, I never knew about that. But is there anyway to edit the template or something, because the methods arn't like I need them to be. I strongly agree this feature. Ctrl+I do the work, but it only create an empty function. What do you say if you can create the function like it. public int hashCode() { int hash = 1; hash = hash * 31 + someNonNullField.hashCode(); hash = hash * 31 + (someOtherField == null ? 0 : someOtherField.hashCode()); return hash; } You iterator all not-trasient members and generate the code, there have some rules i believe you know as well. I list them here just for the safe side. Calculate hashcode for data type long, calculate (int)f ^ (f >>> 32)) float, Float.floatToIntBits(f) double, Double.doubleToLongBits(f) Object, if is null, =0, or return its own hashCode() Same thing to equals() and toString(). It would be a great help if you can apply it. Thanks Editor issue. Probably implemented... *** Issue 66321 has been marked as a duplicate of this issue. *** equals and hashCode should be implemented as of NB6.0M8, AFAIK. toString is still missing. The toString code insert was in 5.5 (and maybe 5.0?), can't seem to find it in 6. *** Bug 171541 has been marked as a duplicate of this bug. *** |