Summary: | "Unreachable code" erroneously reported after if( ... ) { throw ... } | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Anton Tagunov <atagunov> |
Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
Status: | RESOLVED INVALID | QA Contact: | |
Severity: | normal | ||
Priority: | P3 | CC: | fraenkel |
Version: | 3.1 | ||
Target Milestone: | 3.1 M5 | ||
Hardware: | PC | ||
OS: | Windows NT | ||
Whiteboard: |
Description
Anton Tagunov
2004-12-17 12:47:57 EST
The error is correct. You have a semicolon as the then clause for the if hence the throws clause always occurs. This makes any statements following unreachable. If you try your code on java compiler it too should and does report the same error. Thanks Michael to have pointed this :-) Thanks Michael, the compiler is indeed right. Also note that one can enable an optional compiler warning to detect empty control flow statements like this one (which are usually just mistakes): Preferences>Java>Compiler>Potential programming problems>Empty statement |