Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » JvmType Reference in XText DSL based on XCore model [Luna]
JvmType Reference in XText DSL based on XCore model [Luna] [message #1401223] Tue, 15 July 2014 09:58 Go to next message
Johannes Wachter is currently offline Johannes WachterFriend
Messages: 5
Registered: June 2013
Junior Member
Hello,

I'm currently building a DSL with XText that is based on a XCore model. This was previously still based on Eclipse Juno (XCore 1.0.x, XText 2.4.x) and now I'm trying to update to Eclipse Luna (XCore 1.2.x, XText 2.6.x).

With the Juno variant the usage of JvmType in both the XCore model and the XText grammar worked fine.

When updating to Luna I get errors that the expected type JvmType is not compatible with the type JvmType (detailed error see example below).

I also created a simple example with a fresh XCore project and a fresh XText DSL like the following:

XCore

package appmodel

import org.eclipse.xtext.common.types.JvmType

class Foo {
	String foobar
	refers JvmType javaClass
}


XText Grammar

grammar appdsl.AppDsl with org.eclipse.xtext.common.Terminals

import "appmodel"
import "http://www.eclipse.org/xtext/common/JavaVMTypes" as jvmTypes

Foo:
	{Foo}
	'type' foobar=STRING '>' javaClass=[jvmTypes::JvmType]
;



Though the XText grammar yields the following error at the assignment of the javaClass feature:

Cannot find compatible feature javaClass in sealed EClass Foo from imported package appmodel: The existing reference 'javaClass' has an incompatible type 'JvmType'. The expected type is 'JvmType'.


I'm currently unsure why this worked in the Juno based version before, any ideas?

I also attached my test project, which has been checked in a Luna RCP with XCore 1.2.0 and XText 2.6.2.
Re: JvmType Reference in XText DSL based on XCore model [Luna] [message #1401245 is a reply to message #1401223] Tue, 15 July 2014 10:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
did you have a look at http://koehnlein.blogspot.de/2013/06/using-xcore-in-xtext.html?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: JvmType Reference in XText DSL based on XCore model [Luna] [message #1401265 is a reply to message #1401245] Tue, 15 July 2014 11:15 Go to previous messageGo to next message
Johannes Wachter is currently offline Johannes WachterFriend
Messages: 5
Registered: June 2013
Junior Member
Hi Christian,

yes I actually used that article as the base for the upgrade, together with the info from the following bugzillas:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=379999
https://bugs.eclipse.org/bugs/show_bug.cgi?id=412429

I just ran the generator again an at generation time the following error is thrown:

145  [main] INFO  lipse.emf.mwe.utils.StandaloneSetup  - Adding generated EPackage 'org.eclipse.xtext.xbase.XbasePackage'
266  [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.eclipse.org/Xtext/Xbase/XAnnotations' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
269  [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xtype' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
280  [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xbase' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
280  [main] INFO  clipse.emf.mwe.utils.GenModelHelper  - Registered GenModel 'http://www.eclipse.org/xtext/common/JavaVMTypes' from 'platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel'
1123 [main] ERROR ipse.xtext.generator.LanguageConfig  - Error loading 'platform:/resource/appmodel/model/appmodel.xcore': [XtextLinkingDiagnostic: null:7 Couldn't resolve reference to GenBase 'JvmType'.]
1993 [main] ERROR ipse.xtext.generator.LanguageConfig  - [TransformationDiagnostic: null:8 Cannot find compatible feature javaClass in sealed EClass Foo from imported package appmodel: The existing feature 'javaClass' has an incompatible type 'EJavaObject' [java.lang.Object]. The expected type is 'JvmType' [org.eclipse.xtext.common.types.JvmType]. (ErrorCode: CannotCreateTypeInSealedMetamodel)]


This seems very odd to me as the genmodel for JvmTypes is registered (see log) before it is not found anymore. What is also strange, is that here the last line indicates that EJavaObject has been found as the type of the javaClass feature whereas the IDE integration states something different.
Re: JvmType Reference in XText DSL based on XCore model [Luna] [message #1401365 is a reply to message #1401265] Tue, 15 July 2014 13:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13264
Registered: July 2009
Senior Member
can you file a bugzilla?

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: JvmType Reference in XText DSL based on XCore model [Luna] [message #1401411 is a reply to message #1401365] Tue, 15 July 2014 15:19 Go to previous messageGo to next message
Johannes Wachter is currently offline Johannes WachterFriend
Messages: 5
Registered: June 2013
Junior Member
Sure, I'll do that tomorrow since it seems that it still works when exporting the *.xcore to a *.ecore.
Re: JvmType Reference in XText DSL based on XCore model [Luna] [message #1401926 is a reply to message #1401411] Wed, 16 July 2014 09:02 Go to previous messageGo to next message
Csaba Koncz is currently offline Csaba KonczFriend
Messages: 49
Registered: July 2009
Member
Hi,
Here is the bugreport:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=439682

However, it is only about the errors displayed in the editor as the mwe2 workflow can be executed if a
loadedResource = "platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel"

is specified.
Best regards,
Csaba
Re: JvmType Reference in XText DSL based on XCore model [Luna] [message #1401935 is a reply to message #1401411] Wed, 16 July 2014 09:15 Go to previous message
Csaba Koncz is currently offline Csaba KonczFriend
Messages: 49
Registered: July 2009
Member
Hi,
Here is the bugreport:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=439682

However, it is only about the errors shown in the editor, as the mwe2 workflow can be executed, if a
loadedResource = "platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel"

is added.

Best regards,
Csaba

Previous Topic:[Xtext] managing large numbers of rules
Next Topic:[xtext] about EMF created by xtext
Goto Forum:
  


Current Time: Fri Dec 06 06:28:17 GMT 2019

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

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

Back to the top