Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366786 - ClassCastException in XbaseGrammarAccess when overriding Xbase rule definitions
Summary: ClassCastException in XbaseGrammarAccess when overriding Xbase rule definitions
Status: CLOSED DUPLICATE of bug 347171
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-15 03:53 EST by Kai Kreuzer CLA
Modified: 2011-12-19 05:03 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kai Kreuzer CLA 2011-12-15 03:53:06 EST
Build Identifier: Xtext 2.2.1

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).


Reproducible: Always
Comment 1 Sebastian Zarnekow CLA 2011-12-19 05:03:15 EST

*** This bug has been marked as a duplicate of bug 347171 ***