Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366666

Summary: [Xbase][generator] nested upperbounds
Product: [Modeling] TMF Reporter: Sven Efftinge <sven.efftinge>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 Flags: sven.efftinge: juno+
Version: 2.4.3   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Sven Efftinge CLA 2011-12-14 01:52:57 EST
given a 'map' of type Map<String,? extends Object>, it's not possible to write the following
in Java :

Set<Entry<String, ? extends Object>> entrySet = mp.entrySet();

JDT suggests :

Set<?> entrySet = map.entrySet()

Xtend allows it, which results in invalid Java code (that's related to another bug, regarding cast conversions)

But in Java it's ok to write :

for (Entry<String, ? extends Object> x : mp.entrySet()) {

However, the Xtend compiler creates a local variable

Set<Entry<String, ? extends Object>> _entrySet = mp.entrySet();

which renders the code invalid.
Comment 1 Sven Efftinge CLA 2012-04-03 04:27:38 EDT
A solution would be to avoid generation of a synthetic local variable.