|
|
|
Re: Binary compatibility of EMF models [message #1850752 is a reply to message #1850746] |
Wed, 16 March 2022 06:11 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Ed,
This topic is not about extending Ecore, it is about extending some other model, which is of course common practice. There was no attempt to convince you of anything but rather an outline of how the feature constants are actually generated in the package interface and how these are actually used in the generated reflective methods. It's implemented like this so that EObjejct.eGet performs faster than HashMap.get but has the drawback that derived models need to be recompiled, exactly as Marcus has observed.
With the suggested property set, the generated implementation class has a generated constant like this:
private static final int EOFFSET_CORRECTION = XyzPackage.Literals.ABC.getFeatureID(XyzPackage.Literals.ABC__FEATURE) - XyzPackage.ABC__FEATURE; which dynamically evaluates the offset between the actual computed feature ID and the static constant feature ID. That value is then used in the generated methods to "correct" the static value, e.g., like this:
public Object eGet(int featureID, boolean resolve, boolean coreType)
{
switch (featureID - EOFFSET_CORRECTION)
{ Please try to keep your followup observations focused on the topic rather than on tangential topics or potential diseases.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03583 seconds