| Summary: | [Xtend] Type variable causes Xtend to silently generate broken Java | ||
|---|---|---|---|
| Product: | [Tools] Xtend | Reporter: | McKinley <mckinley1411> |
| Component: | Core | Assignee: | Project Inbox <xtend-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | dennis.huebner, sebastian.zarnekow, sven.efftinge |
| Version: | 2.2.0 | Flags: | sven.efftinge:
juno+
|
| Target Milestone: | M6 | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
| Bug Depends on: | 376037 | ||
| Bug Blocks: | |||
We need to use the type's upper bound in the compiler. Given Xtend code produces a valid Java. Seems to be fixed. Requested via bug 522520. -M. Requested via bug 522520. -M. |
Build Identifier: 2.2.0.v201111181146 The follow Java and Xtend code causes Xtend to silently generate broken Java. If more type information is needed in Xtend, perhaps the IDE should highlight that error in the Xtend file. The following example was seen in the wild when I recently tried the HtmlUnit library with Xtend. public interface InterfaceA { } public class ClassB implements InterfaceA { } public class ClassC extends ClassB { public static <T extends InterfaceA> T newClassBAsInterfaceA() { return (T) new ClassC(); } } class XtendClass1 { def test() { val x = ClassC::newClassBAsInterfaceA } } This causes Xtend to produce the following broken generated Java code: @SuppressWarnings("all") public class XtendClass1 { public void test() { ? _newClassBAsInterfaceA = ClassC.newClassBAsInterfaceA(); final ? x = _newClassBAsInterfaceA; } } Reproducible: Always Steps to Reproduce: See above.