Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 132894 - Copying references breaks opposites
Summary: Copying references breaks opposites
Status: VERIFIED FIXED
Alias: None
Product: EMF
Classification: Modeling
Component: Tools (show other bugs)
Version: 2.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Dave Steinberg CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-22 16:03 EST by Aaron Digulla CLA
Modified: 2008-01-28 16:46 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.