| Summary: | [xtend] Always produce working Java code for catch clauses | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Moritz Eysholdt <moritz.eysholdt> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | Holger.Schill, sven.efftinge |
| Version: | unspecified | Flags: | sven.efftinge:
juno+
|
| Target Milestone: | M4 | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X | ||
| Whiteboard: | |||
Until https://bugs.eclipse.org/bugs/show_bug.cgi?id=365320 is not fixed we will not have the possibility to fix this issue because we would raise false errors in most of the cases. We shouldn't have this validation but make sure that working Java code is produced.
something like this :
catch (Throwable t) {
// translate catch clauses to instanceof
if (t instance of IOException) {
// handle code ...
} ...
} else {
sneakyThrow
}
}
pushed to master Closing all bugs that were set to RESOLVED before Neon.0 Closing all bugs that were set to RESOLVED before Neon.0 |
Example: ----- class foo { def bar() { try { "foo "} catch(IOException o) { "bar" } } } ----- this compiles to ----- public class foo { public String bar() { String _xtrycatchfinallyexpression = null; try { _xtrycatchfinallyexpression = "foo "; } catch (final IOException o) { _xtrycatchfinallyexpression = "bar"; } return _xtrycatchfinallyexpression; } } ----- The Java code fails to compile with the message "Unreachable catch block for IOException. This exception is never thrown from the try statement body". I'd expect to see the same validation message in Xtend.