| Summary: | Casts don't appear to coerce closures | ||
|---|---|---|---|
| Product: | [Tools] Xtend | Reporter: | William R. Burdick Jr. <bill> |
| Component: | Core | Assignee: | Project Inbox <xtend-inbox> |
| Status: | NEW --- | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | dennis.huebner, moritz.eysholdt, sebastian.zarnekow, sven.efftinge |
| Version: | 2.3.0 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Bug Depends on: | 376037 | ||
| Bug Blocks: | |||
|
Description
William R. Burdick Jr.
*** Bug 370173 has been marked as a duplicate of this bug. *** Casts are generally not used in expected type inference. See also : http://groups.google.com/group/xtend-lang/browse_thread/thread/63a2181439fef757 This becomes more important when closures can coerce to abstract classes, because you may have several abstract classes implementing the same interface. With your patch to allow casts to work for this, I can now choose an abstract class by casting a literal closure. I have a closure-compatible abstract class (given my patch), called SimpleSelectionAdapter, that implements SWT's SelectionListener interface and leaves only widgetSelected() abstract and I can use a closure for it, like this: menuItem.addSelectionListener([e|...] as SimpleSelectionAdapter) If the cast doesn't work, I need to declare a new variable for this, which seems counter to Xtend's focus on programmer convenience. Something we should look at while reworking the linking / type system Is an enhancement. see also bug 403032 *** Bug 403032 has been marked as a duplicate of this bug. *** |