Questions tagged [xtend]

Xtend is a statically typed programming language that transcompiles to Java. It aims to produce more readable code than traditional Java.

Xtend is a programming language that transcompiles to Java. It aims to produce more readable code than traditional Java by reducing the amount of boilerplate code. It is developed by the Eclipse foundation.

415 questions
1
vote
1 answer

Xtend in IntelliJ IDEA not generate file in src-gen

I combine Xtext and Xtend. In project, where I write code for my DSL, Xtext work but XTend not generate file in src-gen (this is sources root on: /src-gen/). I have this code in function doGenerate override void doGenerate(Resource…
Nejc Galof
  • 2,538
  • 3
  • 31
  • 70
1
vote
0 answers

Show code coverage on Xtend files with jacoco

According to the following article: https://christiandietrich.wordpress.com/2016/01/12/code-coverage-for-xtend/ I'm able to generate coverage for Xtend with Jacoco and Maven, but SonarQube shows the coverage result on the generated Java source.…
Engee
  • 63
  • 7
1
vote
1 answer

Register HoverProvider with Xtend

I try to implement a custom HoverProvider according to this tutorial: enter link description here However, I'm stuck translating to Java code of MyDSLUiModuleto Xtend. The register-method should read like this: def Class
Klaus Schulz
  • 527
  • 1
  • 5
  • 20
1
vote
1 answer

Generate code from Metamodel via XTend

I have an Ecore model in an existing EMF project and want to print the name of all containing classes into a text file via XTend. How do you achieve this? The XTend examples don't show how to use a model and get Information out of it.
landunder
  • 372
  • 1
  • 5
  • 17
1
vote
1 answer

Xtext project JDT Independence

I created editor with Xtext 2.9.1 and now I want to make it independent of JDT. I followed this guide https://eclipse.org/Xtext/documentation/307_special_languages.html but it does not seem to work. This is my…
Smarty77
  • 1,208
  • 3
  • 15
  • 30
1
vote
1 answer

Displaying Xtend source line numbers in stack traces

Because Xtend code is compiled to Java, the stack trace contains the line numbers of the generated Java source, not the original Xtend source: package test class Main { def static void main(String[] args) { method // line #7 } …
snorbi
  • 2,590
  • 26
  • 36
1
vote
1 answer

How to do I add a parameter of type String to a generated java setter using Xtend active annotations?

I have the following snippet in my AbstractFieldProcessor.doTransformation override: field.declaringType.addMethod('set'+ field.simpleName.toFirstUpper +'Input' ) [ addParameter("values", ########) …
KennyBartMan
  • 940
  • 9
  • 21
1
vote
0 answers

How can I configure my eclipse maven project to find my Xtend main method?

I have an eclipse project which I am using maven with. I am however using Xtend. I want to run the main method in the Xtend file however I am struggling. Below is a picture of my directory structure: When I right click the project and click run as…
KennyBartMan
  • 940
  • 9
  • 21
1
vote
1 answer

XText Validation - Get the raw input during validation

I'm writing a grammar that has an existing validator. I'd like to use the existing validator to validate the code, and integrate it with the built in XText validation mechanism, so it will work seamlessley. How can I : A) - Access the raw code so I…
alexp82539
  • 77
  • 1
  • 5
1
vote
2 answers

How to leave a void method at an arbitrary point in Xtend

I want to do a very simple thing in Xtend and don't know how. I have a method with return type void. At the beginning of the method a check a condition and want to leave the method, if the condition is not fulfilled, otherwise proceed. Here is an…
Software Craftsman
  • 2,999
  • 2
  • 31
  • 47
1
vote
0 answers

Xtext & Xtend - Determine if the parameter type is a Java data type or not

I have a section in my grammar like the following Type: '(' parameter=Param ':' dataType=DataType ')' ; DataType : javaType = JvmTypeReference | ModelResource ; ModelResource : name=ID ; In the corresponding xtend, I had to determine…
Philip John
  • 5,275
  • 10
  • 43
  • 68
1
vote
1 answer

Xtend: Add element to array in for-loop

I am trying to do the simplest operation in Xtend, but don't know how. I want to add an double value to an double[] array inside a for-loop. For example: def do(EList list) { var double[] array = newDoubleArrayOfSize(list.size); …
John
  • 795
  • 3
  • 15
  • 38
1
vote
1 answer

How to get the user entered value on the spot to assist proposal generation?

I am new to xtext/xtend, and would appreciate your help here. After reading a lot of online articles/documents/tutorials, I could not find a way on how to get the user entered value. For example, let's say I have a simple grammar: Path: 'path'…
gwang
  • 153
  • 1
  • 7
1
vote
1 answer

Always add a specific 'import static extension' to an XText DSL

I am writing my own XText DSL and at some point I use a XBlockExpression where I can write any code I want. For this code, I want to use some operator overloading which I provide with a "import static extension ..." import. However, this makes the…
Martin L.
  • 680
  • 7
  • 14
1
vote
1 answer

Xtext and Xtend - Add annotations before parameters in a method

I am trying to generate a Java code like the following. public void create(@RequestBody final Resource resource) { return; } The Inferrer code snippet which I added for providing the @RequestBody is given below. members +=…
Philip John
  • 5,275
  • 10
  • 43
  • 68