Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Objects may be created using multiple strategies which can create incompatible objects in a single model #1591

Closed
sbegaudeau opened this issue Jan 19, 2023 · 1 comment · Fixed by #1756

Comments

@sbegaudeau
Copy link
Member

When we are creating the root objects of a resource, we are loading on the fly the EPackages from scratch without considering existing EPackages loaded in the package registry of the editing domain.

01 - New root object UI

02 - Invalid EPackage

When we are creating objects using a dedicated tool from the view DSL with some model operations, they are created using the EPackages available in the package registry of the editing domain.

Let's consider a click on New Operational Entity which comes with a dedicated node tool using the view DSL.

03 - New object from view with createInstance model operation

04 - Create instance model operation behavior

As a result, it is quite easy to create a model in which the root object and objects created using the view DSL do not share the same EPackage. For some reason, this does not seems to create any issue in my case.

05 - Incompatible EPackages

The problem becomes obvious since, when we are creating objects using the view DSL thanks to a canonical tool, the EPackage used is the EPackage of self and thus the source of the metamodel to use may change depending on the target of the tool.

Let's consider a click on New Operational Actor which rely on the canonical behavior.

06 - Creating new child using the canonical behavior

07 - The canonical behavior uses the EPackage of the container

Now we will end up with two subgraphs of objects in our domain using the same concepts from two versions of our EPackage.

08 - Using the canonical behavior again

09 - Trying to create an edge between the two objects

@pcdavid
Copy link
Member

pcdavid commented Feb 10, 2023

Example stack trace (to make it easier to search for the issue):

java.util.concurrent.ExecutionException: java.lang.ClassCastException: The value of type 'org.eclipse.emf.ecore.impl.EClassImpl@31245735 (name: Component) (instanceClassName: null) (abstract: false, interface: false)' must be of type 'org.eclipse.emf.ecore.impl.EClassImpl@4ccbab80 (name: Component) (instanceClassName: null) (abstract: false, interface: false)'
	at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) ~[na:na]
	at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) ~[na:na]
	at org.eclipse.sirius.components.collaborative.editingcontext.EditingContextEventProcessor.handle(EditingContextEventProcessor.java:217) ~[classes/:na]
	at org.eclipse.sirius.components.collaborative.editingcontext.EditingContextEventProcessorRegistry.lambda$1(EditingContextEventProcessorRegistry.java:76) ~[classes/:na]
	at java.base/java.util.Optional.map(Optional.java:260) ~[na:na]
	at org.eclipse.sirius.components.collaborative.editingcontext.EditingContextEventProcessorRegistry.dispatchEvent(EditingContextEventProcessorRegistry.java:76) ~[classes/:na]
	at org.eclipse.sirius.components.starter.services.EditingContextDispatcher.dispatchMutation(EditingContextDispatcher.java:54) ~[classes/:na]
	at org.eclipse.sirius.components.diagrams.graphql.datafetchers.mutation.MutationInvokeSingleClickOnTwoDiagramElementsToolDataFetcher.lambda$0(MutationInvokeSingleClickOnTwoDiagramElementsToolDataFetcher.java:57) ~[classes/:na]
	at org.eclipse.sirius.components.starter.services.ExceptionWrapper.wrapMono(ExceptionWrapper.java:61) ~[classes/:na]
	at org.eclipse.sirius.components.diagrams.graphql.datafetchers.mutation.MutationInvokeSingleClickOnTwoDiagramElementsToolDataFetcher.get(MutationInvokeSingleClickOnTwoDiagramElementsToolDataFetcher.java:57) ~[classes/:na]
	at org.eclipse.sirius.components.diagrams.graphql.datafetchers.mutation.MutationInvokeSingleClickOnTwoDiagramElementsToolDataFetcher.get(MutationInvokeSingleClickOnTwoDiagramElementsToolDataFetcher.java:1) ~[classes/:na]
	at graphql.execution.instrumentation.dataloader.DataLoaderDispatcherInstrumentation.lambda$instrumentDataFetcher$0(DataLoaderDispatcherInstrumentation.java:87) ~[graphql-java-18.3.jar:na]
	at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:279) ~[graphql-java-18.3.jar:na]
	at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:210) ~[graphql-java-18.3.jar:na]
	at graphql.execution.ExecutionStrategy.resolveField(ExecutionStrategy.java:182) ~[graphql-java-18.3.jar:na]
	at graphql.execution.AsyncSerialExecutionStrategy.lambda$execute$1(AsyncSerialExecutionStrategy.java:43) ~[graphql-java-18.3.jar:na]
	at graphql.execution.Async.eachSequentiallyImpl(Async.java:80) ~[graphql-java-18.3.jar:na]
	at graphql.execution.Async.eachSequentially(Async.java:69) ~[graphql-java-18.3.jar:na]
	at graphql.execution.AsyncSerialExecutionStrategy.execute(AsyncSerialExecutionStrategy.java:38) ~[graphql-java-18.3.jar:na]
	at graphql.execution.Execution.executeOperation(Execution.java:159) ~[graphql-java-18.3.jar:na]
	at graphql.execution.Execution.execute(Execution.java:105) ~[graphql-java-18.3.jar:na]

@sbegaudeau sbegaudeau added this to the 2023.4.0 milestone Feb 23, 2023
mcharfadi added a commit to mcharfadi/sirius-components that referenced this issue Feb 23, 2023
…ate incompatible objects in a single model

Bug: eclipse-sirius#1591

Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
sbegaudeau pushed a commit to mcharfadi/sirius-components that referenced this issue Feb 27, 2023
…ate incompatible objects in a single model

Bug: eclipse-sirius#1591
Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
sbegaudeau pushed a commit that referenced this issue Feb 27, 2023
…ate incompatible objects in a single model

Bug: #1591
Signed-off-by: Michaël Charfadi <michael.charfadi@obeosoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants