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

Use @Serial on serialVersionUID fields. #7672

Merged
merged 1 commit into from
Feb 12, 2025
Merged

Conversation

copybara-service[bot]
Copy link
Contributor

Use @Serial on serialVersionUID fields.

@Serial was added in Java 14, but it has only SOURCE retention, so it requires Java 14+ only at build time. Guava continues to support Java 8 at runtime, and it already has required a higher version (though perhaps only Java 9+?) to build.

Still, if this change causes people trouble, it is easy enough for us to include @Serial only in our Google-internal source or even to back out the change entirely. (Part of the purpose of this change is to identify any such trouble before we add any features that require newer versions of Java to build "for real.")

Alternatively, if this change goes well, we can consider using @Serial on all eligible APIs.

RELNOTES=n/a

[`@Serial`](https://docs.oracle.com/en/java/javase/23/docs/api/java.base/java/io/Serial.html) was added in Java 14, but it has only `SOURCE` retention, so it requires Java 14+ only [at _build_ time](#6549). Guava continues to support Java 8 at runtime, and it already has required a higher version (though perhaps only Java 9+?) to build.

Still, if this change causes people trouble, it is easy enough for us to include `@Serial` only in our Google-internal source or even to back out the change entirely. (Part of the purpose of this change is to identify any such trouble before we add any features that require newer versions of Java to build "for real.")

Alternatively, if this change goes well, we can consider using `@Serial` on _all_ eligible APIs.

RELNOTES=n/a
PiperOrigin-RevId: 726154745
@copybara-service copybara-service bot merged commit 39b39d4 into master Feb 12, 2025
2 checks passed
@copybara-service copybara-service bot deleted the test_676818238 branch February 12, 2025 20:36
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.

1 participant