Xcore and Generics [message #1062233] |
Thu, 06 June 2013 12:01  |
Eclipse User |
|
|
|
Does xcore support generics? I have some issues, see below for example:
package test
class A<T extends B> {
contains T b
local refers derived T derivedB get {
b // I get this error: Incompatible implicit return type. Expected T but was T
}
}
class B {
}
Thanks,
David
[Updated on: Thu, 06 June 2013 12:09] by Moderator
|
|
|
|
|
|
Re: Xcore and Generics [message #1062375 is a reply to message #1062357] |
Fri, 07 June 2013 08:45  |
Eclipse User |
|
|
|
David,
That seems odd, but looks like an Xbase problem. Please open a bugzilla.
On 07/06/2013 1:52 PM, David Michonneau wrote:
> It turns out I had some conflicting Xtext plugins in my eclipse
> install that probably had side effects. I got a new eclipse, and now
> it works, but I have another issue now when adding an item to a list:
>
> package test
> import org.eclipse.emf.common.util.BasicEList
> import org.eclipse.emf.common.util.EList
> class A<T extends B> {
> contains T b
> op void test() {
> var EList<T> list = new BasicEList<T>()
> list.add(b) //Incompatible types. Expected T but was
> java.lang.Object
> }
> }
> class B {
> }
>
> I can workaround by doing list.add(b as T), but it's really strange
> that is not accepted.
|
|
|
Powered by
FUDForum. Page generated in 0.25543 seconds