Skip to content

Commit

Permalink
Sync from Piper @311396324
Browse files Browse the repository at this point in the history
PROTOBUF_SYNC_PIPER
  • Loading branch information
haberman committed May 13, 2020
1 parent 6b5fb80 commit 6ed7383
Show file tree
Hide file tree
Showing 71 changed files with 1,016 additions and 815 deletions.
111 changes: 111 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,114 @@
2020-05-12 version 3.12.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

Protocol Compiler
* [experimental] Singular, non-message typed fields in proto3 now support
presence tracking. This is enabled by adding the "optional" field label and
passing the --experimental_allow_proto3_optional flag to protoc.
* For usage info, see docs/field_presence.md.
* During this experimental phase, code generators should update to support
proto3 presence, see docs/implementing_proto3_presence.md for instructions.
* Allow duplicate symbol names when multiple descriptor sets are passed on
the command-line, to match the behavior when multiple .proto files are passed.
* Deterministic `protoc --descriptor_set_out` (#7175)

C++
* [experimental] Added proto3 presence support.
* New descriptor APIs to support proto3 presence.
* Enable Arenas by default on all .proto files.
* Documented that users are not allowed to subclass Message or MessageLite.
* Mark generated classes as final; inheriting from protos is strongly discouraged.
* Add stack overflow protection for text format with unknown fields.
* Add accessors for map key and value FieldDescriptors.
* Add FieldMaskUtil::FromFieldNumbers().
* MessageDifferencer: use ParsePartial() on Any fields so the diff does not
fail when there are missing required fields.
* ReflectionOps::Merge(): lookup messages in the right factory, if it can.
* Added Descriptor::WellKnownTypes enum and Descriptor::well_known_type()
accessor as an easier way of determining if a message is a Well-Known Type.
* Optimized RepeatedField::Add() when it is used in a loop.
* Made proto move/swap more efficient.
* De-virtualize the GetArena() method in MessageLite.
* Improves performance of json_stream_parser.cc by factor 1000 (#7230)
* bug: #7076 undefine Windows OUT and OPTIONAL macros (#7087)
* Fixed a bug in FieldDescriptor::DebugString() that would erroneously print
an "optional" label for a field in a oneof.
* Fix bug in parsing bool extensions that assumed they are always 1 byte.
* Fix off-by-one error in FieldOptions::ByteSize() when extensions are present.
* Clarified the comments to show an example of the difference between
Descriptor::extension and DescriptorPool::FindAllExtensions.
* Add a compiler option 'code_size' to force optimize_for=code_size on all
protos where this is possible.

Java
* [experimental] Added proto3 presence support.
* Mark java enum _VALUE constants as @Deprecated if the enum field is deprecated
* reduce <clinit> size for enums with allow_alias set to true.
* Sort map fields alphabetically by the field's key when printing textproto.
* TextFormat.merge() handles Any as top level type.
* Throw a descriptive IllegalArgumentException when calling
getValueDescriptor() on enum special value UNRECOGNIZED instead of
ArrayIndexOutOfBoundsException.
* Fixed an issue with JsonFormat.printer() where setting printingEnumsAsInts()
would override the configuration passed into includingDefaultValueFields().
* Implement overrides of indexOf() and contains() on primitive lists returned
for repeated fields to avoid autoboxing the list contents.
* Add overload to FieldMaskUtil.fromStringList that accepts a descriptor.
* [bazel] Move Java runtime/toolchains into //java (#7190)

Python
* [experimental] Added proto3 presence support.
* [experimental] fast import protobuf module, only works with cpp generated code linked in.
* Truncate 'float' fields to 4 bytes of precision in setters for pure-Python
implementation (C++ extension was already doing this).
* Fixed a memory leak in C++ bindings.
* Added a deprecation warning when code tries to create Descriptor objects
directly.
* Fix unintended comparison between bytes and string in descriptor.py.
* Avoid printing excess digits for float fields in TextFormat.
* Remove Python 2.5 syntax compatibility from the proto compiler generated _pb2.py module code.
* Drop 3.3, 3.4 and use single version docker images for all python tests (#7396)

JavaScript
* Fix js message pivot selection (#6813)

PHP
* Persistent Descriptor Pool (#6899)
* Implement lazy loading of php class for proto messages (#6911)
* Correct @return in Any.unpack docblock (#7089)
* Ignore unknown enum value when ignore_unknown specified (#7455)

Ruby
* [experimental] Implemented proto3 presence for Ruby. (#7406)
* Stop building binary gems for ruby <2.5 (#7453)
* Fix for wrappers with a zero value (#7195)
* Fix for JSON serialization of 0/empty-valued wrapper types (#7198)
* Call "Class#new" over rb_class_new_instance in decoding (#7352)
* Build extensions for Ruby 2.7 (#7027)
* assigning 'nil' to submessage should clear the field. (#7397)

C#
* [experimental] Add support for proto3 presence fields in C# (#7382)
* Mark GetOption API as obsolete and expose the "GetOptions()" method on descriptors instead (#7491)
* Remove Has/Clear members for C# message fields in proto2 (#7429)
* Enforce recursion depth checking for unknown fields (#7132)
* Fix conformance test failures for Google.Protobuf (#6910)
* Cleanup various bits of Google.Protobuf (#6674)
* Fix latest ArgumentException for C# extensions (#6938)
* Remove unnecessary branch from ReadTag (#7289)

Objective-C
* [experimental] ObjC Proto3 optional support (#7421)
* Block subclassing of generated classes (#7124)
* Use references to Obj C classes instead of names in descriptors. (#7026)
* Revisit how the WKTs are bundled with ObjC. (#7173)

Other
* Add a proto_lang_toolchain for javalite (#6882)
* [bazel] Update gtest and deprecate //external:{gtest,gtest_main} (#7237)
* Add application note for explicit presence tracking. (#7390)
* Howto doc for implementing proto3 presence in a code generator. (#7407)


2020-02-14 version 3.11.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

C#
Expand Down
2 changes: 1 addition & 1 deletion Protobuf.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# dependent projects use the :git notation to refer to the library.
Pod::Spec.new do |s|
s.name = 'Protobuf'
s.version = '3.11.4'
s.version = '3.12.0-rc2'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/protocolbuffers/protobuf'
s.license = '3-Clause BSD License'
Expand Down
3 changes: 0 additions & 3 deletions cmake/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ set(lite_test_protos
google/protobuf/unittest_import_lite.proto
google/protobuf/unittest_import_public_lite.proto
google/protobuf/unittest_lite.proto
google/protobuf/unittest_no_arena_lite.proto
)

set(tests_protos
Expand All @@ -56,8 +55,6 @@ set(tests_protos
google/protobuf/unittest_lite_imports_nonlite.proto
google/protobuf/unittest_mset.proto
google/protobuf/unittest_mset_wire_format.proto
google/protobuf/unittest_no_arena.proto
google/protobuf/unittest_no_arena_import.proto
google/protobuf/unittest_no_field_presence.proto
google/protobuf/unittest_no_generic_services.proto
google/protobuf/unittest_optimize_for.proto
Expand Down
23 changes: 17 additions & 6 deletions conformance/ConformanceJava.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,10 @@ private <MessageType extends AbstractMessage> MessageType parseBinary(

private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest request) {
com.google.protobuf.AbstractMessage testMessage;
boolean isProto3 = request.getMessageType().equals("protobuf_test_messages.proto3.TestAllTypesProto3");
boolean isProto2 = request.getMessageType().equals("protobuf_test_messages.proto2.TestAllTypesProto2");
boolean isProto3 =
request.getMessageType().equals("protobuf_test_messages.proto3.TestAllTypesProto3");
boolean isProto2 =
request.getMessageType().equals("protobuf_test_messages.proto2.TestAllTypesProto2");

switch (request.getPayloadCase()) {
case PROTOBUF_PAYLOAD: {
Expand All @@ -264,15 +266,24 @@ private Conformance.ConformanceResponse doTest(Conformance.ConformanceRequest re
}
case JSON_PAYLOAD: {
try {
TestMessagesProto3.TestAllTypesProto3.Builder builder =
TestMessagesProto3.TestAllTypesProto3.newBuilder();
JsonFormat.Parser parser = JsonFormat.parser().usingTypeRegistry(typeRegistry);
if (request.getTestCategory()
== Conformance.TestCategory.JSON_IGNORE_UNKNOWN_PARSING_TEST) {
parser = parser.ignoringUnknownFields();
}
parser.merge(request.getJsonPayload(), builder);
testMessage = builder.build();
if (isProto3) {
TestMessagesProto3.TestAllTypesProto3.Builder builder =
TestMessagesProto3.TestAllTypesProto3.newBuilder();
parser.merge(request.getJsonPayload(), builder);
testMessage = builder.build();
} else if (isProto2) {
TestMessagesProto2.TestAllTypesProto2.Builder builder =
TestMessagesProto2.TestAllTypesProto2.newBuilder();
parser.merge(request.getJsonPayload(), builder);
testMessage = builder.build();
} else {
throw new RuntimeException("Protobuf request doesn't have specific payload type.");
}
} catch (InvalidProtocolBufferException e) {
return Conformance.ConformanceResponse.newBuilder().setParseError(e.getMessage()).build();
}
Expand Down
1 change: 1 addition & 0 deletions conformance/failure_list_csharp.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
1 change: 0 additions & 1 deletion conformance/failure_list_java.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,3 @@ Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValu
Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator
1 change: 1 addition & 0 deletions conformance/failure_list_php.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput
Recommended.FieldMaskPathsDontRoundTrip.JsonOutput
Recommended.FieldMaskTooManyUnderscore.JsonOutput
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter
Expand Down
1 change: 1 addition & 0 deletions conformance/failure_list_php_c.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput
Recommended.FieldMaskPathsDontRoundTrip.JsonOutput
Recommended.FieldMaskTooManyUnderscore.JsonOutput
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
Expand Down
1 change: 1 addition & 0 deletions conformance/failure_list_php_c_32.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput
Recommended.FieldMaskPathsDontRoundTrip.JsonOutput
Recommended.FieldMaskTooManyUnderscore.JsonOutput
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
Expand Down
1 change: 1 addition & 0 deletions conformance/failure_list_ruby.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput
Recommended.FieldMaskPathsDontRoundTrip.JsonOutput
Recommended.FieldMaskTooManyUnderscore.JsonOutput
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
Expand Down
2 changes: 1 addition & 1 deletion csharp/Google.Protobuf.Tools.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<title>Google Protocol Buffers tools</title>
<summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
<description>See project site for more info.</description>
<version>3.11.4</version>
<version>3.12.0-rc2</version>
<authors>Google Inc.</authors>
<owners>protobuf-packages</owners>
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/master/LICENSE</licenseUrl>
Expand Down
1 change: 1 addition & 0 deletions csharp/generate_protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ $PROTOC -Isrc -Icsharp/protos \
csharp/protos/unittest_issue6936_a.proto \
csharp/protos/unittest_issue6936_b.proto \
csharp/protos/unittest_issue6936_c.proto \
csharp/protos/unittest_selfreferential_options.proto \
src/google/protobuf/unittest_well_known_types.proto \
src/google/protobuf/test_messages_proto3.proto \
src/google/protobuf/test_messages_proto2.proto \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,35 @@

syntax = "proto2";

option optimize_for = LITE_RUNTIME;
package protobuf_unittest_selfreferential_options;
option csharp_namespace = "UnitTest.Issues.TestProtos.SelfreferentialOptions";

// We don't put this in a package within proto2 because we need to make sure
// that the generated code doesn't depend on being in the proto2 namespace.
// In test_util.h we do "using namespace unittest = protobuf_unittest".
package protobuf_unittest_no_arena;
import "google/protobuf/descriptor.proto";

option cc_enable_arenas = false;
message FooOptions {
// Custom field option used in definition of the extension message.
optional int32 int_opt = 1 [(foo_options) = {
int_opt: 1
[foo_int_opt]: 2
[foo_foo_opt]: {
int_opt: 3
}
}];

message ForeignMessageLite {
optional int32 c = 1;
// Custom field option used in definition of the custom option's message.
optional int32 foo = 2 [(foo_options) = {foo: 1234}];

extensions 1000 to max;
}

extend google.protobuf.FieldOptions {
// Custom field option used on the definition of that field option.
optional int32 bar_options = 1000 [(bar_options) = 1234];

optional FooOptions foo_options = 1001;
}

extend FooOptions {
optional int32 foo_int_opt = 1000;
optional FooOptions foo_foo_opt = 1001;
}
Loading

0 comments on commit 6ed7383

Please sign in to comment.