当我扩展Xcore语言(从而扩展ECore)时出现问题

时间:2018-06-25 14:17:29

标签: xtext xcore

我正在尝试扩展XCore语言。 为此,我在Eclipse Oxygen中创建了一个新的XText项目。这里是Xtext文件:

grammar org.xtext.example.mydsl.MyDsl with org.eclipse.emf.ecore.xcore.Xcore

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

Model:
    pack=XExpression
;

在清单文件中,我向Xcore v.1.5添加了一个依赖项。

最后,将MWE2文件插入int,添加以下行:

component = XtextGenerator {
    [...]
    language = StandardLanguage {
        [...]
        referencedResource = "platform:/resource/org.eclipse.emf.ecore.xcore/model/Xcore.genmodel"
        [...]
   }
}

但是,执行MWE2工作流程时出现以下错误:

[ERROR]: GeneratorException: (Element: -UNKNOWN-; Reported by: XtextGenerator)  
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: org.eclipse.emf.ecore.xmi.IllegalValueException: Value 'org.eclipse.emf.ecore.impl.EReferenceImpl@5734eaa7 (name: null) (ordered: true, unique: true, lowerBound: 0, upperBound: 1) (changeable: true, volatile: false, transient: false, defaultValueLiteral: null, unsettable: false, derived: false) (containment: false, resolveProxies: true)' is not legal. (platform:/resource/org.xtext.example.mydsl/model/generated/MyDsl.genmodel, 10, 129)

Caused by: org.eclipse.emf.ecore.xmi.IllegalValueException: Value 'org.eclipse.emf.ecore.impl.EReferenceImpl@5734eaa7 (name: null) (ordered: true, unique: true, lowerBound: 0, upperBound: 1) (changeable: true, volatile: false, transient: false, defaultValueLiteral: null, unsettable: false, derived: false) (containment: false, resolveProxies: true)' is not legal. (platform:/resource/org.xtext.example.mydsl/model/generated/MyDsl.genmodel, 10, 129)

Caused by: java.lang.ClassCastException: The value of type 'org.eclipse.emf.ecore.impl.EClassImpl@5abca1e0 (name: EReference) (instanceClassName: null) (abstract: false, interface: false)' must be of type 'org.eclipse.emf.ecore.impl.EClassImpl@5ecba515 (name: EStructuralFeature) (instanceClassName: null) (abstract: true, interface: false)'

我测试过的东西

  • 我在另一台装有Eclipse的计算机上进行了测试,问题仍然相似
  • 如果我在语言定义中用XBase替换XCore,则不会出现问题
  • 添加导入语句不能解决问题

0 个答案:

没有答案