Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344395 - Delegates expect feature to be EClass-typed
Summary: Delegates expect feature to be EClass-typed
Status: RESOLVED INVALID
Alias: None
Product: EMF
Classification: Modeling
Component: Core (show other bugs)
Version: 2.7.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ed Merks CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-01 08:09 EDT by Axel Uhl CLA
Modified: 2011-05-01 12:51 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Axel Uhl CLA 2011-05-01 08:09:49 EDT
When features are not EClass but only EClassifier-typed, a ClassCastException results. See https://bugs.eclipse.org/bugs/attachment.cgi?id=194447 for a patch that fixes the problem.
Comment 1 Ed Merks CLA 2011-05-01 11:58:25 EDT
There must be some confusion here.  You're asking us to break API.  This must be the EClass of the EObject, so I don't get that there's a problem.
Comment 2 Ed Willink CLA 2011-05-01 12:09:47 EDT
(In reply to comment #1)
> There must be some confusion here.  You're asking us to break API.  This must
> be the EClass of the EObject, so I don't get that there's a problem.

That's what I thought too when I first scanned the code, but it isn't the EStructuralFeature.eContainerClass class, it's the EStructuralFeature.eType classifier, so the EClass cast assumes an EReference when setting delegates apply equally well to EAttributes.

You can see that the patch just removes a couple of casts eliminating some spurious type assumptions; the compiler is happy that the fewer cast code is better.
Comment 3 Ed Merks CLA 2011-05-01 12:15:28 EDT
Again, you're asking us to break API. We don't generally ever do that and most certainly not without strong justification.

There is a guard that's intended to capture all cases of the feature's type being an EDataType

        else if (eType instanceof EDataType)

Before I hear a long story about some EClassifier that's neither an EClass nor an EDataType keep in mind that we've been very clear that the Ecore model is not to be extended, so an EClassifier that is neither an EClass nor an EDataType is not supported and won't be supported.
Comment 4 Ed Willink CLA 2011-05-01 12:51:56 EDT
OK. Thanks for the clarification. Bug 344405 raised to legalize the OCL ecore meta-model. The change appears to introduce only pedantic API change noise that is easily suppressed by comment filters.