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.
I think it would be very heplful if there was a tool that allowed easy creation of some basic methods like: (toString, equals, hashCode). creating thses three for almost every class is very time consuming, now I'm sure everyone creates all these slightly different so if there were some sort of template we could edit that would be very helpful.
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. ***