| Summary: | Specialised EClasses need specialised EStructuralFeatures | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Ed Willink <ed> | ||||
| Component: | Core | Assignee: | Marcelo Paternostro <marcelop> | ||||
| Status: | RESOLVED DUPLICATE | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | Ed.Merks | ||||
| Version: | 2.4.0 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Creating specialized feature instances is just going to create a confusing mess, in my opinion. My thinking was that eventually I'd provide support for asking a class what the type of the feature is in the context of that class. *** This bug has been marked as a duplicate of bug 192687 *** |
Created attachment 99890 [details] JUnit test demonstrating bug When converting EMOF-based OCL to Ecore-based OCL I use the OCL EStructuralFeatures to guide construction. In the case of TypeType.referredType which has no EMOF counterpart, an xmi:Extension is used, so the Ecore feature is needed to construct the appropriate counterpart for the read AnyType. Unfortunately: org.eclipse.ocl.ecore.EcorePackage.Literals.TYPE_TYPE provides a feature inherited from org.eclipse.ocl.types.TypesPackage.Literals.TYPE_TYPE for which the eType is an EObject corresponding to the generic C parameter, rather than an EClassifier corresponding to the specialised binding. Use of the EObject to construct a (proxy) object to assign to the referredType therefore results in a ClassCastException. It would seem that specialised classes should define new specialised instances for their features, so that the class descriptions of fully bound classes behave as non-generic classes. org.eclipse.ocl.ecore.EcorePackage.eINSTANCE.getTypeType_ReferredType(), org.eclipse.ocl.ecore.EcorePackage.Literals.TYPE_TYPE__REFERRED_TYPE should therefore exist and be the specialisation of org.eclipse.ocl.types.TypesPackage.eINSTANCE.getTypeType_ReferredType(), org.eclipse.ocl.types.TypesPackage.Literals.TYPE_TYPE__REFERRED_TYPE