A very common bug on my development team is forgetting to, or incorrectly overriding equals and hashcode.
While the pattern is simple, there's a lot of boilerplate code that goes into doing this correctly. Implementing
While sometimes this needs to be done in a custom fashion, almost always this is simple a checking of types followed by a checking of an ordered set of fields.
In the absence of compiler support (while I hope is coming), can a code generator/analysis tool help with this problem?
What would be idea is to simply tag properties or fields with an attribute (say [EC_KEY] (for Equality/Comparison Key)). Then all the appropriate routines for checking those fields/properties (in lexical order) would be generated (using those field's type's corresponding equality or comparison operators and, of course, natural ordering for primitives)
Ideally, the analysis tool would report as error objects where no tags (or explicit overloads) were found, but could have tags like [EQ_ALL] (to use all fields/properties) or [EQ_IGNORE] to explicitly ignore the class.