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

Ensure serialization compatibility where possible #994

Merged
merged 1 commit into from
Sep 24, 2014

Conversation

marcphilipp
Copy link
Member

Not possible for org.junit.runner.Result. Potential fix for #976 (needs manual test to confirm).

Not possible for org.junit.runner.Result
@kcooney
Copy link
Member

kcooney commented Sep 22, 2014

LGTM

Curious, how did you find which classes needed to be modified?

@marcphilipp
Copy link
Member Author

I went through all classes that implement Serializable (those that declare a serialVersionUID and the two that don't) and diffed them with the r4.11 tag.

@dsaff
Copy link
Member

dsaff commented Sep 24, 2014

Thank you, Marc!

dsaff pushed a commit that referenced this pull request Sep 24, 2014
Ensure serialization compatibility where possible
@dsaff dsaff merged commit c2f2a8c into junit-team:master Sep 24, 2014
@kcooney
Copy link
Member

kcooney commented Sep 26, 2014

I have some ideas on how we can preserve serialization for org.junit.runner.Result. @marcphilipp do you think it's worth exploring those?

@marcphilipp
Copy link
Member Author

I don't think it's that crucial for result but I'm curious to hear about your ideas.

@kcooney
Copy link
Member

kcooney commented Sep 26, 2014

A custom writeObject method could write things in the previous format. So I was thinking of having a nested static class of Result named SerializedForm that would have fields that have the same name and ordering as the Result class had in 4.11. To serialize, we copy the data from Result to SerializedForm and manually serialize it.

The tricky part is writing a test, but the binary format is documented, so the test could populate SerializedForm and serialize it, then read the binary serialized form and change the class name to org.junit.runner.Result and write a new serialized form. Then we deserialize the data and compare the Result to the expected values.

@marcphilipp marcphilipp deleted the serialization-compatibility branch September 27, 2014 18:00
@marcphilipp
Copy link
Member Author

Do you think it's worth the effort?

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

Successfully merging this pull request may close these issues.

3 participants