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
Filter by
Sorted by
Tagged with
3 votes
1 answer
1k views

Is it possible to embed Java compiler into an application?

With Xtext and Xtend, I have written a DSL grammar as well as its associated code generator which creates a bunch of Java source files making up a Java application. I would like to provide my ...
Georgie's user avatar
  • 87
0 votes
0 answers
97 views

Use HashSet with a user defined class in an Xtext validator

I'm writing a small DSL that stores a list of coordinates: Model: locations+=Coordinates* ; Coordinates: '(' x=INT ',' y=INT ')' ; I'm working now on the validator, and one of the things I ...
pepelu's user avatar
  • 378
1 vote
1 answer
130 views

How can I generate in Xtext with the the Xtend Generator code as it was written?

I have this grammar defined in Xtext and when generating code with Xtend I want to get the Selection Expression as it was written. So that when a selection expression like x = "abc" || (y="pqr" &&...
user151387's user avatar
1 vote
1 answer
461 views

Generating Java code using Xtend and Sirius

So, my aim is to create graphical DSL. I created a ecore model using Eclipse Modeling Framework, after that I've used Sirius to create graphical modeling tool and I have problems with the last step ...
user777's user avatar
  • 93
0 votes
1 answer
91 views

Does xtend support multiple constructor?

I'm using eclipse IDE. The first constructor is callable but not the second. I'm wondering if xtend supports multiple constructors? @Data abstract class MatchingBase implements TidilySerializable { ...
ZHU's user avatar
  • 944
0 votes
1 answer
445 views

Xtext - Validating for duplicate names

I have the following grammer, but I want to do some validation on this. I want to make an error if there are duplicate names in the "players" list. Grammer: Football: 'Club' name=STRING ...
JDoe's user avatar
  • 221
1 vote
1 answer
85 views

How to access instance variable of Java in DSL?

I have a data model(Car.java), source template(dsl file) and application program. Template Class Car.java public class Car { public String name; public int price; public Car() { } ...
user avatar
2 votes
0 answers
94 views

How to expand field initializers in xtend annotation processor

I am using Active Annotations to generate fields in my classes and am having difficulty discovering how to expand field initializer expressions. Without initializers the code looks like this class ...
systemcpro's user avatar
0 votes
0 answers
245 views

code generation with xtend without removing the previous generated code

I am using xtend to generate java code,i am generating something like this: public class A { public void service ( ) { // this section is reserved to be implemented by the developper ...
Łøćçâz Ł'âvîëstà's user avatar
0 votes
1 answer
64 views

How can I statically import methods in code generated by Xtend active annotations?

I would like to use a statically imported method in code generated with Xtend's active annotations. As an example, I want to get this output: import static java.util.Collections.emptyList; @...
Johannes Dorn's user avatar
3 votes
2 answers
200 views

How to measure Xtend translation time for each input file

I'm building a DSL application in XTend and I need to measure the time it takes to translate each document that I run through it. I use the DSL capabilities to translate one data format (IFC) into ...
Henry's user avatar
  • 333
0 votes
1 answer
144 views

Xtend import error in Junit test case

I am attempting to write a test case in Xtend using Junit 5 on Eclipse Oxygen. A screenshot of the Eclipse Java perspective shows the source code and the environment: Here is a screenshot for the ...
Jonathan's user avatar
  • 2,733
0 votes
2 answers
613 views

How to insert variable in a switch statement return with Xtend?

With this Xtend code : «switch l.name { case 'java': 'mvn compile..../«d.name»/src/.........' default: 'bash..../«d.name»/src/......' }» and d.name = "Joe" I want to return this formated String with ...
YannickN.fr's user avatar
0 votes
2 answers
487 views

Resource is not getting using resourceset

I tried to fetch the input contents of the input file using the resource.I wrote the below code for that val resourceSet = new AutosarResourceSetImpl(); var uri = URI.createFileURI(inputfilepath); ...
goodman's user avatar
  • 456
0 votes
1 answer
149 views

Sirius - Create graphical interface to xtext template language

in my project we use a Xtext template language to create some documents. Similar to whats written here: https://www.eclipse.org/Xtext/documentation/207_template.html So basically a template starts ...
Chris's user avatar
  • 1
1 vote
1 answer
536 views

Define the generator code location using gradle to build xtext and xtend

I'm trying to create a first project using xText and xTend building with gradle. I created the grammar following the guidance in the xText documentation and also created the xtend generators. In ...
Hugo Dias's user avatar
  • 361
2 votes
1 answer
208 views

Xtend: evaluate expression directly from a string

Is there a possibilty in the Xtend language to evaluate an expression directly from a string, e.g. like Eval in Groovy. I want to do something like this in Xtend (the example is from Groovy): import ...
Software Craftsman's user avatar
1 vote
0 answers
367 views

Parsing URL parameter in Vaadin application

I apologize for this very open question, but I did already lots of Research/test, and I can't figure out, so just thought that someone maybe already experimented the same behavior. I have an URL as ...
hublo's user avatar
  • 1,040
0 votes
1 answer
204 views

Execution of extended Xbase interpreter leads to runtime exception

I am currently writing an interpreter for an Xtext language that extends Xbase. To do so I am inheriting from XbaseInterpreter, adding my own run method and override the dispatch method ...
Manuel Leduc's user avatar
  • 1,859
3 votes
1 answer
546 views

convert xtend project to maven project

For project related work I am using Xtend programming.In my eclipse workspace, around 10 projects are there and all these projects are dependent on each other and some other plugins also I needed so I ...
goodman's user avatar
  • 456
0 votes
0 answers
414 views

How do you serialize a fragment of an Xtext parse tree/AST?

I have some xtend code that gets a parse tree/AST from a file in my DSL. I want a method that will serialize any node in the tree. This means I want text in the language of my DSL for an EObject ...
bjc's user avatar
  • 1,231
2 votes
0 answers
317 views

Validate xtext editor content which is generated by Grammar file

This I know Suppose we have to validate we have to write @check method inside ".xtend" get data from model then we can validate. But content which we printed from grammar how can we validate ...
shreeram banne's user avatar
0 votes
1 answer
79 views

Xtend syntax clarification

I'm trying to 100% understand that the following Xtend syntax means: myVar.addSelectionListener( [MultiSelectionEvent<String> event | println(event.toString) ...
hublo's user avatar
  • 1,040
0 votes
1 answer
261 views

Eclipse DSL code assist is not working after generating

I am using Eclipse for DSL development but I have a problem with it. I am using Xtext and Xtend to develop my DSL. But everytime I generate the Xtext artifacts from my xtext file, code assist stops ...
Implex1v's user avatar
0 votes
0 answers
184 views

What code coverage tool/plugin can I use with SonarQube to cover the Xtend programming language?

I've googled high and low and found next to nothing on the topic, except this: http://www.lorenzobettini.it/2014/10/analyzing-xtend-code-with-sonarqube/ But that's 3 years old and references ...
enjoythelittlethings's user avatar
1 vote
1 answer
192 views

Is it possible to set auto-activation triggers for Xtend and other Xtext-generated languages?

In Eclipse, we can trigger Content-Assist automatically for Java for a given of characters, but I noticed that there is no such option in the Xtext generated languages or Xtend. Is it possible to set ...
Hristo Vrigazov's user avatar
0 votes
1 answer
501 views

how to read file stored in local drive using Xtend

how to read a json file using Xtend and using MydslGenrator ,use those file in eclipse editor
Chaitanya's user avatar
1 vote
1 answer
1k views

How do I include Xtext generator in my Maven project?

I am currently building a framework which would benefit from having a DSL for creating a configuration file, so I created one using Xtext. Now I want to add a dependency to the classes that I have ...
Hristo Vrigazov's user avatar
1 vote
1 answer
792 views

how to indent for tab space after writing a statement

How to get a tab space for beautification after writing a statement in Xtext. Here is my code is in Xtext grammar : Block: '_block' name=ID '_endblock' ; and UI ...
Chaitanya's user avatar
0 votes
0 answers
99 views

Xtext outline view using grammar and Xtend

How to get outline view in Xtext using Xtend for this particular parser rule written in Xtext? def_slotted_exemplar: ex= Exemplar (':'name=ID ) ',' ( '{}' |( ('{}'',') ('{}' | ...
Chaitanya's user avatar
1 vote
1 answer
54 views

How can I configure the precedance of extension methods in name conflicts?

I would like to create an extension method named "map" to make inline mappings of single objects. For example, if you have some json datastructure: val json = getDataStructure() val String text = ...
armin.miedl's user avatar
  • 1,090
1 vote
1 answer
919 views

How to get a terminal representing any character in xText

I'm using Xtext to develop a DSL. This DSL should accept code of any kind at a certain point. This means it should accept any character. Also, I need to record this code, without ignoring it. Does any ...
Carolina Centeio Jorge's user avatar
0 votes
1 answer
40 views

xtend quickfixes access to element

Xtend comes with really convenient ways to deal with quickfixes, but when I do acceptor.accept(issue, "Change to " + correction, 'Replace the parameter.', 'error.png') [ element, context | .....
Remi Garcia's user avatar
2 votes
1 answer
614 views

Xtext 2.10 (AbstractFormatter2): Indentation for single or multiline comments is not always correct

Problem Description: The default indentation for single or multiline comments does not always work properly. The following issues are being faced. The indentation for single line comments never ...
Humayun Faiz Paracha's user avatar
1 vote
0 answers
47 views

Gradle Sub Projects Builds Are Failed If Sub Projects Contains Same File Name In Same Package Structure

Here is my Project structure. Note:Project-B depends on Project-A Build I have following attributes in SamplePage.Java Project-A->SamplePage.Java public string name; public int age; Project-B->...
gihan-maduranga's user avatar
0 votes
1 answer
187 views

Is extending the DelegateProcessor of the @Delegate active annotation possible?

I am currently working on an active annotation that is an adjusted version of the Xtend active annotation @Delegate. I already have an ugly version that is just an adapted copy of the class ...
ConveniencePatterns's user avatar
1 vote
0 answers
59 views

How to programmatically handle objects in Xtext

I have a grammar defined like: Key: name=ID; Step: name+=[Key]+; @Override terminal ID: ('a'..'z' | 'A'..'Z' | '_' | '-' | '0'..'9') ('a'..'z' | 'A'..'Z' | '_' | ' ' | '-' | '0'..'9')...
Viktor Sidochenko's user avatar
1 vote
0 answers
312 views

Xtend generation with Maven creates wrong String concatenation

When my maven script generates Java from Xtend files, , it generates files with wrong string concatenation. xtend: def writeImports(f){ ''' import "test.file" «getImports()...
Staalk's user avatar
  • 235
0 votes
0 answers
673 views

java.lang.NoClassDefFoundError: org/eclipse/xtext/service/AbstractGenericModule

after more than a day of searching i am really stuck in resolving the problem of a eclipse xtext RCP. launching the .product results in the error: java.lang.NoClassDefFoundError: org/eclipse/xtext/...
freshNfunky's user avatar
0 votes
1 answer
484 views

Eclipse: Getting a resource set after saving

Here is a code segment of my code (Working in xtext) (Saving a model in a file) generatedModel.save(null) //here generatedModel is an object of resource Then when I try to retrieve info about ...
Jagpreet Singh Sasan's user avatar
1 vote
1 answer
169 views

How to create an Xtext wildcard terminal rule for any combination of characters?

I want to write a rule for the following INTEGER X; IF GIBBERISH THEN X = 10; ELSE X = 15; END; In the above program I want to write a terminal rule for any character in GIBBERISH like code('...
mrprofessor's user avatar
0 votes
1 answer
290 views

Absolute path on Xtext project

I wanted to know how I can get the absolute path of a file which is inside my project not in the application running. For example this one: C:\Users\Mr\Documents\Example\org.xtext.example.mydsl\src\...
Marcks1's user avatar
  • 15
0 votes
1 answer
120 views

Automatic text adding in Eclipse editor from xtext dsl project

Here is a small code section I made from the DSL grammar generated using Xtext. start { alpha { prev : alpha next : beta } } In this, I want that as soon as I write ...
Jagpreet Singh Sasan's user avatar
0 votes
1 answer
43 views

More than 3 options are not working while declaring Xtext grammar

Particularly when I use more than 3 OR symbols. datatype: Integer | Float | Char | Blah | Blah entity: Class | Struct | Enumeration | Union the complete grammar can be found here: https://...
mrprofessor's user avatar
0 votes
0 answers
372 views

Guice third-party library injection: NoClassDefFoundError when running an Xtext project as an Eclipse application (IDE)

I have an xtext project that uses a third-party library (jgrapht). I (have to) inject the relevant jgrapht classes and this works fine when I test my xtext compiler using the accompanying xtext test ...
Dr. Thomas C. King's user avatar
0 votes
1 answer
63 views

Get Annotation parameter from ActiveAnnotation

I'm trying to implement a parameterized ActiveAnnotation and try to get the supplied annotations. @Active(ExampleProcessor) annotation ExampleAnnotation { val String value } class ...
Markus A.'s user avatar
1 vote
1 answer
288 views

How to migrate code generation from xpand to xtend(2)?

We wanto to reimplement an old project, wich used code generation via xtext and xpand. Xpand should be replaced with Xtend(2) and the old fornax plugin workflow execution should be removed, replacey ...
gregor's user avatar
  • 63
2 votes
2 answers
225 views

xtext parameterized xtext runner

Purpose: Run parameterized tests within xtext/xtend context. Progress: So far I have achieved getting it to run, but it is appearing wrong in the junit window. Issues: The failure trace and results ...
Casper Thule Hansen's user avatar
1 vote
1 answer
532 views

How to compile Xtend + Java classes with Gradle

I tyr to migrate a project that contains both Java and Xtend classes to Gradle. Unfortunately, I could not find any possibility to achieve an automated compilation of the Xtend part. I am well aware ...
ChrisR's user avatar
  • 63
1 vote
2 answers
112 views

Xtend: Removing Active Annotation during code generation

I've created an active annotation @Module, but I don't want the generated Java class to be annotated with @Module. When I try to remove the annotation during the transformation phase, it instead ...
phil-daniels's user avatar

1 2
3
4 5
9