Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Generated validator is .java, not .xtend
Generated validator is .java, not .xtend [message #1839494] Mon, 22 March 2021 12:54 Go to next message
Eclipse UserFriend
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 13:36 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Generated validator is .java, not .xtend [message #1839508 is a reply to message #1839495] Tue, 23 March 2021 01:12 Go to previous messageGo to next message
Eclipse UserFriend
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 01:38 Go to previous messageGo to next message
Eclipse UserFriend
yes see https://www.eclipse.org/Xtext/releasenotes.html#/releasenotes/2019/12/03/version-2-20-0
Re: Generated validator is .java, not .xtend [message #1839517 is a reply to message #1839509] Tue, 23 March 2021 02:49 Go to previous messageGo to next message
Eclipse UserFriend
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 03:24 Go to previous messageGo to next message
Eclipse UserFriend
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 03:30] by Moderator

Re: Generated validator is .java, not .xtend [message #1839528 is a reply to message #1839518] Tue, 23 March 2021 07:55 Go to previous message
Eclipse UserFriend
Yes there is no good alternative for templates

Regarding the Book: besides the Xtend/Java thing it is perfectly fine
Previous Topic:Index User Data
Next Topic:Making it possible to write Xtext grammar in DSL
Goto Forum:
  


Current Time: Thu Jul 10 03:03:35 EDT 2025

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

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

Back to the top