eclipse-emf / org.eclipse.emf

Eclipse Public License 2.0
10 stars 13 forks source link

Default values for generic EAttributes isn't casted to target type #25 #26

Closed claesrosell closed 6 months ago

claesrosell commented 6 months ago

GenFeature.getStaticDefaultValue() now checks if the type is generic and if so, adds a cast to the raw type of the feature instead of the EDataType's type.

merks commented 6 months ago

I really want to see a sample project (zip) that compiles and illustrates the problem being fixed.

merks commented 6 months ago

If I enable data converters for the package of the model from the other issue, this method is generated in the XyzFactory:

    MyDataType<?> createEMyDataType(String literal);

If we're going to do casting, I'd prefer not to use a raw type but rather an unchecked cast. probably something like this:

    @SuppressWarnings("unchecked")
    protected static final MyDataType<Float> MY_ATTRIBUTE_EDEFAULT = (MyDataType<Float>)MyModelFactory.eINSTANCE.createFromString(MyModelPackage.eINSTANCE.getEMyDataType(), "1");

But I'm running out of time to look at this today and I have very limited time tomorrow before I'm out until Thursday, and M2 for consumption by the Platform is due tomorrow...

merks commented 6 months ago

This is superseded by:

https://github.com/eclipse-emf/org.eclipse.emf/pull/29