Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Bidirectional imports
Bidirectional imports [message #1742679] Tue, 06 September 2016 15:22 Go to next message
Martin Westerkamp is currently offline Martin WesterkampFriend
Messages: 9
Registered: September 2016
Junior Member
Hey everyone,

I have developed two DSLs, let's call them A and B. They work quite independently, however, there are supposed to be some cross references from one language to the other as well.

In the beginning of development there have only been cross references in one direction, so A imported B and referenced some of its elemets. That construct worked without any issues. However, when I tried to do the same the other way around, so that B imported A as well, I would get several errors related to initialization when starting the language's Eclipse instance.

Here an extract of the log:
Caused by: java.lang.NullPointerException
	at com.lang.controller.controller.impl.ControllerPackageImpl.init(ControllerPackageImpl.java:1297)
	at com.lang.controller.controller.ControllerPackage.<clinit>(ControllerPackage.java:59)
	... 196 more
Root exception:
java.lang.ExceptionInInitializerError
	at com.lang.autogen.autogen.impl.AutogenPackageImpl.init(AutogenPackageImpl.java:83)
	at com.lang.autogen.autogen.AutogenPackage.<clinit>(AutogenPackage.java:58)

Is there any way to allow imports in both directions? I have also tried to outsource the relevant parts to a third language, but obviously that resulted in a cycle, so that the same problem occurred. I can see that such cycles aren't desirable, but I cannot think of any other way allowing cross references bidirectionally. Does anyone have an idea?

Greets
Martin
Re: Bidirectional imports [message #1742690 is a reply to message #1742679] Tue, 06 September 2016 16:17 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13888
Registered: July 2009
Senior Member
you should create a external metamodel or a common parent language for the affected types and use them in both dsls

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:The method x() of type y must override a superclass method
Next Topic:xtext add cross reference in expression
Goto Forum:
  


Current Time: Wed Apr 21 21:48:40 GMT 2021

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

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

Back to the top