Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xbase 2.2.1] Overriding Xbase rule definitions
[Xbase 2.2.1] Overriding Xbase rule definitions [message #765751] Wed, 14 December 2011 15:55 Go to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 42
Registered: July 2009
Member
Hi,

I am trying to adapt Xbase rules to match specific syntax requirements I
have. On the parsing side, everything works fine, but once I try to
serialize my models, I run into ClassCastExceptions.

I have uploaded an example on Github, see
https://github.com/openhab/xtext-tests.

In this example, I am simply removing the possibility to add type
arguments to member feature calls (I copied the Xbase rule and only put
one line in comment):
https://github.com/openhab/xtext-tests/blob/master/org.xtext.example.mydsl/src/org/xtext/example/mydsl/MyDsl.xtext

A very simple test now takes an expression that contains a member
feature call:
https://github.com/openhab/xtext-tests/blob/master/org.xtext.example.mydsl.tests/src/org/xtext/example/mydsl/SerializerTest.java

This test fails with:

java.lang.ClassCastException: org.eclipse.xtext.impl.AssignmentImpl
cannot be cast to org.eclipse.xtext.Group at
org.eclipse.xtext.xbase.services.XbaseGrammarAccess$XMemberFeatureCallElements.<init>(XbaseGrammarAccess.java:853)

Note that this test is just ONE example - it happens for all other cases
where a Xbase rule is overridden as well.

The problem seems to be that the AbstractXbaseSemanticSequencer always
refer to the XbaseGrammarAccess instead of the MyDslGrammarAccess (see
the injection of XbaseGrammarAccess into the field grammarAccess).

Does this qualify for a bug or is my use case (overriding Xbase rules)
simply not allowed?

Cheers,
Kai
Re: [Xbase 2.2.1] Overriding Xbase rule definitions [message #766082 is a reply to message #765751] Thu, 15 December 2011 07:59 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Please file a bugzilla.
Generally, it's always ok to file a bugzilla.
That's nothing we find annoying or so.
We'll just close it if we think it doesn't qualify.
:-)

Thanks,
Sven

Am 12/14/11 4:55 PM, schrieb Kai Kreuzer:
> Hi,
>
> I am trying to adapt Xbase rules to match specific syntax requirements I
> have. On the parsing side, everything works fine, but once I try to
> serialize my models, I run into ClassCastExceptions.
>
> I have uploaded an example on Github, see
> https://github.com/openhab/xtext-tests.
>
> In this example, I am simply removing the possibility to add type
> arguments to member feature calls (I copied the Xbase rule and only put
> one line in comment):
> https://github.com/openhab/xtext-tests/blob/master/org.xtext.example.mydsl/src/org/xtext/example/mydsl/MyDsl.xtext
>
>
> A very simple test now takes an expression that contains a member
> feature call:
> https://github.com/openhab/xtext-tests/blob/master/org.xtext.example.mydsl.tests/src/org/xtext/example/mydsl/SerializerTest.java
>
>
> This test fails with:
>
> java.lang.ClassCastException: org.eclipse.xtext.impl.AssignmentImpl
> cannot be cast to org.eclipse.xtext.Group at
> org.eclipse.xtext.xbase.services.XbaseGrammarAccess$XMemberFeatureCallElements.<init>(XbaseGrammarAccess.java:853)
>
>
> Note that this test is just ONE example - it happens for all other cases
> where a Xbase rule is overridden as well.
>
> The problem seems to be that the AbstractXbaseSemanticSequencer always
> refer to the XbaseGrammarAccess instead of the MyDslGrammarAccess (see
> the injection of XbaseGrammarAccess into the field grammarAccess).
>
> Does this qualify for a bug or is my use case (overriding Xbase rules)
> simply not allowed?
>
> Cheers,
> Kai


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: [Xbase 2.2.1] Overriding Xbase rule definitions [message #766125 is a reply to message #766082] Thu, 15 December 2011 08:55 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 42
Registered: July 2009
Member
Thanks Sven,

I just wanted to be sure that I am not missing any important point here
- as I wondered that nobody else yet stumbled over this.

Here's the bug report:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=366786

Cheers,
Kai

On 12/15/2011 8:59 AM, Sven Efftinge wrote:
> I am trying to adapt Xbase rules to match specific syntax requirements I
>> have. On the parsing side, everything works fine, but once I try to
>> serialize my models, I run into ClassCastExceptions.
>>
>> I have uploaded an example on Github, see
>> https://github.com/openhab/xtext-tests.
>>
>> In this example, I am simply removing the possibility to add type
>> arguments to member feature calls (I copied the Xbase rule and only put
>> one line in comment):
>> https://github.com/openhab/xtext-tests/blob/master/org.xtext.example.mydsl/src/org/xtext/example/mydsl/MyDsl.xtext
>>
>>
>> A very simple test now takes an expression that contains a member
>> feature call:
>> https://github.com/openhab/xtext-tests/blob/master/org.xtext.example.mydsl.tests/src/org/xtext/example/mydsl/SerializerTest.java
>>
>>
>> This test fails with:
>>
>> java.lang.ClassCastException: org.eclipse.xtext.impl.AssignmentImpl
>> cannot be cast to org.eclipse.xtext.Group at
>> org.eclipse.xtext.xbase.services.XbaseGrammarAccess$XMemberFeatureCallElements.<init>(XbaseGrammarAccess.java:853)
>>
>>
>> Note that this test is just ONE example - it happens for all other cases
>> where a Xbase rule is overridden as well.
>>
>> The problem seems to be that the AbstractXbaseSemanticSequencer always
>> refer to the XbaseGrammarAccess instead of the MyDslGrammarAccess (see
>> the injection of XbaseGrammarAccess into the field grammarAccess).
>>
Re: [Xbase 2.2.1] Overriding Xbase rule definitions [message #766299 is a reply to message #766125] Thu, 15 December 2011 14:16 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

I had the same problem; it used to show up only during unit tests using
XtextAbstractTests

cheers
Lorenzo

On 12/15/2011 09:55 AM, Kai Kreuzer wrote:
> Thanks Sven,
>
> I just wanted to be sure that I am not missing any important point here
> - as I wondered that nobody else yet stumbled over this.
>
> Here's the bug report:
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=366786
>
> Cheers,
> Kai
>
> On 12/15/2011 8:59 AM, Sven Efftinge wrote:
>> I am trying to adapt Xbase rules to match specific syntax requirements I
>>> have. On the parsing side, everything works fine, but once I try to
>>> serialize my models, I run into ClassCastExceptions.
>>>
>>> I have uploaded an example on Github, see
>>> https://github.com/openhab/xtext-tests.
>>>
>>> In this example, I am simply removing the possibility to add type
>>> arguments to member feature calls (I copied the Xbase rule and only put
>>> one line in comment):
>>> https://github.com/openhab/xtext-tests/blob/master/org.xtext.example.mydsl/src/org/xtext/example/mydsl/MyDsl.xtext
>>>
>>>
>>>
>>> A very simple test now takes an expression that contains a member
>>> feature call:
>>> https://github.com/openhab/xtext-tests/blob/master/org.xtext.example.mydsl.tests/src/org/xtext/example/mydsl/SerializerTest.java
>>>
>>>
>>>
>>> This test fails with:
>>>
>>> java.lang.ClassCastException: org.eclipse.xtext.impl.AssignmentImpl
>>> cannot be cast to org.eclipse.xtext.Group at
>>> org.eclipse.xtext.xbase.services.XbaseGrammarAccess$XMemberFeatureCallElements.<init>(XbaseGrammarAccess.java:853)
>>>
>>>
>>>
>>> Note that this test is just ONE example - it happens for all other cases
>>> where a Xbase rule is overridden as well.
>>>
>>> The problem seems to be that the AbstractXbaseSemanticSequencer always
>>> refer to the XbaseGrammarAccess instead of the MyDslGrammarAccess (see
>>> the injection of XbaseGrammarAccess into the field grammarAccess).
>>>
>


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Re: [Xbase 2.2.1] Overriding Xbase rule definitions [message #766700 is a reply to message #766299] Fri, 16 December 2011 09:24 Go to previous messageGo to next message
Kai Kreuzer is currently offline Kai KreuzerFriend
Messages: 42
Registered: July 2009
Member
Hi Lorenzo,

Do you mean it did not show up when running your application (only when
executing unit tests)?
This is definitely not the case for me, the problem occurs in my
application. If you know any kind of workaround, I would be interested!

Cheers,
Kai

On 12/15/2011 3:16 PM, Lorenzo Bettini wrote:
> Hi
>
> I had the same problem; it used to show up only during unit tests using
> XtextAbstractTests
>
> cheers
> Lorenzo
>
> On 12/15/2011 09:55 AM, Kai Kreuzer wrote:
>> Thanks Sven,
>>
>> I just wanted to be sure that I am not missing any important point here
>> - as I wondered that nobody else yet stumbled over this.
>>
>> Here's the bug report:
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=366786
>>
>> Cheers,
>> Kai
>>
>> On 12/15/2011 8:59 AM, Sven Efftinge wrote:
>>> I am trying to adapt Xbase rules to match specific syntax requirements I
>>>> have. On the parsing side, everything works fine, but once I try to
>>>> serialize my models, I run into ClassCastExceptions.
>>>>
>>>> I have uploaded an example on Github, see
>>>> https://github.com/openhab/xtext-tests.
>>>>
>>>> In this example, I am simply removing the possibility to add type
>>>> arguments to member feature calls (I copied the Xbase rule and only put
>>>> one line in comment):
>>>> https://github.com/openhab/xtext-tests/blob/master/org.xtext.example.mydsl/src/org/xtext/example/mydsl/MyDsl.xtext
>>>>
>>>>
>>>>
>>>>
>>>> A very simple test now takes an expression that contains a member
>>>> feature call:
>>>> https://github.com/openhab/xtext-tests/blob/master/org.xtext.example.mydsl.tests/src/org/xtext/example/mydsl/SerializerTest.java
>>>>
>>>>
>>>>
>>>>
>>>> This test fails with:
>>>>
>>>> java.lang.ClassCastException: org.eclipse.xtext.impl.AssignmentImpl
>>>> cannot be cast to org.eclipse.xtext.Group at
>>>> org.eclipse.xtext.xbase.services.XbaseGrammarAccess$XMemberFeatureCallElements.<init>(XbaseGrammarAccess.java:853)
>>>>
>>>>
>>>>
>>>>
>>>> Note that this test is just ONE example - it happens for all other
>>>> cases
>>>> where a Xbase rule is overridden as well.
>>>>
>>>> The problem seems to be that the AbstractXbaseSemanticSequencer always
>>>> refer to the XbaseGrammarAccess instead of the MyDslGrammarAccess (see
>>>> the injection of XbaseGrammarAccess into the field grammarAccess).
>>>>
>>
>
>
Re: [Xbase 2.2.1] Overriding Xbase rule definitions [message #770171 is a reply to message #766700] Fri, 23 December 2011 14:20 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 12/16/2011 10:24 AM, Kai Kreuzer wrote:
> Hi Lorenzo,
>
> Do you mean it did not show up when running your application (only when
> executing unit tests)?
> This is definitely not the case for me, the problem occurs in my
> application. If you know any kind of workaround, I would be interested!
>

As for me, it was only during unit testing...

cheers
Lorenzo


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net


Previous Topic:Delegating responsibility
Next Topic:grammar archives anywhere?
Goto Forum:
  


Current Time: Fri Mar 29 08:00:55 GMT 2024

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

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

Back to the top