Commit Graph

7369 Commits

Author SHA1 Message Date
Daniel Kurka
bb3460d71b Project import generated by Copybara
PiperOrigin-RevId: 310614231
2020-05-08 13:06:41 -07:00
Leo
12236c6977 Fix typo on py_proto_library 2020-05-08 09:34:26 -07:00
Aleksandr Parfenov
5efd1215f5 Update comment for GetRepeatedFieldRef
Use just reflection.h in documentation instead of full path
2020-05-08 09:27:47 -07:00
Aleksandr Parfenov
b60d9f2d6b Fix include path to reflection.h in documentation
There is a note in the documentation to `Reflection::GetRepeatedFieldRef()`
about file `net/proto2/public/reflection.h` which contains a definition of
`RepeatedFieldRef`. Since there are few places in code with rewrite of
`net...` path to `google/protobuf/...` it looks like the first one is a
legacy path and should be renamed to `google/protobuf` in documentation
as well.
2020-05-08 09:27:47 -07:00
Jon Skeet
6b0ff74ecf Implement HasPresence for C#
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)
2020-05-08 06:17:50 +01:00
Joshua Haberman
cac7136436
Merge pull request #7477 from haberman/sync-stage
Integrate from Piper for C++, Java, and Python
2020-05-07 22:00:22 -07:00
Daniel Kurka
ed596ef68d Project import generated by Copybara
PiperOrigin-RevId: 310497816
2020-05-07 21:53:47 -07:00
Joshua Haberman
c00c60eb1c Added new failures to PHP C lists also (and sorted). 2020-05-07 18:30:47 -07:00
Joshua Haberman
dfff1ac2cf Added new failing conformance test to Ruby, PHP, and C#. 2020-05-07 17:10:11 -07:00
Joshua Haberman
81c5959e67 Merge branch 'sync-piper' into sync-stage 2020-05-07 16:21:50 -07:00
Joshua Haberman
2d80a70048 Sync from Piper @310457838
PROTOBUF_SYNC_PIPER
2020-05-07 16:21:50 -07:00
Joshua Haberman
c781df3d21
Updated generated code for C#. (#7476) 2020-05-07 16:19:28 -07:00
Joshua Haberman
2ac29ae5d4 Sync from Piper @310014675
PROTOBUF_SYNC_PIPER
2020-05-05 13:56:07 -07:00
Joshua Haberman
204f99488c
Use the name from the descriptor instead of RTTI. (#7465) 2020-05-05 10:56:48 -07:00
Joshua Haberman
7eb207c574
Merge pull request #7464 from haberman/sync-stage
Integrate from Piper for C++, Java, and Python
2020-05-05 10:56:21 -07:00
Jan Tattermusch
a690227398
Merge pull request #7351 from jtattermusch/protobuf_csharp_new_parsing
New Span-based C# parsing logic
2020-05-05 16:57:52 +02:00
Joshua Haberman
c05b55880f Sync from Piper @309848308
PROTOBUF_SYNC_PIPER
2020-05-04 17:10:15 -07:00
Joshua Haberman
1119531bb2 Merge branch 'sync-piper' into sync-stage 2020-05-04 17:10:15 -07:00
Paul Yang
317bc83444
Ignore unknown enum value when ignore_unknown specified (#7455) 2020-05-04 14:34:05 -07:00
Jon Skeet
ed5c874de3 Fix to C# support library code
(This was the only use of a HasXyz property for a message type.)
2020-05-01 09:06:44 +01:00
Jon Skeet
9926c9504b Regenerate C# code based on the previous commit
(This removes the Has/Clear members for message types in proto2.)
2020-05-01 09:06:44 +01:00
Jon Skeet
9d74aafbe1 Don't generate Has/Clear members for proto2 message fields.
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 #7395.
2020-05-01 09:06:44 +01:00
Michael WERLE
02f182e829 Clean up nortti fix based on comments from @acozzette
Also moved the macro into the only function which is using it to keep the fix local to the issue.
2020-04-29 10:42:37 -07:00
Michael WERLE
1d461e7825 Fix when compiling without RTTI 2020-04-29 10:42:37 -07:00
Thomas Van Lenten
2db0e9812a Use the new helpers from Descriptor. 2020-04-28 16:22:53 -04:00
Joshua Haberman
4b4e667435
Merge pull request #7435 from haberman/sync-stage
Integrate from Piper for C++, Java, and Python
2020-04-28 09:52:24 -07:00
Nick Presta
75553e9ec8 Update shell format in installation instructions. 2020-04-28 08:51:04 -07:00
Joshua Haberman
32e5deb1ac Sync from Piper @308829107
PROTOBUF_SYNC_PIPER
2020-04-28 08:40:38 -07:00
Joshua Haberman
140e1bb70e Merge branch 'sync-piper' into sync-stage 2020-04-28 08:40:38 -07:00
Greg Steuck
4059c61f27
Typo in 'disciplines' (#7423) 2020-04-27 08:21:52 -07:00
Jan Tattermusch
7134d25eb8 Merge remote-tracking branch 'upstream/master' into protobuf_csharp_new_parsing 2020-04-27 13:18:07 +02:00
Thomas Van Lenten
dddeed298b [ObjC] Typos and comment improvements. 2020-04-24 16:36:15 -04:00
Thomas Van Lenten
7b6016e343 [ObjC] Add tests for proto3 optional behaviors. 2020-04-24 16:36:15 -04:00
Thomas Van Lenten
b0e2792842 [ObjC] Generation changes around proto3 optional.
- Bump the version marker in the generated code.
- Set the flag to say clear on zero is known.
- Set clear on zero for proto3 optional fields that aren't tagged as optional.
- Also tweak the call from some C generated code to use different apis with
  better validation.
- Mark the ObjC generator as supporting the proto3 optional feature.
- Regenerate the WKTs to get the new flags.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
3c8e959b60 [ObjC] Update oneof clearing internals.
- Add/document an public api for clearing oneofs.
- Move the current library internals to a new api and keep a shim for old
  generated code.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
e1e5b8af79 [ObjC] Update some library internals to not pass syntax versions.
- With the new flags, the syntax isn't needed, so don't pass it.
- To keep library binary compatibility, rename the helpers since one
  "Internal" method was called from generated code. Keep a shim with
  the old signature to support those generated sources.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
8d224b4c48 [ObjC] Runtime support for proto3 optional.
- Add a Descriptor flag to capture if the field should clear on being zeroed.
- Update the runtime to use the new clear on zero flag.
- Add a flag on message initialization to indicate the sources were generated
  with/without this support so the runtime can backfill the flag for older
  generated sources.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
e9b0c92659 [ObjC] Update oneof generation for proto3 optional.
- Don't make an OneofGenerator for synthetic oneofs.
- Update the field calculations that determine if hasbits are needed to
  know about synthetic oneofs and ignore them.
2020-04-24 16:36:15 -04:00
Thomas Van Lenten
59f8dd5faf [ObjC] Move over some custom logic to Descriptor provided info.
FieldDescriptor::has_presence works as a replacement for the custom logic we
had for FieldGenerator::WantsHasProperty(), and is already proto3 optional
aware.
2020-04-24 16:36:15 -04:00
Masaki Hara
f494cb222d
Test in Ruby 2.7 (#7386)
* Test in Ruby 2.7

* Turn off GC.stress for 'require' in Ruby 2.7

* Backport 2c8364b to compatibility_tests/v3.0.0
2020-04-24 09:50:27 -07:00
Jon Skeet
81c9b85dee Add new files into Makefile.am 2020-04-24 17:39:14 +01:00
Jon Skeet
97737072f9 Add reflection support for proto3 optional fields
This is more involved than might be expected because the synthetic oneofs don't generate the properties we would usually expect to see.
2020-04-24 17:39:14 +01:00
Jon Skeet
bad9d753ae Add unit tests for proto3 optional fields
(This isn't as exhaustive as it might be, but the behavior is basically the same as proto2 optional fields.)
2020-04-24 17:39:14 +01:00
Jon Skeet
b0649a088a Regenerate C# code with the new generator, adding unittest_proto3_optional.proto
The changes in the existing proto2 code are solely around presence bits. The new generator allocated presence bits more efficiently. (Previously bits were sometimes allocated but never used.)
2020-04-24 17:39:14 +01:00
Jon Skeet
4dcafd12cb Support proto3 optional fields in the C# generator
Most changes are:

- Introducing new helpers of SupportsPresenceApi and RequiresPresenceBit. This allows calling code to be a lot clearer about what it's interested in.
- Changing most previous IsProto2 calls to use one of the two new helper methods
- Avoiding treating synthetic oneofs as regular ones
- Some slight refactoring in csharp_primitive_field to avoid code duplication
- Comments explaining what we want when, so the next maintainer doesn't need to do the detective work I did!

This change deliberately doesn't modify the API surface of any
existing code. The only change to previously-generated C# should be
making presence bits more efficient in proto2.

Once proto3 optional fields are supported, we can consider further
changes to make the proto2 and proto3 generated API surface more
consistent (e.g. adding presence API for message fields and oneofs).
2020-04-24 17:39:14 +01:00
Jon Skeet
4c9613f226 Register that the C# compiler supports proto3 presence.
(It doesn't yet, but will in the next commits...)
2020-04-24 17:39:14 +01:00
Joshua Haberman
7eddac7877
Added some info about Reflection, and a note about timeline. (#7416)
* Added some info about Reflection, and a note about timeline.

* Fixed heading levels.

* A bit more info.
2020-04-23 14:33:53 -07:00
Joshua Haberman
fda8544a59
Howto doc for implementing proto3 presence in a code generator. (#7407) 2020-04-23 13:00:30 -07:00
David L. Jones
e48c92952d
Add application note for explicit presence tracking. (#7390)
This includes instructions for enabling explicit presence tracking in proto3, and also explains implicit presence. The language examples were written by inspection, and not individually tested.
2020-04-23 12:59:51 -07:00
Joshua Haberman
6b759688a1
Implemented proto3 presence for Ruby. (#7406)
* WIP.

* WIP.

* Builds and runs. Tests need to be updated to test presence.

* Ruby: proto3 presence is passing all tests.

* Fixed a bug where empty messages has the wrong oneof count.
2020-04-23 12:54:25 -07:00