Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext 2.2.1 != Xtext 2.0.1 on Enumeration elements?
Xtext 2.2.1 != Xtext 2.0.1 on Enumeration elements? [message #811532] Fri, 02 March 2012 13:25 Go to next message
Nikolai Busse is currently offline Nikolai BusseFriend
Messages: 15
Registered: August 2011
Junior Member
I am currently upgrading my generator projects from Xtext 2.0.1 to 2.2.1 and have the following incompatibility:
In my Xtext, I have defined
enum CType: bool="bool" | int="int" | uint="uint" | double="double";

In my Xtend module, I use the expression
ctype.name    // where ctype is of type CType

With Xtext 2.0.1, the translated Java code is
String _name_6 = _name_5.getName();

and returns e.g. "bool".
With Xtext 2.2.1, the translated Java code is
String _name_4 = _name_3.name();

which contradicts the tooltip (this indicates name being equivalent to CType.getName())
and name() is not defined for the CType enum, so it's the method of java.lang.Enum
and returns e.g. "BOOL".

Was this an intended change?
Re: Xtext 2.2.1 != Xtext 2.0.1 on Enumeration elements? [message #811558 is a reply to message #811532] Fri, 02 March 2012 14:08 Go to previous message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi Nikolai,

yes, the linking is correct and was wrong in the old version.
However the content assist still is wrong and shouldn't suggest getName
using its short form since that is shadowed by name().

The precedence is

1) name with parenthesis
2) name without parenthesis
3) property name

A bugzilla for the content assist problem would be very helpful.

Cheers,
Sven


Am 3/2/12 2:25 PM, schrieb Nikolai Busse:
> I am currently upgrading my generator projects from Xtext 2.0.1 to 2.2.1
> and have the following incompatibility:
> In my Xtext, I have defined
> enum CType: bool="bool" | int="int" | uint="uint" | double="double";
> In my Xtend module, I use the expression
> ctype.name // where ctype is of type CType
> With Xtext 2.0.1, the translated Java code is
> String _name_6 = _name_5.getName();
> and returns e.g. "bool".
> With Xtext 2.2.1, the translated Java code is
> String _name_4 = _name_3.name();
> which contradicts the tooltip (this indicates name being equivalent to
> CType.getName())
> and name() is not defined for the CType enum, so it's the method of
> java.lang.Enum
> and returns e.g. "BOOL".
>
> Was this an intended change?
>


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Previous Topic:Multiple-variable declaration randomly broken up to many single-variable declarations
Next Topic:Please, need help on indirect left recursive problem
Goto Forum:
  


Current Time: Tue Apr 07 14:10:07 GMT 2020

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

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

Back to the top