Bug 156432 - Element checks for unapplicable stereotypes before the resource assigns a GUID
Summary: Element checks for unapplicable stereotypes before the resource assigns a GUID
Status: VERIFIED FIXED
Alias: None
Product: MDT.UML2
Classification: Modeling
Component: Core (show other bugs)
Version: 2.0.0   Edit
Hardware: Other Linux
: P3 major (vote)
Target Milestone: 2.0.1   Edit
Assignee: Kenn Hussey CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2006-09-06 16:27 EDT by Christian Damus CLA
Modified: 2008-01-28 16:36 EST (History)
0 users

See Also:


Attachments
Patch that fixes the problem for me (1.31 KB, patch)
2006-09-06 16:28 EDT, Christian Damus CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Damus CLA 2006-09-06 16:27:25 EDT
The ElementImpl class overrides the two-argument protected eBasicSetContainer() method to call super then check whether any stereotypes that are applied should be unapplied because the new context does not have the correct profile.

This happens before the public three-argument eBasicSetContainer() method tells the element's resource that it is attached.  If the resource is one that is ID-based (possibly UUID-based), then adding a new element to a UML model causes the following work to be done for nothing:
  - look for applied stereotypes.  This causes the cross-reference adapter to
    resolve all proxies for the newly added element
  - the adapter attempts to get the element's fragment from the resource.
    The resource has not yet assigned an ID, so the default
    hierarchical-name-based algorithm is applied
  - the algorithm for computing the fragment traverses resolving
    eContents() lists
  - this causes containment proxies to be resolved in my application, loading
    resources that do not need to be loaded

Moreover, the protected eBasicSetContainer() is also called by eContainer() when resolving container proxies.  In this case, the structure of the model is not changing so there is no need even to consider that stereotypes may need to be unapplied.

I think that if the ElementImpl class overrides the public eBasicSetContainer method, instead, then this problem will not occur.
Comment 1 Christian Damus CLA 2006-09-06 16:28:57 EDT
Created attachment 49539 [details]
Patch that fixes the problem for me

Attached a patch that fixes the eContents containment proxy resolution problem for me in my ID-based resource.  I have not tested that this will do the right thing by stereotype applications.
Comment 2 Kenn Hussey CLA 2006-09-06 21:40:58 EDT
The fix has been committed to CVS.
Comment 3 Kenn Hussey CLA 2006-09-07 15:48:32 EDT
Fixed in M200609071509.
Comment 4 Nick Boldt CLA 2008-01-28 16:36:12 EST
Move to verified as per bug 206558.