Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Enum literal has already been defined with literal
Enum literal has already been defined with literal [message #517498] Sun, 28 February 2010 20:03 Go to next message
Dénes Harmath is currently offline Dénes HarmathFriend
Messages: 157
Registered: July 2009
Senior Member
Hi all,

I think having multiple literals for the same enum literal is a frequent use case: most DSLs allow syntactic synonyms for the same semantic value. (E.g. a "full" and an "abbreviated" one.)
But there is a validation warning on these enum literals. Can it be disabled somehow, or maybe this validation is not reasonable and should not exist?

Thanks in advance,
thSoft
Re: Enum literal has already been defined with literal [message #517788 is a reply to message #517498] Tue, 02 March 2010 02:16 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi Dennis,

the warning is there to warn users who did specify the same literal
twice by accident. We are aware that it is not nice to have
unsurpressable warnings.
The annotation feature would come in handy here. Something we propably
do post Helios.

Sven

Dennis Harmath schrieb:
> Hi all,
>
> I think having multiple literals for the same enum literal is a frequent
> use case: most DSLs allow syntactic synonyms for the same semantic
> value. (E.g. a "full" and an "abbreviated" one.)
> But there is a validation warning on these enum literals. Can it be
> disabled somehow, or maybe this validation is not reasonable and should
> not exist?
>
> Thanks in advance,
> thSoft


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
Re: Enum literal has already been defined with literal [message #517899 is a reply to message #517788] Tue, 02 March 2010 13:37 Go to previous messageGo to next message
Dénes Harmath is currently offline Dénes HarmathFriend
Messages: 157
Registered: July 2009
Senior Member
> the warning is there to warn users who did specify the same literal twice by accident.

Then I advise that synonyms must be defined grouped, e.g. this way:
enum FooType: lol = ("laughing out loud" | "lol") | rofl;

This way, information duplication is reduced, and the warning could be kept (or maybe even advance to error).
Re: Enum literal has already been defined with literal [message #1154527 is a reply to message #517899] Fri, 25 October 2013 08:56 Go to previous message
Till F. is currently offline Till F.Friend
Messages: 58
Registered: August 2012
Member
Dénes Harmath wrote on Tue, 02 March 2010 08:37
>
Then I advise that synonyms must be defined grouped, e.g. this way:
enum FooType: lol = ("laughing out loud" | "lol") | rofl;


Somewhat old thread, but I think it's worth to be brought up again. The suggestion of Dénes is great; unfortunately it has not been implemented yet.

Is there a possibility to suppress warnings by now (especially the "enum literal has been defined" one...)?
Previous Topic:Waiting for Resource Descriptions to be updated after modification
Next Topic:Customizing "Source and Libraries" of "Java Build Path" in Eclipse Platform laun
Goto Forum:
  


Current Time: Fri Jul 10 12:42:59 GMT 2020

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

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

Back to the top