Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [EMF/CDO] instanceof EObject/Resource issue
[EMF/CDO] instanceof EObject/Resource issue [message #1066423] Tue, 02 July 2013 15:27 Go to next message
Eclipse UserFriend
Hi Ed and Eike,

I would like to discuss about a old issue about CDOResource which
inherits EObject. In our products we have many bugs due to condition in
code which check if an element is instance of EObject without checking
if it is not also instance of Resource. We can change these conditions
in our code but not in the dependencies like org.eclipse.emf.ecore.

For example in EcoreUtil.CrossReferencer.crossReference() there is a
check on the variable "content" to check if it is of type EObject while
by contract nothing forbid Resource implementations to inherit of
EObject. And with CDOResource, this has the effect to have the
CrossReferencer not working.
The fix is be quite simple by improving the condition to test that the
"content" variable is not instanceof of Resource.
I would like to note that in CDO the fact to have to have the resource
hierarchy described by a model is very usefull.
Then before to raise a bugzilla which could be closed as WONTFIX, I
would like to have your advice.


Best Regards.
Re: [EMF/CDO] instanceof EObject/Resource issue [message #1066435 is a reply to message #1066423] Tue, 02 July 2013 15:58 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Esteban,

Comments below.

On 02/07/2013 5:27 PM, Esteban DUGUEPEROUX wrote:
> Hi Ed and Eike,
>
> I would like to discuss about a old issue about CDOResource which
> inherits EObject. In our products we have many bugs due to condition
> in code which check if an element is instance of EObject without
> checking if it is not also instance of Resource. We can change these
> conditions in our code but not in the dependencies like
> org.eclipse.emf.ecore.
>
> For example in EcoreUtil.CrossReferencer.crossReference() there is a
> check on the variable "content" to check if it is of type EObject
> while by contract nothing forbid Resource implementations to inherit
> of EObject. And with CDOResource, this has the effect to have the
> CrossReferencer not working.
So a Resource isn't really a well behaved EObject in some ways... Or
there are times it must be treated as a Resource but not an EObject.
You can see how problematic that is to generalize. How should it be
treat and when as one thing but not as another?
> The fix is be quite simple by improving the condition to test that the
> "content" variable is not instanceof of Resource.
At the cost of all clients...
> I would like to note that in CDO the fact to have to have the resource
> hierarchy described by a model is very usefull.
But also problematic.
> Then before to raise a bugzilla which could be closed as WONTFIX, I
> would like to have your advice.
I'm definitely averse to making all clients pay a performance penalty...
>
>
> Best Regards.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:can href resolve packages via ns-uri?
Next Topic:Loading ecore as dynamic instances from a workspace
Goto Forum:
  


Current Time: Fri Apr 26 07:13:23 GMT 2024

Powered by FUDForum. Page generated in 0.03187 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top