Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Compare » Merge issue "because its parent hasn't been merged yet"(Running into weird IllegalStateException in Oxygen we haven't seen before)
Merge issue "because its parent hasn't been merged yet" [message #1768694] Fri, 21 July 2017 17:18 Go to next message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
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 Go to previous messageGo to next message
Philip Langer is currently offline Philip LangerFriend
Messages: 84
Registered: March 2015
Location: Vienna, Austria
Member

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 #1768866 is a reply to message #1768823] Mon, 24 July 2017 13:16 Go to previous messageGo to next message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
We have some diffengine changes - https://github.com/jboss-switchyard/tools/blob/master/eclipse/plugins/org.switchyard.tools.ui.editor/src/org/switchyard/tools/ui/editor/model/merge/SwitchYardDiffEngine.java
Re: Merge issue "because its parent hasn't been merged yet" [message #1768867 is a reply to message #1768866] Mon, 24 July 2017 13:18 Go to previous messageGo to next message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
But I quite honestly am not all that familiar with this code that was written back in the Luna timeframe.
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 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1858
Registered: July 2009
Senior Member
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
Re: Merge issue "because its parent hasn't been merged yet" [message #1770567 is a reply to message #1769858] Mon, 14 August 2017 14:47 Go to previous messageGo to next message
Brian Fitzpatrick is currently offline Brian FitzpatrickFriend
Messages: 500
Registered: July 2009
Senior Member
Forgive my ignorance, but how would I go about disabling my FeatureFilter?
Re: Merge issue "because its parent hasn't been merged yet" [message #1770678 is a reply to message #1770567] Wed, 16 August 2017 08:13 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1858
Registered: July 2009
Senior Member
Hi,

Comment out the "createFeatureFilter()" method of the class you've linked here. This will allow you to test the comparison and merge operation you were trying without interference from your custom featurefilter.

Laurent Goubet
Obeo
Previous Topic:EMF Compare EGIT Performance
Next Topic:Undo a Merge
Goto Forum:
  


Current Time: Mon Sep 24 13:04:09 GMT 2018

Powered by FUDForum. Page generated in 0.03385 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top