if (something != null);
{
i++;
}
Notice that extra semi-colon at the end of the if statement? That burned us. (Don't mention the odd "brace on the next line" coding standard that is used the the project I just joined. I don't like it either.)
After fixing it, we wondered if Eclipse could show it as a warning. Of course, Eclipse comes to the rescue again. Under Preferences, select Java | Compiler. Then on the Style tab set "Empty Statement" from Ignore to Warning. This coding mistake could cause such large errors, that I really wish this was a default selection. In fact, after turning on this warning, we immediately found another bug of the exact same kind!
Definitely a bit to remember!
No comments:
Post a Comment