Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 21:13 Go to next message
Erick Hagstrom is currently offline Erick HagstromFriend
Messages: 107
Registered: April 2014
Location: USA
Senior Member
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 21:27 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33224
Registered: July 2009
Senior Member
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.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Xcore] Declaring (in op) a local variable of generic type [message #1615121 is a reply to message #1610530] Fri, 13 February 2015 18:29 Go to previous messageGo to next message
Erick Hagstrom is currently offline Erick HagstromFriend
Messages: 107
Registered: April 2014
Location: USA
Senior Member
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 21:08 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33224
Registered: July 2009
Senior Member
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?


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [Xcore] Declaring (in op) a local variable of generic type [message #1616527 is a reply to message #1615294] Sat, 14 February 2015 17:04 Go to previous message
Erick Hagstrom is currently offline Erick HagstromFriend
Messages: 107
Registered: April 2014
Location: USA
Senior Member
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: Sat Oct 12 08:50:48 GMT 2024

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

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

Back to the top