EcoreUtil.copy problem with CDO [message #1718359] |
Tue, 22 December 2015 16:25  |
Eclipse User |
|
|
|
I am converting an existing application to use CDO. The application uses EcoreUtil.copy in several places. The copy worked fine before converting to CDO (i.e. before altering the genmodel). Now when I copy an element, if the element has a set associated with an attribute (my attribute is ownedBaseElements), the copied element has a null value for the attribute, and the actual set is an entry under eSettings. The original element had a null under that eSettings entry.
Can someone explain to me why this is happening and tell me how to fix it?
|
|
|
|
|
|
Re: EcoreUtil.copy problem with CDO [message #1719246 is a reply to message #1718464] |
Wed, 06 January 2016 09:44   |
Eclipse User |
|
|
|
Ed,
I am a little confused about what code is supposed to be generated when Reflective is the feature generation choice. For example, I have a model relation commonNameLiteral that is Derived, Transient, and Volatile. Yet when I generate the code (configured for CDO) I get:
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Literal getCommonNameLiteral() {
return (Literal)eGet(CRLPackage.Literals.ELEMENT__COMMON_NAME_LITERAL, true);
}
I expected some kind of placeholder code here. Of course I can mark this as NOT generated and put my own code in, but I am concerned that other things will not be working. In particular, there seems to be some assumption that the eGet with these arguments will return the commonNameLiteral. If I simply rewrite the getCommonNameLiteral() method, this is not going to make the eGet() call work if called elsewhere. What am I missing?
[Updated on: Wed, 06 January 2016 09:45] by Moderator
|
|
|
Re: EcoreUtil.copy problem with CDO [message #1719253 is a reply to message #1719246] |
Wed, 06 January 2016 10:45   |
Eclipse User |
|
|
|
Paul,
Yes, sorry I got it exactly backward. For Dyanmic delegation, an eGet
is generated that calls the generated accessor, so you have proper hooks
where to specialize the code. For Reflective delegation, which is more
efficient because it completely bypasses the generated accessors, there
are no such hooks. Does that leave you with your original problem?
(I'll be away until next Monday, so follow up help won't be quick.)
On 06/01/2016 3:44 PM, Paul C. Brown wrote:
> Ed,
>
> I am a little confused about what code is supposed to be generated
> when Rflective is the feature generation choice. For example, I have a
> model relation commonNameLiteral that is Derived, Transient, and
> Volatile. Yet when I generate the code (configured for CDO) I get:
>
> /**
> * <!-- begin-user-doc -->
> * <!-- end-user-doc -->
> * @generated
> */
> public Literal getCommonNameLiteral() {
> return
> (Literal)eGet(CRLPackage.Literals.ELEMENT__COMMON_NAME_LITERAL, true);
> }
>
> I expected some kind of placeholder code here. Of course I can mark
> this as NOT generated and put my own code in, but I am concerned that
> other things will not be working. In particular, there seems to be
> some assumption that the eGet with these arguments will return the
> commonNameLiteral. If I simply rewrite the getCommonNameLiteral()
> method, this is not going to make the eGet() call work if called
> elsewhere. What am I missing?
>
|
|
|
|
|
Re: EcoreUtil.copy problem with CDO [message #1719844 is a reply to message #1719764] |
Tue, 12 January 2016 09:50  |
Eclipse User |
|
|
|
Paul,
You can open a bugzilla against the EMF project's Tools component. It's
not so likely to get attention without an associated Gerrit contribution.
On 11/01/2016 10:21 PM, Paul C. Brown wrote:
> Ed,
>
> I thought I had updated this, but my posting did not appear. I removed
> all my @generated NOT customizations, regenerated, and then modified
> the get<X>, basicGet<X> and set<X> methods for my derived, transient,
> and volatile references. Copy now works.
>
> It sure would be useful if the generated code for these three methods
> generated placeholders rather than finished code. It was less than
> clear that all three need to be updated (I thought the get<X> methods
> would call the basicGet<X> methods behind the scenes). How should I
> make this request (i.e. to what project)?
|
|
|
Powered by
FUDForum. Page generated in 0.24869 seconds