Problem with ecore and the new generator [message #1737848] |
Wed, 13 July 2016 13:40  |
Eclipse User |
|
|
|
Hi,
I have problems with the new Xtext Generator from Xtext 2.10. It seams like there is a problem with the import of the Ecore metamodel. Using the old workflow everything works fine. Do I have to add something new? It is probably some small change I have to make, but I don't find a solution.
My grammar:
// automatically generated by Xtext
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
import "http://www.example.org/testModel"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore
Document returns Document:
{Document}
'Document'
name=ID
'{'
('pages' '{' pages+=Page ("," pages+=Page)* '}')?
'}';
Page returns Page:
{Page}
'Page'
name=ID
'{'
('attributes' '{' attributes+=Attribute ("," attributes+=Attribute)* '}')?
'}';
Attribute returns Attribute:
{Attribute}
'Attribute'
name=ID
'{'
('type' type=[ecore::EClassifier|ID])?
'}';
My workflow:
module org.xtext.example.mydsl.GenerateMyDsl
import org.eclipse.xtext.xtext.generator.*
import org.eclipse.xtext.xtext.generator.model.project.*
var rootPath = ".."
Workflow {
component = XtextGenerator {
configuration = {
project = StandardProjectConfig {
baseName = "org.xtext.example.mydsl"
rootPath = rootPath
runtimeTest = {
enabled = true
}
eclipsePlugin = {
enabled = true
}
eclipsePluginTest = {
enabled = true
}
createEclipseMetaData = true
}
code = {
encoding = "UTF-8"
fileHeader = "/*\n * generated by Xtext \${version}\n */"
}
}
language = StandardLanguage {
name = "org.xtext.example.mydsl.MyDsl"
fileExtensions = "mydsl"
referencedResource = "platform:/resource/TestModel/model/testModel.genmodel"
fragment = ecore2xtext.Ecore2XtextValueConverterServiceFragment2 auto-inject {}
fragment = org.eclipse.xtext.generator.adapter.FragmentAdapter {
fragment = org.eclipse.xtext.generator.ecore2xtext.FormatterFragment {}
}
serializer = {
generateStub = false
}
validator = {
// composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}
}
}
}
Part of the error message where the ecore model fails:
[TransformationDiagnostic: null:28 Cannot find compatible feature type in sealed EClass Attribute from imported package http://www.example.org/testModel: The existing reference 'type' has an incompatible type 'null'. The expected type is 'EClassifier' [org.eclipse.emf.ecore.EClassifier]. (ErrorCode: CannotCreateTypeInSealedMetamodel)]
The full error:
0 [main] INFO text.xtext.generator.XtextGenerator - Initializing Xtext generator
6 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Adding generated EPackage 'org.eclipse.xtext.common.types.TypesPackage'
98 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project org.xtext.example.mydsl at 'file:/C:/Users/jekkt/workspace/ScenarioTools-Neon-OCL/org.xtext.example.mydsl/'
98 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project org.xtext.example.mydsl.tests at 'file:/C:/Users/jekkt/workspace/ScenarioTools-Neon-OCL/org.xtext.example.mydsl.tests/'
99 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project org.xtext.example.mydsl.ide at 'file:/C:/Users/jekkt/workspace/ScenarioTools-Neon-OCL/org.xtext.example.mydsl.ide/'
99 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project org.xtext.example.mydsl.ui at 'file:/C:/Users/jekkt/workspace/ScenarioTools-Neon-OCL/org.xtext.example.mydsl.ui/'
99 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Registering project org.xtext.example.mydsl.ui.tests at 'file:/C:/Users/jekkt/workspace/ScenarioTools-Neon-OCL/org.xtext.example.mydsl.ui.tests/'
106 [main] INFO lipse.emf.mwe.utils.StandaloneSetup - Using resourceSet registry. The registered Packages will not be registered in the global EPackage.Registry.INSTANCE!
388 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/Xtext/Xbase/XAnnotations' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
390 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xtype' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
403 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/xbase/Xbase' from 'platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel'
403 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/common/JavaVMTypes' from 'platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel'
426 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.example.org/testModel' from 'platform:/resource/TestModel/model/testModel.genmodel'
426 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/emf/2002/Ecore' from 'platform:/resource/org.eclipse.emf.ecore/model/Ecore.genmodel'
529 [main] ERROR xt.generator.XtextGeneratorLanguage - [TransformationDiagnostic: null:28 Cannot find compatible feature type in sealed EClass Attribute from imported package http://www.example.org/testModel: The existing reference 'type' has an incompatible type 'null'. The expected type is 'EClassifier' [org.eclipse.emf.ecore.EClassifier]. (ErrorCode: CannotCreateTypeInSealedMetamodel)]
531 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems running workflow org.xtext.example.mydsl.GenerateMyDsl: Problem parsing 'file:/C:/Users/jekkt/workspace/ScenarioTools-Neon-OCL/org.xtext.example.mydsl/../org.xtext.example.mydsl/src/org/xtext/example/mydsl/MyDsl.xtext':
TransformationDiagnostic: null:28 Cannot find compatible feature type in sealed EClass Attribute from imported package http://www.example.org/testModel: The existing reference 'type' has an incompatible type 'null'. The expected type is 'EClassifier' [org.eclipse.emf.ecore.EClassifier]. (ErrorCode: CannotCreateTypeInSealedMetamodel)
java.lang.RuntimeException: Problems running workflow org.xtext.example.mydsl.GenerateMyDsl: Problem parsing 'file:/C:/Users/jekkt/workspace/ScenarioTools-Neon-OCL/org.xtext.example.mydsl/../org.xtext.example.mydsl/src/org/xtext/example/mydsl/MyDsl.xtext':
TransformationDiagnostic: null:28 Cannot find compatible feature type in sealed EClass Attribute from imported package http://www.example.org/testModel: The existing reference 'type' has an incompatible type 'null'. The expected type is 'EClassifier' [org.eclipse.emf.ecore.EClassifier]. (ErrorCode: CannotCreateTypeInSealedMetamodel)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:104)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36)
Caused by: java.lang.IllegalStateException: Problem parsing 'file:/C:/Users/jekkt/workspace/ScenarioTools-Neon-OCL/org.xtext.example.mydsl/../org.xtext.example.mydsl/src/org/xtext/example/mydsl/MyDsl.xtext':
TransformationDiagnostic: null:28 Cannot find compatible feature type in sealed EClass Attribute from imported package http://www.example.org/testModel: The existing reference 'type' has an incompatible type 'null'. The expected type is 'EClassifier' [org.eclipse.emf.ecore.EClassifier]. (ErrorCode: CannotCreateTypeInSealedMetamodel)
at org.eclipse.xtext.xtext.generator.XtextGeneratorLanguage.initialize(XtextGeneratorLanguage.java:272)
at org.eclipse.xtext.xtext.generator.StandardLanguage.initialize(StandardLanguage.java:169)
at org.eclipse.xtext.xtext.generator.XtextGenerator.initialize(XtextGenerator.java:176)
at org.eclipse.xtext.xtext.generator.XtextGenerator.checkConfigurationInternal(XtextGenerator.java:120)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent2.checkConfiguration(AbstractWorkflowComponent2.java:21)
at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.preInvoke(Mwe2Bridge.java:65)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.preInvoke(AbstractWorkflowComponent.java:197)
at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.preInvoke(AbstractCompositeWorkflowComponent.java:29)
at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:18)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:102)
... 4 more
Attachment: projects.zip
(Size: 51.37KB, Downloaded 178 times)
|
|
|
|
Re: Problem with ecore and the new generator [message #1738007 is a reply to message #1737852] |
Thu, 14 July 2016 23:01   |
Eclipse User |
|
|
|
I think this comes form the GenModel or the Xtext generator.
Since my grammar (and my model) uses ecore::EClassifier, the Ecore GenModel is needed to generate the language artifacts.
Yes I can file a ticket there.
Do you think this is a bug in the Xtext generator itself?
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03420 seconds