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
2
votes
1 answer

Programmatically compiling Xtend classes is not working

I am currently trying to compile programmatically generated Xtend classes. This is all part of an Eclipse plugin. This is what I do: Adding the Xtend dependencies programmatically to the target project (works). Creating programmatically some Xtend…
2
votes
1 answer

Xtext, implementing Long, Double and Float types

the question is very simple. How do I implement long, double and float types correctly in my Xtext grammar so I can use them later in my interpreter? the interpreter is an extend class. EDIT 1 In my code i have something like IDValue:…
BR.Hamza
  • 99
  • 14
2
votes
2 answers

Simple import instruction in XText

I want to add some of the objects from another file in XText to the scope. To illustrate what I need, I have this toy grammar: grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl…
Kostya
  • 1,072
  • 11
  • 24
2
votes
1 answer

What is the right syntax for Optional.orElseThrow in Xtend?

I'm stuck with a simple problem: I have a java.util.Optional and want to use the orElseThrow method to throw an exception if value is not present. However I cannot figure the right syntax to do this in Xtend. In Java, I would do: Optional
Software Craftsman
  • 2,999
  • 2
  • 31
  • 47
2
votes
2 answers

How to generate a non-abstract non-default interface method using JvmTypesBuilder

I want to generate an interface with non-default methods. For this purpose I'm using the JvmTypesBuilder. The code meth.toMethod(meth.name, meth.returnType)[] generates for example public default int meth(); Trying it with meth.toMethod(meth.name,…
Mino
  • 23
  • 3
2
votes
1 answer

How to have the AFTER separator in Xtend just behind last item

I use Xtend to generate some textual output from my Xtext grammar. My question is really simple, but I cannot figure it out reading the documentation and examples, so please give me advice! Let us assume, I have a list with some items. I generate…
Software Craftsman
  • 2,999
  • 2
  • 31
  • 47
2
votes
1 answer

Refactoring: Move Xtend class to another package

Does the latest eclipse plugin for Xtend support moving classes from one package to another (and automatically update reference to the class)? Using eclipse Mars, I try to the following: Right click file Test.xtend which contains class Test…
mxro
  • 6,588
  • 4
  • 35
  • 38
2
votes
1 answer

auto pretty formatting in xtext

I want to ask that is there a way to do Pretty formatting in xtext automatically without (ctrl+shift+f) or turning it on from preference menu. What I actually want is whenever a user completes writing the code it is automatically pretty formatted…
Mohsin
  • 112
  • 10
2
votes
1 answer

quickfix format using xtext

I am reading from the book "Implementing DSL with xtext and xtend" it says that formatter is invoked when of course the Format from the context menu is used or the shortcut for it "Ctrl + Shift + F" is used. It also says that "If you provide a…
Ayman Salah
  • 1,039
  • 14
  • 35
2
votes
2 answers

How to remove debug information in its .class file (using xtend 2.x)

I noticed that when I updated xtend from 1.20 to 2.0, the .class file is significantly larger. One difference I saw is that there are debug information in the .class files which I do not really care for. There is also an additional entry in the…
chris yo
  • 1,187
  • 4
  • 13
  • 30
2
votes
2 answers

How to access the methods for a higher rule?

During writing validation rules a came across the problem that I need some content from a rule in my grammar which is hierarchically higher than the one I pass to my validationMethod. I know that I can refer to a "higher" rule with .eContainer but…
Raven
  • 2,951
  • 2
  • 26
  • 42
2
votes
1 answer

Xtend: Is there a counterpart to the Scala singleton object in Xtend

I'm absolutely new to Xtend, but browsing the documentation and searching the Web unfortunately didn't bring up a clear answer. I really do like the way one can define a singleton object in Scala. Is there a counterpart to this in Xtend or do I have…
gjveltink
  • 31
  • 5
2
votes
1 answer

How to invoke Xtend code from Java?

I have a code generator, which takes a syntax tree and converts it into a source file (text). Basically, it traverses through all nodes of the tree, maps the node to text and appends the resulting texts to a StringBuilder. Now I want the node to…
Glory to Russia
  • 17,289
  • 56
  • 182
  • 325
2
votes
1 answer

Xtext separate code generator from grammar project

i'm wrinting a code generator and i was thinking in separate the code generator from de grammar. I've get success in generate the code of " MyDslGenerator.java", but my problem is how to integrate this project with the project of the grammar. The…
keysuke
  • 97
  • 1
  • 1
  • 9
2
votes
1 answer

Using snakeyaml in a xtend project

I'd like to see how to use snakeyaml in a xtend project. How can I dump to yaml and load from ? package test ... @Data final public class D { public var Integer a } ... val d = new D(2); val constructor = new Constructor(D) val y = new…