Menu

#491 SwitchStmtsShouldHaveDefault

open
nobody
rules (229)
5
2012-10-07
2007-08-23
rdasilva
No

I think the SwitchStmtsShouldHaveDefault rule should be amended, or a new rule should be added for the special case of covering Enum types in a switch statement. For enum switch statements it would make more sense to warn if there's a missing Enum case, rather than that the 'default' case is missing. If you add a default, you won't be told that your switch doesn't cover all eventualities, and you may not get the Exception or Error that you throw in your 'default' until the Enum value is of the type you've just added. For full details see forum post:

http://sourceforge.net/forum/forum.php?thread_id=1807970&forum_id=188194

Discussion


Log in to post a comment.