Community
Participate
Working Groups
I20090518-2000. 1. enable switch fall-through detection 2. have this code switch (i) { case 1: case 2: System.out.println(2); break; default: break; } ==> case1 falls-through into case 2 but it is not reported.
While this is a common code pattern some users would still like to detect such a scenario to catch mistakes. However, we should not change existing diagnosis but instead offer a new of strict mode where this is detected.
Unlike the case with missing break or return, I don't think the empty body case is worth another warning/preference. We currently do the same as javac (see bug 67836), and I think that's the best balance between worthwhile detection of potential problems and almost 100% false positives for a common coding pattern.
Daniel, do you really want to see this fixed or you agree with Markus's comment ?
Markus is right but there are situations where you would like to detect/see such cases. I suggest we keep the bug open but not work on it for now.