| Summary: | Missing warning "Statement unnecessarily nested within else clause" | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Clovis Seragiotto <clovis.seragiotto> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | stephan.herrmann |
| Version: | 4.15 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 10 | ||
| Whiteboard: | stalebug | ||
Without looking at the implementation I guess that "else if" is treated as one thing, differently from plain "else". Would make sense to me. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
In this case, a warning "Statement unnecessarily nested within else clause" is issued, as expected: static void foo(int n) { if (n <= 0) return; else System.out.println(); } Also in this case (again as expected): static void foo(int n) { if (n <= 0) return; else for(int i = 0; i < 1; i++) System.out.println(); } But unexpectedly not in this case: static void foo(int n) { if (n <= 0) return; else if (n > 0) System.out.println(); }