Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 132894

Summary: Copying references breaks opposites
Product: [Modeling] EMF Reporter: Aaron Digulla <digulla>
Component: ToolsAssignee: Dave Steinberg <davidms>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.2   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Aaron Digulla CLA 2006-03-22 16:03:50 EST
1. Follow the steps to create the standard library example from annotated Java

2. Open the Ecore editor

3. Create a reference "lib" to Library in Writer

4. Choose writers in Library and set the opposite to the new attribute lib of Writer

5. Copy "lib" from Writer to Book

BUG #1: The opposite field in the new Book.lib reference isn't cleared. 

If you generate this model, getLib() will always return null after a book has been added to the library.

The model can be saved, loaded and generated without warnings or errors.

6. Fix the reference (either set the correct opposite in Library.books or Book.lib, doesn't matter which)

BUG #2: The opposite in Library.writers(!) will be set to null by this. Writer.lib will still point to Library.writers. Trying to add writers or calling Writer.setLib() will cause all kinds of problems.
Comment 1 Dave Steinberg CLA 2006-03-24 13:06:10 EST
The fix is in CVS.

I've specialized copy initialization for EReferences, so that the eOpposite is only set if the target was also copied as part of the command.
Comment 2 Nick Boldt CLA 2006-03-30 02:27:19 EST
Fixed in 2.2.0 I200603300000
Comment 3 Nick Boldt CLA 2008-01-28 16:46:35 EST
Move to verified as per bug 206558.