eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[oclinecore] References to external Ecore are not persisted #1697

Closed eclipse-ocl-bot closed 1 month ago

eclipse-ocl-bot commented 1 month ago

| --- | --- | | Bugzilla Link | 492960 | | Status | RESOLVED FIXED | | Importance | P3 normal | | Reported | May 04, 2016 04:44 EDT | | Modified | May 04, 2016 06:36 EDT | | Reporter | Ed Willink |

Description

From https://www.eclipse.org/forums/index.php?t=rview&goto=1731303#msg_1731303

I create Basic.ecore with the following content:

package Basic : Basic = 'http://BasickPackage'\ {\ class NamedElement\ {\ attribute name : String[1];\ }\ }

I also created My.ecore with the following content:

import Basic : 'Basic.ecore#/' ;

package MyPackage : MyPackage = 'http://MyPackage'\ {\ class Foo extends Basic::NamedElement;\ class Bar\ {\ property foo : Foo[?] \ {\ key name;\ }\ }\ }

Note that I want to set the EKeys attribute of the Bar::foo property. However, when I save My.ecore from the oclinecore editor, this property is not persisted. If I use the tree editor, set the EKeys attribute, and save it, it is persisted (and actually looks the same as I typed above).

Interesting is that if NamedElement is contained in My.ecore, then the EKeys attribute is persisted correctly.

Is this a bug or did I do something wrong?

eclipse-ocl-bot commented 1 month ago

By Ed Willink on May 04, 2016 06:36

The problem is far more general than just EKey references. The AS2ES conversion expects a reference to be resolveable in the current target Ecore, whereas it might be in a referenced stable Ecore. Only a few styles of reference are checked for a pre-existing PivotObjectImpl.getESObject().

Introducing a common helper function should fix the problem.

commit c197d1525079b48f65567a08c2d51a7da582d482 pushed to master for RC1