Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem with compatible feature type when redefining variable declaration from xbase
Problem with compatible feature type when redefining variable declaration from xbase [message #755219] Mon, 07 November 2011 17:43 Go to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
In an attempt to redefine the syntax of variable declarations from Xbase, I came accross the following error message in the JavaVariableDeclarator rule:

Cannot find compatible feature type in sealed EClass XVariableDeclaration from imported package http://www.eclipse.org/xtext/xbase/Xbase: The existing reference 'type' has an incompatible type 'null'. The expected type is 'JvmTypeReference'.

The error message is show in the editor but the project seems to build successfully.
Here is the grammar:

grammar org.xtext.example.mydsl1.MyDsl with org.eclipse.xtext.xbase.annotations.XbaseWithAnnotations

generate myDsl "http://www.xtext.org/example/mydsl1/MyDsl"

import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase
import "http://www.eclipse.org/xtext/common/JavaVMTypes" as jvmTypes
import "http://www.eclipse.org/emf/2002/Ecore" as ecore

....

JavaVariableDeclarator  returns xbase::XVariableDeclaration:
	type=JvmTypeReference name=ValidID ('=' right=XExpression)? ';'
;


I can't seem to find the problem. Something with my configuration?
Re: Problem with compatible feature type when redefining variable declaration from xbase [message #755246 is a reply to message #755219] Mon, 07 November 2011 18:56 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
I get a similar error for the name feature: "Cannot find compatible type for features" when overriding the FullJvmFormalParameter rule:

FullJvmFormalParameter returns jvmTypes::JvmFormalParameter:
	{FullJvmFormalParameter} final ?= 'final'? parameterType=JvmTypeReference name=ValidID;

Is there something I obviously overlooked?
Re: Problem with compatible feature type when redefining variable declaration from xbase [message #755253 is a reply to message #755219] Mon, 07 November 2011 19:45 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Goran,

please try to trigger a build by changing the manifest of your project
or add the common.types plugin explicitly as a dependency.

Hope that helps,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 07.11.11 18:43, Goran wrote:
> In an attempt to redefine the syntax of variable declarations from
> Xbase, I came accross the following error message in the
> JavaVariableDeclarator rule:
>
>
> Cannot find compatible feature type in sealed EClass
> XVariableDeclaration from imported package
> http://www.eclipse.org/xtext/xbase/Xbase: The existing reference 'type'
> has an incompatible type 'null'. The expected type is 'JvmTypeReference'.
>
> The error message is show in the editor but the project seems to build
> successfully.
> Here is the grammar:
>
>
> grammar org.xtext.example.mydsl1.MyDsl with
> org.eclipse.xtext.xbase.annotations.XbaseWithAnnotations
>
> generate myDsl "http://www.xtext.org/example/mydsl1/MyDsl"
>
> import "http://www.eclipse.org/xtext/xbase/Xbase" as xbase
> import "http://www.eclipse.org/xtext/common/JavaVMTypes" as jvmTypes
> import "http://www.eclipse.org/emf/2002/Ecore" as ecore
>
> ...
>
> JavaVariableDeclarator returns xbase::XVariableDeclaration:
> type=JvmTypeReference name=ValidID ('=' right=XExpression)? ';'
> ;
>
>
> I can't seem to find the problem. Something with my configuration?
Re: Problem with compatible feature type when redefining variable declaration from xbase [message #755264 is a reply to message #755253] Mon, 07 November 2011 20:20 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
I have common.types already as a dependency.
Triggering a build by changing the manifest did not help. What else can I do?
Re: Problem with compatible feature type when redefining variable declaration from xbase [message #755266 is a reply to message #755264] Mon, 07 November 2011 20:27 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
I could reproduce the problem by simply creating a new Xtext project and modifying the MyDsl.xtext as follows:

grammar org.xtext.example.mydsl2.MyDsl with org.eclipse.xtext.xbase.annotations.XbaseWithAnnotations

generate myDsl "http://www.xtext.org/example/mydsl2/MyDsl"

import "http://www.eclipse.org/xtext/xbase/Xbase"
import "http://www.eclipse.org/xtext/common/JavaVMTypes" as jvmTypes
import "http://www.eclipse.org/emf/2002/Ecore" as ecore

Model:
	greetings+=Greeting*;
	
Greeting:
	'Hello' name=ID '!';

JavaVariableDeclarator  returns XVariableDeclaration:
	{XVariableDeclaration} writeable?='final'? (type=JvmTypeReference name=ValidID) ('=' right=XExpression)? ';'
;



Saving the grammar triggers a build and common.types is automatically added to the manifest.
The grammar doesn't make very sense but it demonstrates the same problem.

~Goran
Re: Problem with compatible feature type when redefining variable declaration from xbase [message #755270 is a reply to message #755266] Mon, 07 November 2011 21:03 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
I have another question with regard to the example of the 'JavaVariableDeclarator' rule.
In this particular rule I want the value of "writeable" to be false instead of true when the 'final' keyword is present.
This causes an error message when assigning a value to a non-final variable in the editor.
Any tips on how to deal with this?

~Goran
Re: Problem with compatible feature type when redefining variable declaration from xbase [message #755385 is a reply to message #755270] Tue, 08 November 2011 10:37 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
I am getting a lot of these problems when inheriting from XBase and redefining rules. It seems to be a bug.
Could anyone reproduce this error message?
Re: Problem with compatible feature type when redefining variable declaration from xbase [message #755387 is a reply to message #755385] Tue, 08 November 2011 10:42 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
No it works for me with your example grammar

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem with compatible feature type when redefining variable declaration from xbase [message #755392 is a reply to message #755387] Tue, 08 November 2011 10:49 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
hmmm very strange. I guess I'll do a reinstall.
Re: Problem with compatible feature type when redefining variable declaration from xbase [message #755404 is a reply to message #755392] Tue, 08 November 2011 11:22 Go to previous messageGo to next message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
I get the exact strange problem with a fresh install.

I just downloaded the Xtext 2.1.0 Distribution (Indigo) from http://xtext.itemis.com/xtext/language=en/36553/downloads
Creating a new Xtext project and using the grammar I posted previously results in the same error message.
Re: Problem with compatible feature type when redefining variable declaration from xbase [message #755406 is a reply to message #755404] Tue, 08 November 2011 11:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Yes downloading a new distro i get the error too

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem with compatible feature type when redefining variable declaration from xbase [message #755498 is a reply to message #755404] Tue, 08 November 2011 16:33 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Goran,

we'll investigate further and try to tackle the problem for 2.1.1

Thanks for pointing the problem out,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

On 08.11.11 12:22, Goran wrote:
> I get the exact strange problem with a fresh install.
>
> I just downloaded the Xtext 2.1.0 Distribution (Indigo) from
> http://xtext.itemis.com/xtext/language=en/36553/downloads
> Creating a new Xtext project and using the grammar I posted previously
> results in the same error message.
Re: Problem with compatible feature type when redefining variable declaration from xbase [message #755502 is a reply to message #755406] Tue, 08 November 2011 16:38 Go to previous message
Goran   is currently offline Goran Friend
Messages: 45
Registered: November 2011
Member
Thanks for confirming.
I created a bug report:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=363196
Previous Topic:error "Could not serialize EObject via backtracking"
Next Topic:Formatting guides?
Goto Forum:
  


Current Time: Fri Apr 26 20:32:13 GMT 2024

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

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

Back to the top