Closed claesrosell closed 5 months ago
Would it be possible for you to share an actual example of a MyDataType class so that I understand how serialization and serialization works? A zip of sample project would be ideal...
I will provide a complete example project with the types that we use. I will not be done today though.
Our EDataTypes that use generics are based on a javax.measure
(units of measurement) implementation called Indriya and we are using the built-in serializer of that project for these EDataTypes.
BTW, I am in no hurry with this, so I think it makes sense to revert #23 since it currently doesn't provide much value. Sorry.
I did the revert. If there is no need to rush, then let's not rush! We have weeks of time. I don't think there are a lot of changes required to get this working, but I want to be sure it all makes good sense and is exactly right... 😄
I have finally produced an example project with:
There are a .target file and .lanuch files in there as well.
You will see that the serialization / de-serialization is almost typeless. There is information stored that indirectly references the generic type. Upon the de-serialization, a type-compatible instance can be created from that information. With a default value literal for this EDataType there is obviously "Shoot oneself in the foot" or "find out during runtime" -potential.
I will update this PR with the reverted changes from #24 and also look into the failing test later this week.
That's great! I will have a look as soon as possible. I did investigate a little further a little last week already and I don't think all that much needs to change...
If the EDateType has type parameters the default value assignment to the EDEFAULT will always be cast to an unbound wildcard type like:
... which obviously is illegal.
The problem is with GenFeature.getStaticDefaultValue(). It calls GenDataType.getStaticValue() which doesn't have access to the EAttribute's target type. I think I have come up with an acceptable solution to this but since my understanding of the inner workings of codegen is extremely limited it may also be completely wrong.
PR is coming soon.