RuntimeException - Context not valid for type [message #1793151] |
Tue, 31 July 2018 12:42  |
Eclipse User |
|
|
|
I am getting the following error when attempting to create an instance of my model :
java.lang.RuntimeException: The context 'Domainmodel returns Domainmodel' is not valid for type 'Domainmodel'
Recommended contexts for type 'Domainmodel': [Domainmodel returns Domainmodel]
The context 'Domainmodel returns Domainmodel' is valid for types: Domainmodel, null
Semantic Object: Domainmodel
URI: platform:/resource/canardnoex.sample/testsimple.canNoEx
at org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic$ExceptionThrowingAcceptor.accept(ISerializationDiagnostic.java:131)
at org.xtext.example.canardNoExtends.serializer.CanNoExSemanticSequencer.sequence(CanNoExSemanticSequencer.java:68)
at org.eclipse.xtext.serializer.sequencer.AbstractSemanticSequencer.createSequence(AbstractSemanticSequencer.java:67)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:118)
...etc
A picture of my ecore

A simplified version of my grammar
Domainmodel:
(elements+=Type | links+=Rel)*;
Type:
Category|Block;
Category:
'cat' nameCat=STRING;
Block:
'block' name=STRING;
Rel:
'source' src=Block 'destination' des=Block;
I know that the problem is in the xtext definition of domainmodel, as I've done a test where 'Rel' was a subtype of 'Type' and this problem didn't pop.
I can't use the version mentioned just above because the 'Rel' isn't, in that case, doing a verification check to make sure the 'Block' linked do exist.
Thus, I would like to find a way to make the initial definition work.
Notes :
- Any instance of the grammar gives this error, even if it contains only 1 'Type', no 'Type', only 1 'Rel', and so on..
- Attached are :
the actual ecore file
the full grammar version
Thanks a lot!
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.30012 seconds