Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Cross reference adapter resolves proxy although it shouldn't?
Cross reference adapter resolves proxy although it shouldn't? [message #1112467] Thu, 19 September 2013 18:58 Go to next message
Eclipse UserFriend
Hi!

I am confused about a code fragment in
org.eclipse.emf.ecore.util.ECrossReferenceAdapter.getInverseReferences(EObject
eObject, boolean resolve):

Even if called with resolve = false, the following happens:
1. eObject.eContainer() is called
2. eContainer() calls: InternalEObject result = eInternalContainer();
3. since 'result' is a proxy, it calls: eResolveProxy(result);

Is that on purpose? I would have thought that in 1. instead of calling
'eContainer()' the cross reference adapter should rather call
'eInternalContainer()' to avoid proxy resolution.

Don't know whether it has side-effects.. but what about:
EObject eContainer = resolve ? eObject.eContainer() :
((BasicEObjectImpl)eObject).eInternalContainer();

Cheers
Patrick
Re: Cross reference adapter resolves proxy although it shouldn't? [message #1112741 is a reply to message #1112467] Fri, 20 September 2013 05:17 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Patrick,

That does seem inconsistent. Apparently it wasn't adjusted when proxy
resolving containment/containers was added. Please open a bugzilla.


On 19/09/2013 8:58 PM, Patrick Könemann wrote:
> Hi!
>
> I am confused about a code fragment in
> org.eclipse.emf.ecore.util.ECrossReferenceAdapter.getInverseReferences(EObject
> eObject, boolean resolve):
>
> Even if called with resolve = false, the following happens:
> 1. eObject.eContainer() is called
> 2. eContainer() calls: InternalEObject result = eInternalContainer();
> 3. since 'result' is a proxy, it calls: eResolveProxy(result);
>
> Is that on purpose? I would have thought that in 1. instead of calling
> 'eContainer()' the cross reference adapter should rather call
> 'eInternalContainer()' to avoid proxy resolution.
>
> Don't know whether it has side-effects.. but what about:
> EObject eContainer = resolve ? eObject.eContainer() :
> ((BasicEObjectImpl)eObject).eInternalContainer();
>
> Cheers
> Patrick


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Cross reference adapter resolves proxy although it shouldn't? [message #1112785 is a reply to message #1112741] Fri, 20 September 2013 06:55 Go to previous message
Eclipse UserFriend
Ed,

thanks for the quick reply. Here's the bug:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=417667

Cheers
Patrick


Am 20.09.2013 07:17, schrieb Ed Merks:
> Patrick,
>
> That does seem inconsistent. Apparently it wasn't adjusted when proxy
> resolving containment/containers was added. Please open a bugzilla.
>
>
> On 19/09/2013 8:58 PM, Patrick Könemann wrote:
>> Hi!
>>
>> I am confused about a code fragment in
>> org.eclipse.emf.ecore.util.ECrossReferenceAdapter.getInverseReferences(EObject
>>
>> eObject, boolean resolve):
>>
>> Even if called with resolve = false, the following happens:
>> 1. eObject.eContainer() is called
>> 2. eContainer() calls: InternalEObject result = eInternalContainer();
>> 3. since 'result' is a proxy, it calls: eResolveProxy(result);
>>
>> Is that on purpose? I would have thought that in 1. instead of calling
>> 'eContainer()' the cross reference adapter should rather call
>> 'eInternalContainer()' to avoid proxy resolution.
>>
>> Don't know whether it has side-effects.. but what about:
>> EObject eContainer = resolve ? eObject.eContainer() :
>> ((BasicEObjectImpl)eObject).eInternalContainer();
>>
>> Cheers
>> Patrick
>
Previous Topic:Texo Relation as map
Next Topic:EMF or Teneo: Unable to not specify optional enumeration
Goto Forum:
  


Current Time: Fri Apr 26 08:36:00 GMT 2024

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

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

Back to the top