IG: two bugs a week. Does that deserve an inspection?
I've hit very same problem twice this week:
String s = "Hello " + foo;
where foo is of class Hoo, which doesn't redefine toString() from java.lang.Object.
Wouldn't that be a good candidate for 'Probable bugs' IG category?
-
Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"
Please sign in to leave a comment.
Yup, that's a good one, and one I've hit myself. Object.toString() is essentially never what you want, and it's easy to make it happen unexpectedly with a concatenation. I'll filter for enumerated classes (which get a goot toString() automatically), and I'll have to punt for interfaces (since I won't know if the implementation has a toString()). Should be pretty easy.
--Dave Griffith
Good idea. Stumbled over that one too, ooccasionally.
Maxim Shafirov (JetBrains) wrote:
Done.
--Dave Griffith
Cool! Thanks
-
Maxim Shafirov
http://www.jetbrains.com
"Develop with pleasure!"