Skip to main content



      Home
Home » Modeling » EMF » [Xcore] Declaring (in op) a local variable of generic type
[Xcore] Declaring (in op) a local variable of generic type [message #1608915] Mon, 09 February 2015 16:13 Go to next message
Eclipse UserFriend
I'm trying to write a method that returns an instance of a generic type. So, early in my method, I try to declare a local variable of that type, intending to assign it and return it later. But the Xcore editor marks it as an error and tells me, "Couldn't resolve reference to JvmType 'T'." I at first thought this was an Xbase issue, but it seems not since I can do this in Xtend. Is this a bug, or am I doing something wrong?

Code, stripped of all meaning:

Here's the xcore op:

op <T, C> T somethingGeneric(C hiC)
	{
	   var T myT
	   myT
	}


And the xtend def:

def <T, C> T somethingGeneric(C hiC)
   {
      var T myT
      myT
   }


The Xtend editor has no problem with the def as written, but the Xcore editor can't figure out what 'T' represents.
Re: [Xcore] Declaring (in op) a local variable of generic type [message #1610530 is a reply to message #1608915] Tue, 10 February 2015 16:27 Go to previous messageGo to next message
Eclipse UserFriend
Erick,

Which version of Xcore are you using? If it's the latest SR2 release,
or the Mars stream, please open a Bugzilla.

On 09.02.2015 22:13, Erick Hagstrom wrote:
> I'm trying to write a method that returns an instance of a generic type.
> So, early in my method, I try to declare a local variable of that type,
> intending to assign it and return it later. But the Xcore editor marks
> it as an error and tells me, "Couldn't resolve reference to JvmType
> 'T'." I at first thought this was an Xbase issue, but it seems not since
> I can do this in Xtend. Is this a bug, or am I doing something wrong?
>
> Code, stripped of all meaning:
>
> Here's the xcore op:
>
> op <T, C> T somethingGeneric(C hiC)
> {
> var T myT
> myT
> }
>
> And the xtend def:
>
> def <T, C> T somethingGeneric(C hiC)
> {
> var T myT
> myT
> }
>
> The Xtend editor has no problem with the def as written, but the Xcore
> editor can't figure out what 'T' represents.
Re: [Xcore] Declaring (in op) a local variable of generic type [message #1615121 is a reply to message #1610530] Fri, 13 February 2015 13:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi Ed, thanks. I'm on Luna SR1a (SR2 isn't out yet), working in Xcore SDK 1.2.2.v20150202-0452. I got it from the Xtext all-in-one update site. Is that the one intended for Luna SR2?
Re: [Xcore] Declaring (in op) a local variable of generic type [message #1615294 is a reply to message #1615121] Fri, 13 February 2015 16:08 Go to previous messageGo to next message
Eclipse UserFriend
Erick,


Yes 1.2.2 is part of EMF's upcoming SR2 release.

On 13.02.2015 19:29, Erick Hagstrom wrote:
> Hi Ed, thanks. I'm on Luna SR1a (SR2 isn't out yet), working in Xcore
> SDK 1.2.2.v20150202-0452. I got it from the Xtext all-in-one update
> site. Is that the one intended for Luna SR2?
Re: [Xcore] Declaring (in op) a local variable of generic type [message #1616527 is a reply to message #1615294] Sat, 14 February 2015 12:04 Go to previous message
Eclipse UserFriend
Thanks Ed. Submitted bug 459946, https://bugs.eclipse.org/bugs/show_bug.cgi?id=459946
Previous Topic:Is there something like a Type Hierarchy view known from the JDT?
Next Topic:How to achieve selecting impl of interface
Goto Forum:
  


Current Time: Sun Jul 06 20:48:01 EDT 2025

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

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

Back to the top