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.
Have suggestions to improve equals code: 1. add block to the start of method: if (this == obj) { return true; } 2. add checkbox to allow check by instance but not class: if (!(obj instanceof <currenttype>)) { return false; } this option will be useful for some JPA implementations whos getClass is not the same as current.
Here is some code from my EqualsHashCodeGenerator.java: // if (obj == this) return true; statements.add(make.If(make.Binary(Tree.Kind.EQUAL_TO, make.Identifier("this"), make.Identifier("obj")), make.Return(make.Identifier("true")), null)); //if (!(obj instanceof <this type>)) return false; statements.add(make.If(make.Unary(Tree.Kind.LOGICAL_COMPLEMENT, make.Parenthesized(make.InstanceOf(make.Identifier("obj"), make.Type(type)))), make.Return(make.Identifier("false")), null));
*** This bug has been marked as a duplicate of bug 156994 ***