Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xtext compatibility error with type from imported package
xtext compatibility error with type from imported package [message #902944] Tue, 21 August 2012 11:14 Go to next message
stefan tudose is currently offline stefan tudoseFriend
Messages: 12
Registered: July 2012
Junior Member
Hi
I'm experiencing some problems using the import of an existing EMF metamodel.

I have the following (simplified) language:

import "ht!tp://my.package/dsp/0.1.0" as dspData

DataValue returns dspData::DataValue:
	EnumLiteral | IntegerValue;

EnumLiteral returns dspData::EnumLiteral:
	 value=[constrainedtypes::EnumLiteralDef]
;
IntegerValue returns dspData::IntegerValue:
	{dspData::IntegerValue}
	value=EInt;

CheckTmValue returns CheckTmValue:
	{CheckTmValue} 
	'Check value'
	varRef=Variable 
	operator=OperatorCheckValue 
	value=DataValue ('deadline' deadline=ELong)?;

Variable...

OperatorCheckValue...




There are two problems: on the import I get the warning "The imported package is not on the classpath of this project which may lead to follow up errors."

The second problem is that every time I use the rule DataValue (for example in CheckTmValue in this symplified grammar) I get the error message "Cannot find compatible feature value in sealed EClass CheckTmValue from imported package ht!tp://my.package/automataMetamodel: The existing reference 'value' has an incompatible type 'null'. The expected type is 'DataValue' [my.package.dsp.model.dspData.DataValue]."

I've included in the manifest the required plugins but I still have the warning message for this import. The others imports work fine, I just had to add the plugins containing the .ecore to get rid of the first warning.

In the mwe2 file I've mapped the dspData package
		uriMap = Mapping {
			from = "platform:/plugin/my.package.dsp.metamodel/model/dspData.ecore"
			to = "ht!tp://my.package/dsp/0.1.0"
		}


Any idea where this could come from or what should I check? Could this be a bug?

P.S. If I run the MWE2 workflow, it works without any error
Re: xtext compatibility error with type from imported package [message #903084 is a reply to message #902944] Tue, 21 August 2012 20:52 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Stefan,

please make sure that dspData.ecore is actually on the class path of the
project that contains the Xtext grammar. I assume that your ecore file
is developed in a host eclipse and the grammar in a runtime eclipse? PDE
may fail to properly put the model folder on the classpath of the
project even though it's added as a dependency in the manifest.

If you develop the grammar and the ecore package in the same workspace,
you'll have to add the Xtext nature to both projects.

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 21.08.12 13:14, schrieb stefan tudose:
> Hi
> I'm experiencing some problems using the import of an existing EMF
> metamodel.
>
> I have the following (simplified) language:
>
> import "ht!tp://my.package/dsp/0.1.0" as dspData
>
> DataValue returns dspData::DataValue:
> EnumLiteral | IntegerValue;
>
> EnumLiteral returns dspData::EnumLiteral:
> value=[constrainedtypes::EnumLiteralDef]
> ;
> IntegerValue returns dspData::IntegerValue:
> {dspData::IntegerValue}
> value=EInt;
>
> CheckTmValue returns CheckTmValue:
> {CheckTmValue} 'Check value'
> varRef=Variable operator=OperatorCheckValue value=DataValue
> ('deadline' deadline=ELong)?;
>
> Variable...
>
> OperatorCheckValue...
>
>
>
>
> There are two problems: on the import I get the warning "The imported
> package is not on the classpath of this project which may lead to follow
> up errors."
>
> The second problem is that every time I use the rule DataValue (for
> example in CheckTmValue in this symplified grammar) I get the error
> message "Cannot find compatible feature value in sealed EClass
> CheckTmValue from imported package ht!tp://my.package/automataMetamodel:
> The existing reference 'value' has an incompatible type 'null'. The
> expected type is 'DataValue' [my.package.dsp.model.dspData.DataValue]."
>
> I've included in the manifest the required plugins but I still have the
> warning message for this import. The others imports work fine, I just
> had to add the plugins containing the .ecore to get rid of the first
> warning.
>
> In the mwe2 file I've mapped the dspData package uriMap = Mapping {
> from =
> "platform:/plugin/my.package.dsp.metamodel/model/dspData.ecore"
> to = "ht!tp://my.package/dsp/0.1.0"
> }
>
>
> Any idea where this could come from or what should I check? Could this
> be a bug?
>
> P.S. If I run the MWE2 workflow, it works without any error
Re: xtext compatibility error with type from imported package [message #903185 is a reply to message #903084] Wed, 22 August 2012 12:56 Go to previous message
stefan tudose is currently offline stefan tudoseFriend
Messages: 12
Registered: July 2012
Junior Member
Hi Sebastian,
Thanks for your answer.
Yes, I use a host eclipse for the metamodels and a runtime eclipse for xtext.

I checked the classpath and, you were right, the model folder was not in the classpath. Now I added it, the import of dspData works fine, but I still get some errors every time I use the DataValue rule. It seems that there is still an incompatibility, but the Class seems to be the same...
The exact message is
Cannot find compatible feature value in sealed EClass CheckTmValue
   from imported package ht!tp://my.package/automataMetamodel:
   The existing reference 'value' has an incompatible type 'DataValue'
   [Data.DataValue]. The expected type is 'DataValue'.

Note: now I have the same warning import as before but on the import of the automataMetamodel. However, for this package the .ecore is in the classpath...
Any ideas?
Previous Topic:customize ContentAssist
Next Topic:Parsing Ambiguity Problem
Goto Forum:
  


Current Time: Fri Apr 19 10:05:26 GMT 2024

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

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

Back to the top