Merge issue "because its parent hasn't been merged yet" [message #1768694] |
Fri, 21 July 2017 17:18 |
Brian Fitzpatrick Messages: 500 Registered: July 2009 |
Senior Member |
|
|
Hi folks,
Hoping someone has an answer for me. :) We have had some code we've been moving forward since Juno & Luna with EMF Compare. It's not been updated in several years, but now with EMF Compare in Oxygen we're seeing a strange IllegalStateException: "java.lang.IllegalStateException: Couldn't move element because its parent hasn't been merged yet: MERGING LEFT MOVE"
I'm hoping it's just a new step we need to add for the latest release of EMF Compare, but really have no clue and my Google-fu has come up short.
Thank you in advance to anyone who has some ideas. I can point you at our github repo if you need more context
Here's the code (I've marked the line where it throws the exception with an arrow):
final List<Diff> generatedDifferences = comparison.getDifferences();
if (generatedDifferences.size() > 0) {
final EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor(_switchYard);
final InternalTransaction transaction;
if (domain instanceof TransactionalEditingDomainImpl) {
transaction = ((TransactionalEditingDomainImpl) domain).getActiveTransaction();
} else {
transaction = null;
}
if (transaction != null) {
transaction.pause();
}
try {
if (_generated.getContents().size() == 0) {
if (generatedResource.getContents().size() > 0) {
_generated.getContents().addAll(generatedResource.getContents());
generatedResource.getContents().clear();
}
} else {
final IBatchMerger merger = new BatchMerger(EMFCompareRCPPlugin.getDefault().getMergerRegistry(), new Predicate<Diff>() {
public boolean apply(Diff object) {
return object.getKind() != DifferenceKind.MOVE;
}
});
--------> merger.copyAllLeftToRight(generatedDifferences, new BasicMonitor());
pruneMissingReferences();
}
} finally {
if (transaction != null) {
transaction.resume(null);
}
}
And here's the exception:
!ENTRY org.eclipse.graphiti.ui 4 0 2017-07-21 10:37:45.267
!MESSAGE GFCommandStack.execute(Command) java.lang.IllegalStateException: Couldn't move element because its parent hasn't been merged yet: MERGING LEFT MOVE org.eclipse.emf.compare.internal.spec.ReferenceChangeSpec{reference=CamelImplementationType.xml,value=XMLDSLType@6aeabcb0 route.xml,parentMatch=org.eclipse.emf.compare.internal.spec.MatchSpec{left=CamelImplementationType@73a95ff8,right=<null>,origin=<null>,#differences=1,#submatches=1},match of value=org.eclipse.emf.compare.internal.spec.MatchSpec{left=XMLDSLType@6aeabcb0 route.xml,right=XMLDSLType@72425503 route.xml,origin=<null>,#differences=0,#submatches=0}}
!STACK 0
java.lang.IllegalStateException: Couldn't move element because its parent hasn't been merged yet: MERGING LEFT MOVE org.eclipse.emf.compare.internal.spec.ReferenceChangeSpec{reference=CamelImplementationType.xml,value=XMLDSLType@6aeabcb0 route.xml,parentMatch=org.eclipse.emf.compare.internal.spec.MatchSpec{left=CamelImplementationType@73a95ff8,right=<null>,origin=<null>,#differences=1,#submatches=1},match of value=org.eclipse.emf.compare.internal.spec.MatchSpec{left=XMLDSLType@6aeabcb0 route.xml,right=XMLDSLType@72425503 route.xml,origin=<null>,#differences=0,#submatches=0}}
at org.eclipse.emf.compare.merge.ReferenceChangeMerger.moveElement(ReferenceChangeMerger.java:204)
at org.eclipse.emf.compare.merge.ReferenceChangeMerger.accept(ReferenceChangeMerger.java:136)
at org.eclipse.emf.compare.merge.AbstractMerger.copyDiff(AbstractMerger.java:773)
at org.eclipse.emf.compare.merge.AbstractMerger.copyLeftToRight(AbstractMerger.java:796)
at org.eclipse.emf.compare.merge.BatchMerger.copyAllLeftToRight(BatchMerger.java:109)
at org.switchyard.tools.ui.editor.model.merge.MergedModelAdapterFactory.processUpdatesToGenerated(MergedModelAdapterFactory.java:168)
at org.switchyard.tools.ui.editor.impl.SwitchyardSCAEditor.synchronizeGeneratedModel(SwitchyardSCAEditor.java:560)
at org.switchyard.tools.ui.editor.diagram.SynchronizeGeneratedModelFeature.execute(SynchronizeGeneratedModelFeature.java:75)
at org.eclipse.graphiti.features.custom.AbstractCustomFeature.execute(AbstractCustomFeature.java:83)
at org.eclipse.graphiti.internal.command.GenericFeatureCommandWithContext.execute(GenericFeatureCommandWithContext.java:64)
at org.eclipse.graphiti.ui.internal.command.GefCommandWrapper.execute(GefCommandWrapper.java:51)
at org.eclipse.graphiti.ui.internal.editor.EmfOnGefCommand.execute(EmfOnGefCommand.java:54)
at org.eclipse.graphiti.internal.command.GFPreparableCommand2.doExecute(GFPreparableCommand2.java:43)
at org.eclipse.emf.transaction.RecordingCommand.execute(RecordingCommand.java:135)
at org.eclipse.emf.workspace.EMFCommandOperation.doExecute(EMFCommandOperation.java:119)
at org.eclipse.emf.workspace.AbstractEMFOperation.execute(AbstractEMFOperation.java:150)
at org.eclipse.core.commands.operations.DefaultOperationHistory.execute(DefaultOperationHistory.java:488)
at org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl.doExecute(WorkspaceCommandStackImpl.java:208)
at org.eclipse.emf.transaction.impl.AbstractTransactionalCommandStack.execute(AbstractTransactionalCommandStack.java:165)
at org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl.execute(GFWorkspaceCommandStackImpl.java:97)
at org.eclipse.graphiti.ui.internal.editor.GFCommandStack.execute(GFCommandStack.java:138)
at org.eclipse.graphiti.ui.editor.DiagramBehavior.executeFeature(DiagramBehavior.java:1133)
at org.switchyard.tools.ui.editor.impl.SwitchyardSCAEditor$3$1.run(SwitchyardSCAEditor.java:679)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4213)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3820)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1044)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
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:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
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:1499)
at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
|
|
|
Re: Merge issue "because its parent hasn't been merged yet" [message #1768823 is a reply to message #1768694] |
Mon, 24 July 2017 07:44 |
|
Hi Brian,
with Oxygen, we have enhanced the mechanism to determine the diff dependencies and the merge order. We now have a dedicated class that is responsible for that (see DiffRelationshipComputer). BatchMerger already uses this new mechanism though. So your code looks fine on a first glance and doesn't seem to need any migration.
The exception that you have mentioned can still occur, if you have dependency cycles in your differences. Do you have a customized the diffing or any post-processors that modify the comparison model?
Best wishes,
Philip
--
Philip Langer
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
|
|
Re: Merge issue "because its parent hasn't been merged yet" [message #1769858 is a reply to message #1768867] |
Fri, 04 August 2017 09:05 |
|
Hi,
Your FeatureFilter seems way too permissive at first sight. Have you tried disabling it to see if the bug goes away? I'm worried about it making EMF Compare create diffs that really shouldn't be merged (derived and transient references, for one, shouldn't be target for diff & subsequent merges). You'll likely have to review the criterion for filtering you're using in this if the default featurefilter doesn't present the bug you're encountering.
Laurent Goubet
Obeo
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04409 seconds