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

Bug 334152

Summary: Refactoring Collection Type Drops Generic from definition and deletes from Diagram
Product: [WebTools] Dali JPA Tools Reporter: Shaun Smith <shaun.smith>
Component: Diagram EditorAssignee: Stefan Dimov <stefan.dimov>
Status: VERIFIED FIXED QA Contact: Stefan Dimov <stefan.dimov>
Severity: major    
Priority: P3 CC: jolene.moffitt
Version: 0.5   
Target Milestone: 3.0 M6   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch none

Description Shaun Smith CLA 2011-01-12 13:45:24 EST
To reproduce:

1. Create new diagram
2. Add new Entity1
3. Add new Entity2
4. Create OneToMany from Entity1 to Entity2 which will create a field named "entity2" of type java.util.Collection<Entity2> in Entity1.
5. Right click on entity2 field of Entity1 and select "Refactor Attribute Type.."
6. Replace "java.util.Collection" with "java.util.List" and press Ok.
7. OneToMany relationship drops from the diagram and the field in the Entity1.java file is now just java.util.List with no generic--probably why it was dropped from the diagram as the list type is unknown.
Comment 1 Shaun Smith CLA 2011-01-12 14:01:56 EST
After the refactor you also get an error from Dali complaining that the target entity of the OneToMany is unknown.
Comment 2 Stefan Dimov CLA 2011-01-13 05:05:51 EST
That's because the type of the collection elements is not managed by the refactoring dialog and after refactoring the new type attribute is  java.util.List instead of java.util.List<Entity2>.
Comment 3 Shaun Smith CLA 2011-01-13 09:34:51 EST
Yes, that's the bug I'm reporting.  The refactoring doesn't preserve the collection's element type.
Comment 4 Stefan Dimov CLA 2011-01-13 09:39:11 EST
Agreed. I've targetted it for 0.7
Comment 5 Stefan Dimov CLA 2011-02-23 08:02:12 EST
Created attachment 189594 [details]
patch
Comment 6 Stefan Dimov CLA 2011-02-23 08:04:10 EST
The bug is important, so I've retargetted it for M6 and submitted the patch
Comment 7 Jolene Moffitt CLA 2011-05-02 13:03:49 EDT
Verified in Build I-3.3.0-20110414085808

Verified type is not dropped from diagram when changed from collection to list. See the link to view test steps for verification.
http://wiki.eclipse.org/Dali_3.0_M6