protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

fix serialization warnings in generated code when compiling with Java 18 and above

Open xvrl opened this issue 2 years ago • 1 comments

Java 18 added additional linter checks as part of https://bugs.openjdk.java.net/browse/JDK-8274336 and https://bugs.openjdk.java.net/browse/JDK-8274335

These additional checks cause generated protobuf code to raise the following compiler warning: "non-transient instance field of a serializable class declared with a non-serializable type"

This change fixes the code generation to annotate the generated fields with the necessary suppressions to avoid false positives.

All the code generated from src/google/protobuf/*.proto now compiles successfully without serialization warnings in Java 18.

fixes #9673

xvrl avatar Sep 14 '22 00:09 xvrl

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

google-cla[bot] avatar Sep 14 '22 00:09 google-cla[bot]

@fowles any details on what the aarch64 failure might be?

xvrl avatar Sep 30 '22 16:09 xvrl

@fowles any details on what the aarch64 failure might be?

Most likely a flake or bad sync point. Can you rebase onto tip of tree and I will rerun?

fowles avatar Sep 30 '22 17:09 fowles

I kicked off a rerun of the failing test, let's see if maybe that will fix it. I believe the test infrastructure will run tests with the latest main merged in, so there shouldn't be any need to do a rebase.

acozzette avatar Sep 30 '22 17:09 acozzette

@googleberg I didn't see this change included in the latest release. Is there anything else we need to do? I'm not very familiar with the process.

xvrl avatar Oct 24 '22 19:10 xvrl

@googleberg @acozzette @fowles I was hoping this would make it into one of the recent releases but I may not have followed the right process. Should I be submitting a new PR to cherry-pick this change into the 21.x branch to make sure it makes it into the next release?

xvrl avatar Jan 17 '23 18:01 xvrl

@xvrl this would naturally end up in the next minor-version release (3.22). We don't typically merge non-critical changes into patch releases. We are hoping to establish a more regular cadence of minor releases this year.

googleberg avatar Jan 17 '23 19:01 googleberg

👍 thanks for clarifying

xvrl avatar Jan 17 '23 22:01 xvrl