Skip to main content



      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 08:25 Go to next message
Eclipse UserFriend
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 09:08 Go to previous message
Eclipse UserFriend
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: Sun Jul 27 12:54:34 EDT 2025

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

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

Back to the top