Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Generated validator is .java, not .xtend
Generated validator is .java, not .xtend [message #1839494] Mon, 22 March 2021 16:54 Go to next message
Martin Ceronio is currently offline Martin CeronioFriend
Messages: 3
Registered: March 2021
Junior Member
I am working my way through Implementing Domain-Specific Languages with Xtext and Xtend. I have gotten to chapter 4, dealing with Validations.

According to the book, Xtext is supposed to have generated a validator class in Xtend, but the generated file is actually a Java class file.

Did I do something wrong in following the instructions (I don't believe I did) or did something change since the book was written?
Re: Generated validator is .java, not .xtend [message #1839495 is a reply to message #1839494] Mon, 22 March 2021 17:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Newer Xtext versions generate Java by default for most extension points .
You can change that back by changing the workflow
And remove/change preferXtendStubs = false


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Generated validator is .java, not .xtend [message #1839508 is a reply to message #1839495] Tue, 23 March 2021 05:12 Go to previous messageGo to next message
Martin Ceronio is currently offline Martin CeronioFriend
Messages: 3
Registered: March 2021
Junior Member
Thank you.

May I ask why? I thought Xtend is the preferred way due to it being easier to write concise code.

Is the future direction that all extension points will move to Java and away from Xtend?
Re: Generated validator is .java, not .xtend [message #1839509 is a reply to message #1839508] Tue, 23 March 2021 05:38 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
yes see https://www.eclipse.org/Xtext/releasenotes.html#/releasenotes/2019/12/03/version-2-20-0

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Generated validator is .java, not .xtend [message #1839517 is a reply to message #1839509] Tue, 23 March 2021 06:49 Go to previous messageGo to next message
Martin Ceronio is currently offline Martin CeronioFriend
Messages: 3
Registered: March 2021
Junior Member
OK, thanks!
I signed up to Packt to read that book; glad I didn't buy it :-)
Hope there will be a third edition coming out some time.
Re: Generated validator is .java, not .xtend [message #1839518 is a reply to message #1839517] Tue, 23 March 2021 07:24 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

wrt the release note you omit what I consider to be the big plus and the big minus of Xtend.

+ String Templates make writing an M2T much much easier - far better than JET/Acceleo
- Xtend tooling understandably lags far behind JDT making Xtend development very disappointing

So I always use an Xtend layer for my StringTemplates on top of a pure Java class for the main functionality. This gives me future proofing by enabling me to promote the auto-generated StringTemplate layer to be source code should that ever become necessary.

Regards

Ed Willink

[Updated on: Tue, 23 March 2021 07:30]

Report message to a moderator

Re: Generated validator is .java, not .xtend [message #1839528 is a reply to message #1839518] Tue, 23 March 2021 11:55 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Yes there is no good alternative for templates

Regarding the Book: besides the Xtend/Java thing it is perfectly fine


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Index User Data
Next Topic:Making it possible to write Xtext grammar in DSL
Goto Forum:
  


Current Time: Fri Apr 26 07:14:59 GMT 2024

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

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

Back to the top