| Summary: | [xbase] Validate order of types in switches, instanceof cascades and try-catch | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Sebastian Zarnekow <sebastian.zarnekow> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | anton, sven.efftinge |
| Version: | 2.4.3 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | v2.5.1 | ||
We should check that case with constant expression are duplicated.
For example:
val y = 2
val z = 2
switch x : 1 {
case 1 + y: true
case 1 + z: false
}
Here cases are duplicated and it will cause errors in generated java code.
Pushed to review: https://git.eclipse.org/r/20495 - added duplicate cases check pushed to review: https://git.eclipse.org/r/20767 Requested via bug 522520. -M. Requested via bug 522520. -M. |
The following code snippets will yield dead code: if (a instanceof CharSequence) { } else if (a instanceof String) { } switch(a) { CharSequence: a String: a } try { } catch(Exception e) { } catch(IOException e) { }