| Summary: | Extensions for Resources (such as Templates / Extensions) aren't cached properly | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] M2T | Reporter: | thomas_ <thomas.fischer.lgz> | ||||||
| Component: | Xpand | Assignee: | Karsten Thoms <karsten.thoms> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | karsten.thoms, thomas.fischer.lgz | ||||||
| Version: | unspecified | Flags: | karsten.thoms:
kepler+
|
||||||
| Target Milestone: | M4 | ||||||||
| Hardware: | Macintosh | ||||||||
| OS: | Mac OS X - Carbon (unsup.) | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 182392 [details]
Shows the contents of the cache and the corresponding break-point used to display them
Created attachment 182394 [details]
Shows the two different ExecutionContextImpl-instances
The current ExecutionContextImpl has ID 49 (see top right) and it's current resource is really the current resource (e.g. the template / extension).
The executionContext related to the cache has ID 18. It's current resource is null.
Quick-fix: Use the currentResource2 as key Confirmed and fixed. Requested via bug 522520. -M. Requested via bug 522520. -M. |
Build Identifier: 20100917-0705 The (Xpand)ExecutionContextImpl uses an internal map in order to cache extensions per resource (allExtensionsPerResource<key: theResource, value: allTheExtensionsInThatResource)>. Unfortunately null is (always) used as the key. Thus the mechanism doesn't work and the extensions are calculated every time. Reason: The method internalAllExtensions() calculates the extensions for a given resource and then calls currentResource() in order to retrieve the value of the key (which is then used to store the extensions in the cache). This call always returns null. Underlying reason: Mix up of Execution-Context-Instances The ExecutionContextImpl uses another cache "extensionsForNameAndTypesCache" to allow quick access to an extension for a specific type. This cache calls the internalAllResources method of the ExecutionContextImpl in case the right extensions haven't been cached yet. In order to be able to call that private method, the Cache holds an instance to the ExecutionContextImpl (the one it was created with). This instance doesn't change over time (as well as it's currentResource-attribute). (The cache itself is passed from ExecutionContextImpl to ExecutionContextImpl over time (cloneContext)) Please also see attached screenshots. If you require further information, please feel free to contact me by email. Reproducible: Always Steps to Reproduce: 1. Download Eclipse with Modeling Tools (Build ID 20100917-0705) 2. Install the XPand-Plugins 3. Create the default project 4. Set this conditional breakpoint _____________________________________________________________________________ System.err.println("all extensionsPerResource now contains: " + allExtensionsPerResource); return false; _____________________________________________________________________________ in Line 340 (return allExtensions) of the ExecutionContextImpl class