Community
Participate
Working Groups
Build Identifier: M20110210-1200 I'm working with uml models that include UML profile application and Stereotype application. XMI represent the stereotype application with DynamicEObject. In my examples the sterotypes includes associations from stereotypes to stereotypes. When ecore.xmi is reading the file and is resolving the references makes call to EClassImpl::getFeatureID(EStructuralFeature feature). But the java reference that include as parameter is not the same as the references to EStructuralFeature (eAllStructuralFeaturesData) that includes EClassImpl. And EClassImple does not finds the corret feature ID and returns -1.ecore.xmi handles in a wrong way the feature (in my example it handles the feature as a container and it isn't a container). I've modified EClassImpl to solve the problem (but I lnow that this is not the correct solution. I've included following modifications in line 1453 of EClassImpl: if (eAllStructuralFeaturesData[index] == feature || (eAllStructuralFeaturesData[index].getFeatureID() == feature.getFeatureID() && eAllStructuralFeaturesData[index].getName().equals(feature.getName()) && eAllStructuralFeaturesData[index].eClass().getClassifierID() == feature.eClass().getClassifierID())) This would not be correct for two features of two different EClass in two different EPackages with the same classifier id, and the same feature id. I suppose that the source of the problem is that ecore.xmi does not locates the feature, and it creates a new instance. featureID in EClassImpl compare references and it does not compares values. Reproducible: Always Steps to Reproduce: 1. The models that I use includes profiles and to reproduce this profiles plugin are needed. 2. In the profiles the stereotypes include associations. 3. The stereotype applications must include references. 4. When ecore.xmi reads the file, it resolves the references in a worng way.
Sorry, but I have no idea what problem you're having but the change to EClassImpl isn't appropriate; the getFeatureID method is supposed to return a valid ID only for actual features of the class, not for ones from any other class... It sounds to me like your serialization is invalid in some way, but given you've shared no specific details (test cases) I can't comment on that. Perhaps you have more than one instance of the "same" Ecore model and are expecting them to behave like a single instance. That's not supported. You need to ensure that a single instance is consistently used.