| Summary: | [xtend] Good code compiles to invalid java code | ||
|---|---|---|---|
| Product: | [Tools] Xtend | Reporter: | Sebastian Zarnekow <sebastian.zarnekow> |
| Component: | Core | Assignee: | Project Inbox <xtend-inbox> |
| Status: | CLOSED DUPLICATE | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | sven.efftinge |
| Version: | 2.2.0 | Flags: | sven.efftinge:
juno+
|
| Target Milestone: | M6 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
The given sample now raises the expected error Incompatible return type of dispatch method. Expected org.eclipse.xtext.common.types.JvmTypeReference but was void Unfortunately this sample snippet reveals another problem:
def dispatch type(XBinaryOperation bo, JvmTypeReference r, boolean b) {
throw new RuntimeException("This is expected")
}
The same error is raised as with the initial example.
*** This bug has been marked as a duplicate of bug 361782 *** |
Try to implement a custom type provider with Xtend: def dispatch type(XBinaryOperation bo, JvmTypeReference r, boolean b) { if (true) throw new RuntimeException("This is expected") } this compiles to: protected JvmTypeReference _type(final XBinaryOperation bo, final JvmTypeReference r, final boolean b) { Object _xifexpression = null; <--- wrong type if (true) { RuntimeException _runtimeException = new RuntimeException("This is expected"); throw _runtimeException; } return _xifexpression; }