Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 342434 - [Xtend / Xbase] [compiler] usage of wildcards
Summary: [Xtend / Xbase] [compiler] usage of wildcards
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: SR1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 341770
Blocks:
  Show dependency tree
 
Reported: 2011-04-11 09:19 EDT by Sven Efftinge CLA
Modified: 2017-09-19 17:08 EDT (History)
1 user (show)

See Also:
sven.efftinge: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sven Efftinge CLA 2011-04-11 09:19:59 EDT

    
Comment 1 Sven Efftinge CLA 2011-04-11 09:21:16 EDT
For the following code :

anArrayIsAListIsAnArray() {
	val x = newArrayList('foo','bar','baz').toArray
	val arrayAccess = new ArrayAccess(x)
	arrayAccess.set(1,arrayAccess.get(0))
	return arrayAccess.get(2)
}

non compilable code is generated (wrong usage if wildcards)


// the referenced Java class for completeness :

public class ArrayAccess<T> {
	private T[] internal;
	
	public ArrayAccess(T[] internal) {
		super();
		this.internal = internal;
	}
	
	public T get(int index) {
		return internal[index];
	}
	
	public T set(int index, T value) {
		return internal[index] = value;
	}
	
	public <X> ArrayAccess<X> access(X[] val) {
		return new ArrayAccess<X>(val);
	}
	
}
Comment 2 Sebastian Zarnekow CLA 2011-04-11 09:22:56 EDT
Does it compile if you pass the type arguments to the constructor invocation? IIRC we don't have type inference for constructor args and an open issue regarding the validation of type arguments.
Comment 3 Sebastian Zarnekow CLA 2011-05-04 06:11:30 EDT
Preliminary scheduled for 2.0RC1
Comment 4 Sven Efftinge CLA 2011-05-04 09:59:04 EDT
postponed to SR1
Comment 5 Sebastian Zarnekow CLA 2011-07-18 15:54:22 EDT
Pushed to master.
Comment 6 Karsten Thoms CLA 2017-09-19 16:57:01 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 7 Karsten Thoms CLA 2017-09-19 17:08:16 EDT
Closing all bugs that were set to RESOLVED before Neon.0