Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 14:31 Go to next message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 270
Registered: August 2010
Senior Member
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 07:20 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
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.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: The changeRecorder consolidateChanges does not seem to handle opposite features [message #1748500 is a reply to message #1748433] Wed, 23 November 2016 16:16 Go to previous message
Florian Barbin is currently offline Florian BarbinFriend
Messages: 270
Registered: August 2010
Senior Member
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: Thu Apr 25 17:41:20 GMT 2024

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

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

Back to the top