Community
Participate
Working Groups
Build Identifier: 20110218-0911 Object folderA is added into contents of resourceA and object folderB is added into contents of resourceB. folderA contains folderB. Unload of resourceB causes that folderB will be attached to resourceA but it was not detached from resourceB. Expected: folderB should be: 1. detached from resourceB 2. attached to resourceA Reproducible: Always Steps to Reproduce: 1. Run attached unit test
Created attachment 196289 [details] unit test
The fix is committed to CVS for EMF 2.8.
The fix is available in a build.
It seems that this bug fix causes regression to GMF see Bug #390022
Yes, GMF is calling internal APIs inappropriately. That method says /** * Sets this object to be directly contained by the resource * and returns accumulated notifications. * This is only done as the inverse of {@link Resource#getContents()}<code>.add(this)</code>. * @return accumulated notifications. */ NotificationChain eSetResource(Resource.Internal resource, NotificationChain notifications); I.e., it's only called as part of bidirectional handshaking. Calling it directly will leave things in an inconsistent state. I.e., the other half of the bidirectional isn't updated. In a newsgroup posting in July I suggested: The GMF code should be using resource.getContents().remove(...). I.e., perhaps it should be referencedObject.eResource().getContents().remove(referencedObject) though I'm not sure if the referenced object is necessarily contained directly in a resource so maybe it should check that eResource() isn't null. You should open a bugzilla for the GMF runtime to fix this.
Thanks for clarification, your suggestion works very well. I provided a patch for the GMF bug.