Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » JvmEnumerationLiteral has no support for parameters(Suggested enhamcement for Xtend )
JvmEnumerationLiteral has no support for parameters [message #1724941] Sat, 27 February 2016 12:42 Go to next message
Scott Forbes is currently offline Scott ForbesFriend
Messages: 4
Registered: February 2016
Junior Member
Hi! I'm converting an old Xpand model-to-Java project to Xtend 2.9.1 and seem to have found a missing feature. My suggested fix would be:

In org.eclipse.xtext.common.types/model/JavaVMTypes.ecore
types.JvmEnumerationLiteral
add
parameters:JvmFormalParameter[*]


In org.eclipse.xtext.xbase.compiler.JvmModelGenerator
generateEnumLiteral(JvmEnumerationLiteral, ITreeAppendable, GeneratorConfig)
replace the TODO comment with
appendable.append("(")
generateEnumLiteralParameters(appendable, config)
appendable.append(")")

and add
def void generateEnumLiteralParameters(JvmEnumerationLiteral it, ITreeAppendable appendable, GeneratorConfig config)
based on
generateParameters(JvmExecutable it, ITreeAppendable appendable, GeneratorConfig config)


Enum literals will always be a special case because they are also instances.

Would that be all that was needed?

I'm more than happy to do this myself, what's the process?
Re: JvmEnumerationLiteral has no support for parameters [message #1724964 is a reply to message #1724941] Sun, 28 February 2016 08:04 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 83
Registered: January 2016
Location: Kiel
Member

I think you mixed up formal parameter declarations with actual arguments. In this case we would need the latter, i.e. expressions.
It would need to be implemented similarly to how we provide implementations for methods and initializers for fields.

See also : https://bugs.eclipse.org/bugs/show_bug.cgi?id=372771

Generally speaking you are welcome to contribute pull-requests.
See https://github.com/eclipse/xtext/blob/master/README.md#how-to-contribute for instructions.
Re: JvmEnumerationLiteral has no support for parameters [message #1725023 is a reply to message #1724964] Mon, 29 February 2016 08:00 Go to previous message
Scott Forbes is currently offline Scott ForbesFriend
Messages: 4
Registered: February 2016
Junior Member
You're right, of course. From now on I'll call the declaration 'parameters' and the instances 'arguments', that should stop me muddling them up again. Thanks very much for the workaround, it works great, I didn't find that. I get a lot of 'discouraged access' though. I'll read the contribute howto and go back to the drawing board. Thanks again.
Previous Topic:Checking if JvmFormalParameter isAssignableFrom XExpression
Next Topic:Ecore model not properly registered
Goto Forum:
  


Current Time: Sat Sep 18 05:12:43 GMT 2021

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

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

Back to the top