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
Bug on @Getter(lazy=true) and transient fields #1236
Comments
|
Oh yeah. I forgot that the field is final. So to prevent the serialization bug you could either make it not final or you have to create a totally different way to serialize/deserialize this. Another way would be to add an error if a lazy getter field is transient. |
I'm afraid the field must be Serialization is a dirty beast and AFAIK uses some kind of reflection for setting A compile-time error is IMHO a good step before a better solution gets implemented. |
Using reflection in a |
lazy not supported on transient variables, see projectlombok/lombok#1236 metasfresh/metasfresh-webui-api-legacy#269
Oy. I just tried upgrading my Lombok dependency to 1.16.16 and hit this error. Any tips on a way around this other than downgrading? |
|
You could modify your Gson to exclude certain fields from serialization. |
Hey,
there is a problem that occurs if you have a transient field that is laziely initialized. The generated getter method crashes after deserialization because the field is null. The expected behaviour would be to call the lazy creationmethod again.
So instead of generating something like:
It should be something like this, at least for transient values:
The text was updated successfully, but these errors were encountered: