Skip to main content



      Home
Home » Modeling » EMF » The changeRecorder consolidateChanges does not seem to handle opposite features
The changeRecorder consolidateChanges does not seem to handle opposite features [message #1748370] Tue, 22 November 2016 09:31 Go to next message
Eclipse UserFriend
Hi,

In Sirius we have a DNode.outgoingEdges feature which is the opposite of DEdge.sourceNode feature. That is the same with DNode.incomingEdges and DEdge.targetNode.

We have a situation where a DEdge can be created and removed in a same transaction. Those actions are performed by recordingCommands.

In short, the state before the transaction is DNode.outgoingEdges = empty and the DEdge does not exist. After the transaction, DNode.outgoingEdges is still empty and the DEdge is properly detached from its parent.

But performing an undo leads to this state:
DNode.outgoingEdges references the DEdge created before, the DEdge.sourceNode references the DNode but the DEdge is still detached from its parent.

Indeed, the first time we created the DEdge and called DEdge.setSourceNode(DNode), the TransactionChangeRecorder has created a FeatureChange based on DNode.outgoingEdges (the opposite) with value = empty list.

Next, the DEdge cross references are removed (EcoreUtil.remove(setting, eObject)) and finally the DEdge is removed (EcoreUtil.remove(eObject)). But this time, the TransactionChangeRecorder has created a FeatureChange based on DEdge.sourceNode with value = DNode.

During the consolidation (org.eclipse.emf.ecore.change.util.BasicChangeRecorder.consolidateChanges()) the eliminateEmptyChanges method removes the DNode.outgoingEdges featureChange since the value is the same than the current state.

At the end of the consolidation, only DEdge.sourceNode remains with value = DNode. That explains the undo behavior.

Does this look like a bug in the EMF ChangeRecorder or do we missed something to handle this case ?

I will make a junit test based on ecore and attach it to a bugzilla if needed.

Regards,

Florian
Re: The changeRecorder consolidateChanges does not seem to handle opposite features [message #1748433 is a reply to message #1748370] Wed, 23 November 2016 02:20 Go to previous messageGo to next message
Eclipse UserFriend
I'd need to see a test case. If its involves things other than what's in the test case and in the EMF Core framework, i.e., the Transaction framework, then open it against that framework.
Re: The changeRecorder consolidateChanges does not seem to handle opposite features [message #1748500 is a reply to message #1748433] Wed, 23 November 2016 11:16 Go to previous message
Eclipse UserFriend
I raised this bugzilla[1]

The problem is that the DEdge feature is modified before attaching it to its parent. That why the changeRecorder create a feature change only for the eOpposite.

This issue is similar to this bug[2].

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=508056
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=311334
Previous Topic:How to set up dev environment for contributions
Next Topic:XMI idref reading error
Goto Forum:
  


Current Time: Sun Jul 13 08:55:46 EDT 2025

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

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

Back to the top