Open joerg-holtmann opened 2 years ago
The relevant error seems to be FunctionFlowPort.type is required to have a value, but it does not
.
This is the full stack trace:
org.eclipse.core.commands.ExecutionException: Error executing 'org.bumble.eatxt.ui.handlers.importFromEaxml': java.lang.RuntimeException: Could not serialize FunctionFlowPort:
FunctionFlowPort.type is required to have a value, but it does not.
Semantic Object: EAXML.topLevelPackage[0]->EAPackage''.subPackage[1]->EAPackage'EnvironmentTypes'.element[1]->DesignFunctionType'ABS_RR_D5_Monitor_T'.port[0]->FunctionFlowPort'ABSTorqueRRIn'
URI: file:/Users/janste/Workspaces/runtime-EclipseXtext/eatester/Untitled.eatxt
Context: FunctionPort returns FunctionFlowPort
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:170)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:438)
at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:449)
at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:475)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4441)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1324)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4227)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3837)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1461)
at org.eclipse.equinox.launcher.Main.main(Main.java:1434)
Caused by: org.eclipse.e4.core.di.InjectionException: java.lang.RuntimeException: Could not serialize FunctionFlowPort:
FunctionFlowPort.type is required to have a value, but it does not.
Semantic Object: EAXML.topLevelPackage[0]->EAPackage''.subPackage[1]->EAPackage'EnvironmentTypes'.element[1]->DesignFunctionType'ABS_RR_D5_Monitor_T'.port[0]->FunctionFlowPort'ABSTorqueRRIn'
URI: file:/Users/janste/Workspaces/runtime-EclipseXtext/eatester/Untitled.eatxt
Context: FunctionPort returns FunctionFlowPort
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:68)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:319)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:253)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
... 36 more
Caused by: java.lang.RuntimeException: Could not serialize FunctionFlowPort:
FunctionFlowPort.type is required to have a value, but it does not.
Semantic Object: EAXML.topLevelPackage[0]->EAPackage''.subPackage[1]->EAPackage'EnvironmentTypes'.element[1]->DesignFunctionType'ABS_RR_D5_Monitor_T'.port[0]->FunctionFlowPort'ABSTorqueRRIn'
URI: file:/Users/janste/Workspaces/runtime-EclipseXtext/eatester/Untitled.eatxt
Context: FunctionPort returns FunctionFlowPort
at org.eclipse.xtext.serializer.diagnostic.ISerializationDiagnostic$ExceptionThrowingAcceptor.accept(ISerializationDiagnostic.java:132)
at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:514)
at org.bumble.eatxt.serializer.EatxtSemanticSequencer.sequence_FunctionFlowPort(EatxtSemanticSequencer.java:3408)
at org.bumble.eatxt.serializer.EatxtSemanticSequencer.sequence(EatxtSemanticSequencer.java:584)
at org.eclipse.xtext.serializer.sequencer.AbstractSemanticSequencer.createSequence(AbstractSemanticSequencer.java:68)
at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:327)
at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:354)
at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:265)
at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:445)
at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:512)
at org.bumble.eatxt.serializer.EatxtSemanticSequencer.sequence_DesignFunctionType_Impl(EatxtSemanticSequencer.java:2077)
at org.bumble.eatxt.serializer.EatxtSemanticSequencer.sequence(EatxtSemanticSequencer.java:398)
at org.eclipse.xtext.serializer.sequencer.AbstractSemanticSequencer.createSequence(AbstractSemanticSequencer.java:68)
at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:327)
at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:354)
at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:265)
at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:445)
at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:512)
at org.bumble.eatxt.serializer.EatxtSemanticSequencer.sequence_EAPackage(EatxtSemanticSequencer.java:2325)
at org.bumble.eatxt.serializer.EatxtSemanticSequencer.sequence(EatxtSemanticSequencer.java:434)
at org.eclipse.xtext.serializer.sequencer.AbstractSemanticSequencer.createSequence(AbstractSemanticSequencer.java:68)
at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:327)
at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:354)
at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:265)
at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:445)
at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:512)
at org.bumble.eatxt.serializer.EatxtSemanticSequencer.sequence_EAPackage(EatxtSemanticSequencer.java:2325)
at org.bumble.eatxt.serializer.EatxtSemanticSequencer.sequence(EatxtSemanticSequencer.java:434)
at org.eclipse.xtext.serializer.sequencer.AbstractSemanticSequencer.createSequence(AbstractSemanticSequencer.java:68)
at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:327)
at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:354)
at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:265)
at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.accept(BacktrackingSemanticSequencer.java:445)
at org.eclipse.xtext.serializer.sequencer.BacktrackingSemanticSequencer.createSequence(BacktrackingSemanticSequencer.java:512)
at org.bumble.eatxt.serializer.EatxtSemanticSequencer.sequence_EAXML(EatxtSemanticSequencer.java:2384)
at org.bumble.eatxt.serializer.EatxtSemanticSequencer.sequence(EatxtSemanticSequencer.java:443)
at org.eclipse.xtext.serializer.sequencer.AbstractSemanticSequencer.createSequence(AbstractSemanticSequencer.java:68)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:122)
at org.eclipse.xtext.serializer.impl.Serializer.serializeToRegions(Serializer.java:144)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:150)
at org.eclipse.xtext.serializer.impl.Serializer.serialize(Serializer.java:202)
at org.eclipse.xtext.resource.XtextResource.doSave(XtextResource.java:387)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1475)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.save(ResourceImpl.java:1044)
at org.bumble.eatxt.ui.handlers.ImportFromEaxmlHandler.execute(ImportFromEaxmlHandler.java:109)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
... 40 more
@Wilson008, could you please check if FunctionFlowPort.type is optional in the metamodel but required in the grammar for some reason?
According to @Wilson008, the element is required in the metamodel as well as in the grammar. This could be an instance of #31 where Xtext is more restrictive when dereferencing elements than EMF.
FunctionFlowPort
I think that we have talked about it before, but this is still an open issue. So writing something clear is always a good thing.
Yes, I have checked FunctionFlowPort.type, it is a mandatory attribute in the Grammar (which was generated from the 2.22 metamodel), while it is optional in the EATOP.
@steghoja @joerg-holtmann After doing some small experiments, I found this issue could be addressed by adding optionality to those attributes, i.e., add "( )?" to those attributes. I did this addition on the following attributes:
Then now, the new issue comes:
org.eclipse.core.commands.ExecutionException: Error executing 'org.bumble.eatxt.ui.handlers.importFromEaxml': java.lang.RuntimeException: Error while converting value 'null' for grammar rule 'UUID' to string via ValueConverter. Caused By: java.lang.RuntimeException: Must not be null Semantic Object: EAXML.topLevelPackage[0]->EAPackage''.element[0]->Timing''.description[0]->EventFunction'' URI: file:/D:/02.Git%20Repository/eatxt/examples/org.bumble.eastadl.simplified.examples/test08241636.eatxt EStructuralFeature: ::Identifiable.uuid Semantic Object: EAXML.topLevelPackage[0]->EAPackage''.element[0]->Timing''.description[0]->EventFunction'' URI: file:/D:/02.Git%20Repository/eatxt/examples/org.bumble.eastadl.simplified.examples/test08241636.eatxt EStructuralFeature: ::Identifiable.uuid at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:170) at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488) at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487) at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213) at org.eclipse.e4.ui.workbench.renderers.swt.HandledContributionItem.executeItem(HandledContributionItem.java:438) at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.handleWidgetSelection(AbstractContributionItem.java:449) at org.eclipse.e4.ui.workbench.renderers.swt.AbstractContributionItem.lambda$2(AbstractContributionItem.java:475) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4209) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1043) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4026) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3626) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590) at org.eclipse.equinox.launcher.Main.run(Main.java:1461) at org.eclipse.equinox.launcher.Main.main(Main.java:1434) ... 83 more
The solution seems to be to override a ValueConverter for the type null.
The file org.bumble.eatxt.examples\FMU_BBW_4Wheel_2.2EM.eaxml (using large portions of the full metamodel) does not convert to EATXT.