Repository navigation
Cherry-pick fixes onto 3.12.x branch for 3.12.0-rc2 - #7491
Merged
Merged
Conversation
This is a breaking change in terms of proto2 code generation: users who were previously using these members will have to change to null checks for message fields. After toying with removing Has/Clear for proto2 oneof fields, I've left them alone in this commit, for consistency with other languages. The inconsistency between proto2 and proto3 won't come up here, because proto3 oneof fields can never be explicitly optional. Fixes protocolbuffers#7395.
(This removes the Has/Clear members for message types in proto2.)
(This was the only use of a HasXyz property for a message type.)
…se_options C#: Get rid of broken GetOption API and expose the "GetOptions()" method on descriptors instead
FieldDescriptor.HasPresence returns true if both ClearValue and HasValue (on the accessor) can be expected to work. Some fields have a working ClearValue, but no HasValue; HasPresence returns false for those fields. Generally: - Extension fields have presence if and only if they're singular - Repeated fields do not support presence - Map fields do not support presence - Message fields support presence - Oneof fields support presence (this includes synthetic oneof fields, so that covers proto3 optional singular fields) - Proto2 singular primitive fields support presence - Proto3 singular primitive fields do not support presence (unless they're in a oneof, covered above)
acozzette
approved these changes
May 12, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cherry-picks:
C++ (and Python/C++):
Java
C#