-
Notifications
You must be signed in to change notification settings - Fork 406
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 issues #223
Comments
I was against added Serializable but some people convince me it was just for testing. We should not need to be backwards compatible between versions with a |
@mjpt777 I guess we keep non-serializable lambdas as is, i.e. they render the corresponding collections non-serializable despite those implementing Possible solutions:
|
If things cannot be seralized then we should remove it. Which classes are impacted? |
Impacted classes:
And the generated classes from them. |
We can remove |
Ok, will do in my PR/ |
The rest of this issues should be fixed with #224. |
I'm too late to this discussion but the reason there were |
I've found several issues with how
Serializable
is used in the project:No classes that are
Serializable
declareserialVersionUID
fields (e.g. AsciiNumberFormatException, Int2ObjectHashMap etc.).The classes should declare
serialVersionUID
field but it must be compatible with the old code, i.e. the value of theserialVersionUID
field must match values at least from the latest released versions of Agrona on JDK 8 to avoid breaking existing code. This needs to also work for generated classes.Some serializable classes contain non-serializable fields:
Externally assigned fields - for example IntLruCache takes two parameters one
java.util.function.IntFunction
and anotherjava.util.function.Consumer
neither of which are serializable by default and assigns them to the non-transient fields.The easiest solution would be to mark the corresponding fields
transient
if it would not break the internal logic of the class. Otherwise the solution is require provided functions to be serializable. For example in case of IntLruCache the constructor signature will change to this:Or maybe simple
instanceof Serializable
check when creating object would suffice.Internal fields - for example Int2ObjectCache caches
KeySet
,ValueCollection
andEntrySet
none of which are serializable. In this case we can either mark fields as transient or make the corresponding classes serializable.The text was updated successfully, but these errors were encountered: