Alain Ravet wrote: > "Thomas Singer" wrote : > >>For me a toString() method would be enough -- simply for debugging >> > purposes. > > I'm not bringing back the "All objects should be canonical" thread/war, > but if > equals() is not the same as == > in a user-defined class, > equals() should be overwriten or throw an "Not Yet Implemented" exception. > Same for hashCode(). > That'll be fun, having all sorts of objects thrown exceptions when you put them in maps, and whenever an 'implicit' call to equals/hashCode is done.
> Do you really like coding equals() by hand, for a "simple" class with 3 > booleans, 3 ints, 3 Strings, 3 arrays of String, .. > It's a simple - automatizable - recipe. > A patient and well trained monkey could do it. > Or a doclet. > Or IDEA > It's a monkey task if you implement it monkey style. I'd recommend a more intelligent approach to defining equals. The foolish way of doing it would be to compare every single field. The intelligent way is to do as little work as possible, and figure out the 'primary key' of your object, and do the comparison on that. The same goes for hashcode. Why do it the brute force way if you can find a more elegant way? Which leads me onto another rant! I have a somewhat odd request, can the IDEA team please NOT listen to users so much? I have a lot of faith in the intelligence and talent of the team, but much, much less in the users. It feels like (and I hope it's just me being crazy) the team is taking user suggestions and ideas too seriously, and working hard at implementing too many of them. Lets hope the development of IDEA does not become a democracy/mob rule, but remain as it's always been, the product of a small group of highly talented and visionary people. Hani _______________________________________________ Eap-features mailing list [EMAIL PROTECTED] http://www.intellij.com/mailman/listinfo/eap-features
