| Summary: | Preferences->Java Compiler-> Errors/Warnings -> switch case fall through enhancement | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Daniel Holmes <dholmes> | ||||
| Component: | Doc | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | enhancement | ||||||
| Priority: | P3 | CC: | daniel_megert, markus.kell.r, Olivier_Thomann | ||||
| Version: | 3.7 | Keywords: | Documentation | ||||
| Target Milestone: | 3.6.1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
|
Description
Daniel Holmes
I don't see what you expect from us. Updating the description ? If you have a return, throw or continue, the next statement is not reachable so it is not a fallthrough case. Did I misunderstand something ? I guess from the description, it was not clear until I tried it that the 'break' as mentioned in the description was inclusive of a case exiting due to return or throw conditions vs just specifically a break statement. So I guess the rule does cover this condition and maybe the documentation could be more inclusive of this. Also, did not realize until I just tested it that continue is not allowed in a switch case construct. I was taking the word of a co-worker on this :-) You can use continue to a label depending on the context. So you expect the description to be improved ? Yes, I'm suggesting to clarify the description. I understand your point on continue also is the switch happens to be in a loop. Hi Daniel,
> The description for this rules reads "When enabled, the compiler will issue an
> error or a warning whenever it encounters a switch case without a 'break'
> statement. Empty switch cases are allowed."
Are you referring to the description found in:
org.eclipse.jdt.doc.user/reference/preferences/java/compiler/ref-preferences-errors-warnings.htm ?
In the help, I also found this in JDT/Core options:
"When enabled, the compiler will issue an error or a warning when a case may be entered by falling through a preceding, non empty case."
That seems to be better, doesn't it ?
(In reply to comment #5) Yes, I like that. Released for 3.7M1 and 3.6.1. Created attachment 174651 [details]
Proposed fix
Verified in M20100825-0800. |