Skip to main content



      Home
Home » Modeling » EMF » Xcore and Generics
Xcore and Generics [message #1062233] Thu, 06 June 2013 12:01 Go to next message
Eclipse UserFriend
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 #1062264 is a reply to message #1062233] Thu, 06 June 2013 16:30 Go to previous messageGo to next message
Eclipse UserFriend
David,

That works for me. Which version are you using?

On 06/06/2013 6:01 PM, David Michonneau wrote:
>
> 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 {
> }
Re: Xcore and Generics [message #1062340 is a reply to message #1062264] Fri, 07 June 2013 05:40 Go to previous messageGo to next message
Eclipse UserFriend
EMF - Eclipse Modeling Framework Xcore SDK 1.0.2.v20130212-0719 org.eclipse.emf.ecore.xcore.sdk.feature.group Eclipse Modeling Project

[Updated on: Fri, 07 June 2013 05:42] by Moderator

Re: Xcore and Generics [message #1062357 is a reply to message #1062340] Fri, 07 June 2013 07:52 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Xcore and Generics [message #1062375 is a reply to message #1062357] Fri, 07 June 2013 08:45 Go to previous message
Eclipse UserFriend
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.
Previous Topic:Xcore zip download
Next Topic:Generating custom made href values when saving a model
Goto Forum:
  


Current Time: Wed Jul 30 14:32:29 EDT 2025

Powered by FUDForum. Page generated in 0.25543 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top