Skip to content
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

Compute serialVersionUID for Serializable classes that don't have one and use VirtualField #4370

Closed
mateuszrzeszutek opened this issue Oct 13, 2021 · 0 comments · Fixed by #4722
Labels
enhancement New feature or request

Comments

@mateuszrzeszutek
Copy link
Member

Is your feature request related to a problem? Please describe.
When a VirtualField is added to a Serializable class that doesn't have a pre-computed serialVersionUID the added fields & interfaces will alter the default serialVersionUID computation.

Describe the solution you'd like
When a virtual field is being installed we could compute the UID ourselves - ASM even has a helper class for that: SerialVersionUIDAdder.
This behavior should be configurable (enabled by default); it is possible (though very unlikely) that this behavior might break the instrumented application - apparently it is possible to configure Java crypto so that it's not able to compute SHA hashes due to that.

Additional context
DataDog also does that in their agent: https://github.com/DataDog/dd-trace-java/blob/master/dd-java-agent/agent-tooling/src/main/java/datadog/trace/agent/tooling/context/FieldBackedContextInjector.java#L487

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant