-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Serialization not working with generic type parameter in events #43
Comments
Thanks for your report! This is indeed a situation we haven't sufficiently considered. The general approach here is probably to have one Good catch! |
This reproduces scalapenos#43
This makes sure the situation described in scalapenos#43 is at least detected at initialization, instead of blowing up when an event is actually persisted. In the future we might want to actually support having multiple persisters for types with the same root class, but that will require some more changes.
Hi @toggm I've been looking into this in the hope of finding a usable solution but my Scala type system skills are no match for this problem I'm afraid. The problem is that the Akka I tried using In other words, I'm stumped as to how to make this possible 😢 |
I think there is no way getting around type erasure if you only get anyref from the Akka |
I had some further thoughts about this problem.
|
Or even shorter...
|
Thanks! We're looking into this but please feel free to turn this into a pull request if you have the time for that. The |
created pull request #46 |
When you declare a generic event as an envelop containing some payload declared by a generic type parameter, the canPersist method of the Persister returns true for all Events even if the payload differs.
i.e.
At compile time everything seams to be ok but at runtime the vm will raise a ClassCastException when you try to persist an event with payload2. This due to the fact that the Persister itself makes a type check of the Root element only:
The text was updated successfully, but these errors were encountered: