Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtend cannot see methods in Xtext's generated classes
Xtend cannot see methods in Xtext's generated classes [message #1576997] Wed, 21 January 2015 16:57 Go to next message
Cioran Naroic is currently offline Cioran NaroicFriend
Messages: 18
Registered: December 2013
Junior Member
Hi all,

From a Simple.mydsl file, I generate some Java classes using a custom JvmModelInferrer. The project A that contains my DSL files is an Eclipse plugin that exports the Java packages generated in src-gen/.

Now, I want to use these generated classes in some other project B.

The situation is as follows:

(1) If I create a new Java project B in the same Eclipse instance and put A either as a plugin dependency or as a buildpath "Required project" dependency, everything's ok. I see the generated classes and method autocompletion on them works in both Xtend and Java files.

(2) If I run a new Eclipse instance (with A included) and create a new Java project B with A as a plugin dependency, new Java files can access the types and autocomplete methods, whereas new Xtend files can import the type, but they see no methods (no autocompletion, and error if manually written)!

I guess this as something to do with the exported EObjectDescriptions, or the way Xtend directly communicate with a model of the Jvm rather than the actual generated classes?

Thanks for you help,

Cioran
Re: Xtend cannot see methods in Xtext's generated classes [message #1577005 is a reply to message #1576997] Wed, 21 January 2015 17:01 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13715
Registered: July 2009
Senior Member
Hi,

can you share small example projects?


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
Re: Xtend cannot see methods in Xtext's generated classes [message #1577014 is a reply to message #1577005] Wed, 21 January 2015 17:07 Go to previous messageGo to next message
Cioran Naroic is currently offline Cioran NaroicFriend
Messages: 18
Registered: December 2013
Junior Member
Sharing my Xtext projet is a bit complicated, but you can have a look at http://github.com/diverse-project/melange for the sources.

DslProject.tar.gz contains an Eclipse project with a DSL file (.melange) and the generated classes in src/gen.

TestSameInstance.tar.gz is a project that tries to import the generated classes. Try to import it in the same instance as DslProject: it works. Try to import it in a new instance: Xtend file doesn't compile.
Re: Xtend cannot see methods in Xtext's generated classes [message #1577021 is a reply to message #1577014] Wed, 21 January 2015 17:14 Go to previous messageGo to next message
Cioran Naroic is currently offline Cioran NaroicFriend
Messages: 18
Registered: December 2013
Junior Member
Of course, if I manually move the packages in src-gen/ to a new Java Project, I can import the new project in a new Eclipse instance and everything works.

Also, this may be related to the fact that, although the import statement works in Xtend files, if I ctrl+click on it, Eclipse tries to run an Editor for my DSL, and not a Java editor (because of the IJvmModelAssociator I guess). Unfortunately, editor fails with: "java.lang.IllegalArgumentException: Couldn't create EMF Resource for input org.eclipse.jdt.internal.ui.javaeditor.InternalClassFileEditorInput@9122e6e6").

[Updated on: Wed, 21 January 2015 17:33]

Report message to a moderator

Re: Xtend cannot see methods in Xtext's generated classes [message #1577230 is a reply to message #1577021] Wed, 21 January 2015 19:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13715
Registered: July 2009
Senior Member
Hi,

can you please file a bug


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
Re: Xtend cannot see methods in Xtext's generated classes [message #1580249 is a reply to message #1577230] Fri, 23 January 2015 11:29 Go to previous messageGo to next message
Cioran Naroic is currently offline Cioran NaroicFriend
Messages: 18
Registered: December 2013
Junior Member
I will investigate a bit with simpler examples and file a bug if it is confirmed.
Re: Xtend cannot see methods in Xtext's generated classes [message #1735918 is a reply to message #1580249] Thu, 23 June 2016 15:27 Go to previous message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 380
Registered: July 2015
Senior Member
Hi,

today we had found exactly the same problem in VIATRA, and found that it could be fixed by adding a binding to the UI module of our language: https://git.eclipse.org/r/#/c/75854/

I hope, this will be helpful; I have also opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=496665 to ask for adding this binding by default.

Best regards,
Zoltán
Previous Topic:change unordered Stategy in Xtext 2.10
Next Topic:Autocomplete inconsistent with syntactic sugar
Goto Forum:
  


Current Time: Thu Jan 21 12:43:52 GMT 2021

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

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

Back to the top