Community
Participate
Working Groups
I'd like to see an additional (optional) error/warning generated by the compiler when switch/case is used in a dangerous way, that is, when case parts are not terminated by a break or return statement. While there will surely be lots of "old school" C-type hackers that happily make use of this "feature", I consider it bad style and error-prone. My experience is that it's usually a bug. And since it's so hard to find it, because everything compiles fine, it would be nice to have the compiler enforce a better programming style by issuing a warning here. If you do support this, please consider that the following case with multiple case labels for the same code still needs to work: switch(..) { case 1: case 2: case 3: ... }
Nice to have. Will reconsider post 2.1
If we report these, we should also consider allowing them if there is a comment which explicitely states the fall through scenario. case 1: ... // fallthrough case 2: ... Any comment would do the trick.
*** Bug 43481 has been marked as a duplicate of this bug. ***
In 1.5 mode, these warnings should be suppressible by a @SuppressWarnings("fallthrough ") annotation.
Time permitting, but likely beyond 3.1
As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you.
*** This bug has been marked as a duplicate of bug 67836 ***