Commit Graph

7312 Commits

Author SHA1 Message Date
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
140e1bb70e Merge branch 'sync-piper' into sync-stage 2020-04-28 08:40:38 -07:00
Joshua Haberman
32e5deb1ac Sync from Piper @308829107
PROTOBUF_SYNC_PIPER
2020-04-28 08:40:38 -07:00
Greg Steuck
4059c61f27
Typo in 'disciplines' (#7423) 2020-04-27 08:21:52 -07: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
David L. Jones
94afb8ab36
Add Ruby tests for oneof cases. (#7385)
In Ruby, the oneof case returns a symbol with the name of the field that is set. These were not previously tested.
2020-04-23 12:49:04 -07:00
David L. Jones
c953182fa9
Generate documentation for internal.container. (#7294)
Since our (public) generated APIs document their use of repeated fields, we should probably document its API, too.

This includes some changes to generate_docs.py to explicitly allow named modules, since the repeated field implementation lives in the "internal" tree.
2020-04-22 21:41:12 -07:00
Joshua Haberman
18950451c7
Ruby: assigning 'nil' to submessage should clear the field. (#7397)
Previously if you assigned 'nil' to a submessage in proto2
the field would be set to 'nil' but would still have its hasbit
set. This was a clear bug so I'm fixing it outright, even though
it is an observable behavior change.
2020-04-20 15:51:05 -07:00
Joshua Haberman
81573b9256
Merge pull request #7402 from haberman/sync-stage
Integrate from Piper for C++, Java, and Python
2020-04-20 12:28:08 -07:00
Thomas Van Lenten
a8a400da5d Move to constexpr. 2020-04-20 11:31:04 -04:00
Joshua Haberman
bb30225f06 Sync from Piper @307316823
PROTOBUF_SYNC_PIPER
2020-04-19 18:01:44 -07:00
Joshua Haberman
e164e15027 Merge branch 'sync-piper' into sync-stage 2020-04-19 18:01:44 -07:00
Paul Yang
f15ac4091f
Drop 3.3, 3.4 and use single version docker images for all python tests (#7396)
* Create a new docker image for python 3.6

The previous one cannot build, because python3.6 was removed from
stretch.

* Drop support for 3.3 and 3.4

Also update all docker file to be single version
2020-04-18 14:39:52 -07:00
Eric Walker
2c8364bcd1
Rails2.7 segfaults (#7091)
* Add a test suite for ruby 2.7

* Call BigDecimal() instead of BigDecimal.new()

BigDecimal.new was deprecated in ruby 2.6

* Switch FrozenError expectation to a matcher

The error message for FrozenError changed to include more information
about the mutated object. Switch from an exact match to an aproximate
match (equal => match). This does not change the prefix.

* We can safely ignore newest array methods from ruby 2.7
2020-04-17 10:20:38 -07:00
Masaki Hara
64f6c59ccb
Build extensions for Ruby 2.7 (#7027)
* Build extensions for Ruby 2.7

* Try installing bundler 2.x

* Try bumping rake-compiler-dock

* Use standard RCD images

* Avoid 'rake cross native' with rake-compiler-dock

* Use Ruby 2.5 for building Ruby <= 2.6

* Use rake-compiler 1.1.0

* Specify target

* Don't update Ruby test image for now
2020-04-16 23:31:47 -07:00
Daniel G. Taylor
97f5f649a4 docs: add python-betterproto
Adds the `betterproto` Python module to the list of implementations.
2020-04-16 09:22:52 -07:00
Thomas Van Lenten
7b8a241b57 [ObjC] Improve validation on public apis. 2020-04-15 13:22:05 -04:00
Thomas Van Lenten
95282469eb [ObjC] Remove helper to avoid extra lookups.
Skip the helper that fetches the desc again since these methods already
collected it.
2020-04-15 13:22:05 -04:00
Elliotte Rusty Harold
62832897c3 deps: update Guava to 29.0
@rafi-kamal
2020-04-14 15:19:40 -07:00
Joshua Haberman
88529f5017
Merge pull request #7378 from haberman/sync-stage
Integrate from Piper for C++, Java, and Python
2020-04-14 14:04:23 -07:00
Joshua Haberman
74ad62759e Sync from Piper @306496510
PROTOBUF_SYNC_PIPER
2020-04-14 12:55:41 -07:00
Joshua Haberman
83ccdfc78d Merge branch 'sync-piper' into sync-stage 2020-04-14 12:55:41 -07:00
Thomas Van Lenten
6f3bda22f4 [ObjC] Fix some tests checking the wrong Message class. 2020-04-14 12:15:23 -04:00
Thomas Van Lenten
24dda9e233 Update the build/test script for newer Xcode 11 versions
Apple stopped really supporting the 32bit simulators, so don't try
running those any more.
2020-04-14 12:15:23 -04:00
Jan Tattermusch
50e03cdde3
Merge pull request #7360 from jtattermusch/refactor_googlebenchmark
Refactor some Protobuf C# microbenchmarks
2020-04-13 17:34:22 +02:00
Joshua Haberman
0d43ba41ee
Update to new upb version (#7372) 2020-04-11 09:46:20 -07:00