Bug 574840 - EMF Model dangling eAdapters
Summary: EMF Model dangling eAdapters
Status: ASSIGNED
Alias: None
Product: Epsilon
Classification: Modeling
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Dimitris Kolovos CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-14 05:51 EDT by Horacio Hoyos CLA
Modified: 2021-07-14 06:59 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Horacio Hoyos CLA 2021-07-14 05:51:46 EDT
This behaviour was seen using InMemoryEmfModel.

After executing a module, I call "unload" in the wrapped EMF Resource, which causes a "Type Not found" exception. Looking at the stack trace, the issue is that the "CachedContentsAdapter" is still attached to the Resource and the unloading causes the type not found error. 

Calling dispose on the modelRepository did not solve the issue. 

I propose that the adapters are removed in the EmfModel dispose implementation so that disposing the model (or the model repository) would effectively removed any attached adapters. 

IMHO, in the particular case of InMemoryEmfModels, an alternative mechanism should be used for the cache, as (potentially) the resource is used elsewhere and attaching adapters can create hard to track issues in the future.

On a side note, why does a missing type prints the stack trace on the console but does not generate an exception? It is counter intuitive to see errors in the console but execution still completes correctly.
Comment 1 Dimitris Kolovos CLA 2021-07-14 06:59:35 EDT
Thanks for reporting this Horacio. Could you please share a minimal example / unit test I can use to reproduce this?