ソースを参照

Merge branch 'master' into conformance-build

Joshua Haberman 6 年 前
コミット
2996da4d81
100 ファイル変更4989 行追加815 行削除
  1. 18 0
      .github/mergeable.yml
  2. 2 0
      .gitignore
  3. 76 35
      BUILD
  4. 67 1
      CHANGES.txt
  5. 10 0
      CONTRIBUTING.md
  6. 138 5
      Makefile.am
  7. 1 1
      Protobuf.podspec
  8. 1 2
      README.md
  9. 18 2
      WORKSPACE
  10. 1 1
      appveyor.bat
  11. 22 21
      benchmarks/Makefile.am
  12. 20 5
      benchmarks/README.md
  13. 13 13
      benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java
  14. 3 3
      benchmarks/js/benchmark_suite.js
  15. 6 6
      benchmarks/js/js_benchmark.js
  16. 9 8
      benchmarks/php/PhpBenchmark.php
  17. 5 5
      benchmarks/protobuf.js/protobufjs_benchmark.js
  18. 8 7
      benchmarks/python/py_benchmark.py
  19. 3 3
      benchmarks/util/result_parser.py
  20. 6 6
      benchmarks/util/result_uploader.py
  21. 8 3
      cmake/CMakeLists.txt
  22. 11 4
      cmake/README.md
  23. 3 1
      cmake/conformance.cmake
  24. 4 2
      cmake/extract_includes.bat.in
  25. 9 2
      cmake/libprotobuf-lite.cmake
  26. 0 4
      cmake/libprotobuf.cmake
  27. 1 1
      cmake/libprotoc.cmake
  28. 1 1
      cmake/protobuf-config.cmake.in
  29. 1 1
      cmake/protoc.cmake
  30. 1 1
      cmake/tests.cmake
  31. 3 3
      cmake/version.rc.in
  32. 5 12
      configure.ac
  33. 47 14
      conformance/ConformanceJava.java
  34. 17 9
      conformance/Makefile.am
  35. 182 89
      conformance/binary_json_conformance_suite.cc
  36. 121 0
      conformance/binary_json_conformance_suite.h
  37. 41 1
      conformance/conformance.proto
  38. 59 1
      conformance/conformance_cpp.cc
  39. 4 0
      conformance/conformance_nodejs.js
  40. 22 0
      conformance/conformance_objc.m
  41. 11 2
      conformance/conformance_php.php
  42. 73 7
      conformance/conformance_python.py
  43. 7 1
      conformance/conformance_ruby.rb
  44. 66 69
      conformance/conformance_test.cc
  45. 50 38
      conformance/conformance_test.h
  46. 40 0
      conformance/conformance_test_main.cc
  47. 78 32
      conformance/conformance_test_runner.cc
  48. 0 20
      conformance/failure_list_cpp.txt
  49. 4 0
      conformance/failure_list_php.txt
  50. 2 29
      conformance/failure_list_php_c.txt
  51. 0 32
      conformance/failure_list_python_cpp.txt
  52. 2 75
      conformance/failure_list_ruby.txt
  53. 73 0
      conformance/failure_list_ruby_mac.txt
  54. 317 0
      conformance/text_format_conformance_suite.cc
  55. 26 61
      conformance/text_format_conformance_suite.h
  56. 8 0
      conformance/text_format_failure_list_csharp.txt
  57. 6 0
      conformance/text_format_failure_list_java.txt
  58. 8 0
      conformance/text_format_failure_list_php.txt
  59. 5 0
      conformance/text_format_failure_list_python.txt
  60. 8 0
      conformance/text_format_failure_list_ruby.txt
  61. 10 10
      conformance/third_party/jsoncpp/json.h
  62. 10 10
      conformance/third_party/jsoncpp/jsoncpp.cpp
  63. 3 0
      csharp/.gitignore
  64. 9 9
      csharp/CHANGES.txt
  65. 21 21
      csharp/Google.Protobuf.Tools.nuspec
  66. 13 13
      csharp/README.md
  67. 1 1
      csharp/build_packages.bat
  68. 13 0
      csharp/buildall.bat
  69. 3 3
      csharp/buildall.sh
  70. 5 5
      csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto
  71. 5 5
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs
  72. 2 2
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs
  73. 1 1
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs
  74. 3 3
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs
  75. 4 4
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
  76. 5 5
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs
  77. 2 2
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs
  78. 1 1
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs
  79. 1 1
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs
  80. 1 1
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs
  81. 2 2
      csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs
  82. 7 15
      csharp/compatibility_tests/v3.0.0/test.sh
  83. 6 0
      csharp/generate_protos.sh
  84. 0 5
      csharp/global.json
  85. 21 0
      csharp/install_dotnet_sdk.ps1
  86. 5 5
      csharp/protos/unittest_issues.proto
  87. 2 2
      csharp/protos/unittest_proto3.proto
  88. 1 1
      csharp/src/AddressBook/AddressBook.csproj
  89. 8 8
      csharp/src/AddressBook/Addressbook.cs
  90. 1980 0
      csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs
  91. 250 0
      csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs
  92. 18 0
      csharp/src/Google.Protobuf.Benchmarks/Google.Protobuf.Benchmarks.csproj
  93. 46 0
      csharp/src/Google.Protobuf.Benchmarks/Program.cs
  94. 120 0
      csharp/src/Google.Protobuf.Benchmarks/SerializationBenchmark.cs
  95. 89 0
      csharp/src/Google.Protobuf.Benchmarks/SerializationConfig.cs
  96. 519 30
      csharp/src/Google.Protobuf.Conformance/Conformance.cs
  97. 1 1
      csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj
  98. 8 4
      csharp/src/Google.Protobuf.Conformance/Program.cs
  99. 1 1
      csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj
  100. 41 5
      csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs

+ 18 - 0
.github/mergeable.yml

@@ -0,0 +1,18 @@
+mergeable:
+  pull_requests:
+    label:
+      and:
+        - must_exclude:
+            regex: '^disposition/DO NOT MERGE'
+            message: 'Pull request marked not mergeable'
+        - or:
+          - and:
+            - must_include:
+                regex: 'release notes: yes'
+                message: 'Please include release note: yes'
+            - must_include:
+                regex: '^(c#|c\+\+|cleanup|conformance tests|integration|java|javascript|go|objective-c|php|python|ruby)'
+                message: 'Please include at least a language label (e.g., c++, java, python). Or apply one of the following labels: cleanup, conformance tests, integration.'
+          - must_include:
+              regex: 'release notes: no'
+              message: 'Please include release note: no'

+ 2 - 0
.gitignore

@@ -145,7 +145,9 @@ php/ext/google/protobuf/Makefile.objects
 php/ext/google/protobuf/acinclude.m4
 php/ext/google/protobuf/build/
 php/ext/google/protobuf/config.h
+php/ext/google/protobuf/config.h.in~
 php/ext/google/protobuf/config.nice
+php/ext/google/protobuf/configure.ac
 php/ext/google/protobuf/configure.in
 php/ext/google/protobuf/mkinstalldirs
 php/ext/google/protobuf/run-tests.php

+ 76 - 35
BUILD

@@ -15,6 +15,12 @@ config_setting(
     },
 )
 
+################################################################################
+# ZLIB configuration
+################################################################################
+
+ZLIB_DEPS = ["@zlib//:zlib"]
+
 ################################################################################
 # Protobuf Runtime Library
 ################################################################################
@@ -42,12 +48,11 @@ COPTS = select({
     ":msvc" : MSVC_COPTS,
     "//conditions:default": [
         "-DHAVE_PTHREAD",
-        "-Wall",
+        "-DHAVE_ZLIB",
         "-Woverloaded-virtual",
         "-Wno-sign-compare",
         "-Wno-unused-function",
         # Prevents ISO C++ const string assignment warnings for pyext sources.
-        "-Wno-writable-strings",
         "-Wno-write-strings",
     ],
 })
@@ -63,9 +68,25 @@ config_setting(
     },
 )
 
+config_setting(
+    name = "android-libcpp",
+    values = {
+        "crosstool_top": "@androidndk//:toolchain-libcpp",
+    },
+)
+
+config_setting(
+    name = "android-gnu-libstdcpp",
+    values = {
+        "crosstool_top": "@androidndk//:toolchain-gnu-libstdcpp",
+    },
+)
+
 # Android and MSVC builds do not need to link in a separate pthread library.
 LINK_OPTS = select({
     ":android": [],
+    ":android-libcpp": [],
+    ":android-gnu-libstdcpp": [],
     ":msvc": [
         # Suppress linker warnings about files with no symbols defined.
         "-ignore:4221",
@@ -86,21 +107,25 @@ cc_library(
     name = "protobuf_lite",
     srcs = [
         # AUTOGEN(protobuf_lite_srcs)
+        "src/google/protobuf/any_lite.cc",
         "src/google/protobuf/arena.cc",
-        "src/google/protobuf/arenastring.cc",
         "src/google/protobuf/extension_set.cc",
+        "src/google/protobuf/generated_enum_util.cc",
         "src/google/protobuf/generated_message_table_driven_lite.cc",
         "src/google/protobuf/generated_message_util.cc",
         "src/google/protobuf/implicit_weak_message.cc",
         "src/google/protobuf/io/coded_stream.cc",
+        "src/google/protobuf/io/strtod.cc",
+        "src/google/protobuf/io/io_win32.cc",
         "src/google/protobuf/io/zero_copy_stream.cc",
+        "src/google/protobuf/io/zero_copy_stream_impl.cc",
         "src/google/protobuf/io/zero_copy_stream_impl_lite.cc",
         "src/google/protobuf/message_lite.cc",
+        "src/google/protobuf/parse_context.cc",
         "src/google/protobuf/repeated_field.cc",
         "src/google/protobuf/stubs/bytestream.cc",
         "src/google/protobuf/stubs/common.cc",
         "src/google/protobuf/stubs/int128.cc",
-        "src/google/protobuf/stubs/io_win32.cc",
         "src/google/protobuf/stubs/status.cc",
         "src/google/protobuf/stubs/statusor.cc",
         "src/google/protobuf/stubs/stringpiece.cc",
@@ -117,6 +142,11 @@ cc_library(
     visibility = ["//visibility:public"],
 )
 
+PROTOBUF_DEPS = select({
+    ":msvc": [],
+    "//conditions:default": ZLIB_DEPS,
+})
+
 cc_library(
     name = "protobuf",
     srcs = [
@@ -138,9 +168,7 @@ cc_library(
         "src/google/protobuf/generated_message_table_driven.cc",
         "src/google/protobuf/io/gzip_stream.cc",
         "src/google/protobuf/io/printer.cc",
-        "src/google/protobuf/io/strtod.cc",
         "src/google/protobuf/io/tokenizer.cc",
-        "src/google/protobuf/io/zero_copy_stream_impl.cc",
         "src/google/protobuf/map_field.cc",
         "src/google/protobuf/message.cc",
         "src/google/protobuf/reflection_ops.cc",
@@ -182,7 +210,7 @@ cc_library(
     includes = ["src/"],
     linkopts = LINK_OPTS,
     visibility = ["//visibility:public"],
-    deps = [":protobuf_lite"],
+    deps = [":protobuf_lite"] + PROTOBUF_DEPS,
 )
 
 # This provides just the header files for use in projects that need to build
@@ -347,7 +375,6 @@ cc_library(
         "src/google/protobuf/compiler/plugin.pb.cc",
         "src/google/protobuf/compiler/python/python_generator.cc",
         "src/google/protobuf/compiler/ruby/ruby_generator.cc",
-        "src/google/protobuf/compiler/scc.cc",
         "src/google/protobuf/compiler/subprocess.cc",
         "src/google/protobuf/compiler/zip_writer.cc",
     ],
@@ -487,7 +514,7 @@ cc_binary(
 
 cc_test(
     name = "win32_test",
-    srcs = ["src/google/protobuf/stubs/io_win32_unittest.cc"],
+    srcs = ["src/google/protobuf/io/io_win32_unittest.cc"],
     deps = [
         ":protobuf_lite",
         "//external:gtest_main",
@@ -503,7 +530,6 @@ cc_test(
         "src/google/protobuf/arena_unittest.cc",
         "src/google/protobuf/arenastring_unittest.cc",
         "src/google/protobuf/compiler/annotation_test_util.cc",
-        "src/google/protobuf/compiler/command_line_interface_unittest.cc",
         "src/google/protobuf/compiler/cpp/cpp_bootstrap_unittest.cc",
         "src/google/protobuf/compiler/cpp/cpp_move_unittest.cc",
         "src/google/protobuf/compiler/cpp/cpp_plugin_unittest.cc",
@@ -527,6 +553,7 @@ cc_test(
         "src/google/protobuf/extension_set_unittest.cc",
         "src/google/protobuf/generated_message_reflection_unittest.cc",
         "src/google/protobuf/io/coded_stream_unittest.cc",
+        "src/google/protobuf/io/io_win32_unittest.cc",
         "src/google/protobuf/io/printer_unittest.cc",
         "src/google/protobuf/io/tokenizer_unittest.cc",
         "src/google/protobuf/io/zero_copy_stream_unittest.cc",
@@ -546,7 +573,6 @@ cc_test(
         "src/google/protobuf/stubs/bytestream_unittest.cc",
         "src/google/protobuf/stubs/common_unittest.cc",
         "src/google/protobuf/stubs/int128_unittest.cc",
-        "src/google/protobuf/stubs/io_win32_unittest.cc",
         "src/google/protobuf/stubs/status_test.cc",
         "src/google/protobuf/stubs/statusor_test.cc",
         "src/google/protobuf/stubs/stringpiece_unittest.cc",
@@ -572,7 +598,13 @@ cc_test(
         "src/google/protobuf/util/type_resolver_util_test.cc",
         "src/google/protobuf/well_known_types_unittest.cc",
         "src/google/protobuf/wire_format_unittest.cc",
-    ],
+    ] + select({
+        "//conditions:default" : [
+            # Doesn't pass on Windows with MSVC
+            "src/google/protobuf/compiler/command_line_interface_unittest.cc",
+        ],
+        ":msvc": []
+    }),
     copts = COPTS,
     data = [
         ":test_plugin",
@@ -591,7 +623,7 @@ cc_test(
         ":protobuf",
         ":protoc_lib",
         "//external:gtest_main",
-    ],
+    ] + PROTOBUF_DEPS,
 )
 
 ################################################################################
@@ -624,6 +656,7 @@ java_library(
     visibility = ["//visibility:public"],
     deps = [
         "protobuf_java",
+        "//external:error_prone_annotations",
         "//external:gson",
         "//external:guava",
     ],
@@ -973,17 +1006,13 @@ py_proto_library(
 
 proto_library(
     name = "test_messages_proto2_proto",
-    srcs = [
-        "src/google/protobuf/test_messages_proto2.proto",
-    ],
+    srcs = ["src/google/protobuf/test_messages_proto2.proto"],
     visibility = ["//visibility:public"],
 )
 
 proto_library(
     name = "test_messages_proto3_proto",
-    srcs = [
-        "src/google/protobuf/test_messages_proto3.proto",
-    ],
+    srcs = ["src/google/protobuf/test_messages_proto3.proto"],
     deps = [
         ":any_proto",
         ":duration_proto",
@@ -997,16 +1026,12 @@ proto_library(
 
 cc_proto_library(
     name = "test_messages_proto2_proto_cc",
-    srcs = [
-        "src/google/protobuf/test_messages_proto2.proto",
-    ],
+    srcs = ["src/google/protobuf/test_messages_proto2.proto"],
 )
 
 cc_proto_library(
     name = "test_messages_proto3_proto_cc",
-    srcs = [
-        "src/google/protobuf/test_messages_proto3.proto",
-    ],
+    srcs = ["src/google/protobuf/test_messages_proto3.proto"],
     deps = [
         ":cc_wkt_protos",
     ],
@@ -1014,9 +1039,7 @@ cc_proto_library(
 
 proto_library(
     name = "conformance_proto",
-    srcs = [
-        "conformance/conformance.proto",
-    ],
+    srcs = ["conformance/conformance.proto"],
     visibility = ["//visibility:public"],
 )
 
@@ -1036,27 +1059,45 @@ cc_library(
     name = "conformance_test",
     srcs = [
         "conformance/conformance_test.cc",
-        "conformance/conformance_test_impl.cc",
+        "conformance/conformance_test_runner.cc",
     ],
     hdrs = [
         "conformance/conformance_test.h",
     ],
+    deps = [":conformance_proto_cc"],
+    includes = ["conformance", "src"],
+)
+
+cc_library(
+    name = "binary_json_conformance_suite",
+    srcs = ["conformance/binary_json_conformance_suite.cc"],
+    hdrs = ["conformance/binary_json_conformance_suite.h"],
     deps = [
-        ":conformance_proto_cc",
+        ":conformance_test",
         ":jsoncpp",
         ":test_messages_proto2_proto_cc",
         ":test_messages_proto3_proto_cc",
     ],
-    includes = ["conformance", "src"],
 )
 
-cc_binary(
-    name = "conformance_test_runner",
-    srcs = [
-        "conformance/conformance_test_runner.cc",
+cc_library(
+    name = "text_format_conformance_suite",
+    srcs = ["conformance/text_format_conformance_suite.cc"],
+    hdrs = ["conformance/text_format_conformance_suite.h"],
+    deps = [
+        ":conformance_test",
+        ":test_messages_proto2_proto_cc",
+        ":test_messages_proto3_proto_cc",
     ],
+)
+
+cc_library(
+    name = "conformance_test_runner",
+    srcs = ["conformance/conformance_test_main.cc"],
     deps = [
+        ":binary_json_conformance_suite",
         ":conformance_test",
+        ":text_format_conformance_suite",
     ],
     visibility = ["//visibility:public"],
 )

+ 67 - 1
CHANGES.txt

@@ -1,3 +1,69 @@
+2019-01-24 version 3.7.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+  C++
+  * Introduced new MOMI (maybe-outside-memory-interval) parser.
+  * Add an option to json_util to parse enum as case-insensitive. In the future, enum parsing in json_util will become case-sensitive.
+  * Added conformance test for enum aliases
+  * Added support for --cpp_out=speed:...
+  * Added use of C++ override keyword where appropriate
+  * Many other cleanups and fixes.
+
+  Java
+  * Fix illegal reflective access warning in JDK 9+
+  * Add BOM
+
+  Python
+  * Added Python 3.7 compatibility.
+  * Modified ParseFromString to return bytes parsed .
+  * Introduce Proto C API.
+  * FindFileContainingSymbol in descriptor pool is now able to find field and enum values.
+  * reflection.MakeClass()  and  reflection.ParseMessage() are deprecated.
+  * Added DescriptorPool.FindMethodByName() method in pure python (c extension alreay has it)
+  * Flipped proto3 to preserve unknown fields by default.
+  * Added support for memoryview in python3 proto message parsing.
+  * Added MergeFrom for repeated scalar fields in c extension (pure python already has it)
+  * Surrogates are now rejected at setters in python3.
+  * Added public unknown field API.
+  * RecursionLimit is also set to max if allow_oversize_protos is enabled.
+  * Disallow duplicate scalars in proto3 text_format parse.
+  * Fix some segment faults for c extension map field.
+
+  PHP
+  * Most issues for json encoding/decoding in the c extension have been fixed. There are still some edge cases not fixed. For more details, check conformance/failure_list_php_c.txt.
+  * Supports php 7.3
+  * Added helper methods to convert between enum values and names.
+  * Allow setting/getting wrapper message fields using primitive values.
+  * Various bug fixes.
+
+  Ruby
+  * Ruby 2.6 support.
+  * Drops support for ruby < 2.3.
+  * Most issues for json encoding/decoding in the c extension have been fixed. There are still some edge cases not fixed. For more details, check conformance/failure_list_ruby.txt.
+  * Json parsing can specify an option to ignore unknown fields: msg.decode_json(data, {ignore_unknown_fields: true}).
+  * Added support for proto2 syntax (partially).
+  * Various bug fixes.
+
+  Csharp
+  * More support for FieldMask include merge, intersect and more.
+  * Increasing the default recursion limit to 100.
+  * Support loading FileDescriptors dynamically.
+  * Provide access to comments from descriptors.
+  * Added Any.Is method.
+  * Compatible with C# 6
+  * Added IComparable and comparison operators on Timestamp.
+
+  Objective C
+  * Add ability to introspect list of enum values (#4678)
+  * Copy the value when setting message/data fields (#5215)
+  * Support suppressing the objc package prefix checks on a list of files (#5309)
+  * More complete keyword and NSObject method (via categories) checks for field names, can result in more fields being rename, but avoids the collisions at runtime (#5289)
+  * Small fixes to TextFormat generation for extensions (#5362)
+  * Provide more details/context in deprecation messages (#5412)
+  * Array/Dictionary enumeration blocks NS_NOESCAPE annotation for Swift (#5421)
+  * Properly annotate extensions for ARC when their names imply behaviors (#5427)
+  * Enum alias name collision improvements (#5480)
+
+
 2018-07-27 version 3.6.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
 
   C++
@@ -581,7 +647,7 @@
     details about APIs.
 
   Objective-C
-  * Helpers are now provided for working the the Any well known type (see
+  * Helpers are now provided for working the Any well known type (see
     GPBWellKnownTypes.h for the api additions).
   * Some improvements in startup code (especially when extensions aren’t used).
 

+ 10 - 0
CONTRIBUTING.md

@@ -83,3 +83,13 @@ the final release.
   Ultimately, the green signal will be provided by our testing infrastructure.
   The reviewer will help you if there are test failures that seem not related
   to the change you are making.
+* Apply the "release notes: yes" label if the pull request's description should
+  be included in the next release (e.g., any new feature / bug fix).
+  Apply the "release notes: no" label if the pull request's description should
+  not be included in the next release (e.g., refactoring changes that does not
+  change behavior, integration from Google internal, updating tests, etc.).
+* Apply the appropriate language label (e.g., C++, Java, Python, etc.) to the
+  pull request. This will make it easier to identify which languages the pull
+  request affects, allowing us to better identify appropriate reviewer, create
+  a better release note, and make it easier to identify issues in the future.
+  

+ 138 - 5
Makefile.am

@@ -49,6 +49,7 @@ pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = protobuf.pc protobuf-lite.pc
 
 csharp_EXTRA_DIST=                                                           \
+  global.json                                                                \
   csharp/.gitignore                                                          \
   csharp/CHANGES.txt                                                         \
   csharp/Google.Protobuf.Tools.targets                                       \
@@ -56,9 +57,10 @@ csharp_EXTRA_DIST=                                                           \
   csharp/README.md                                                           \
   csharp/build_packages.bat                                                  \
   csharp/build_tools.sh                                                      \
+  csharp/buildall.bat                                                        \
   csharp/buildall.sh                                                         \
   csharp/generate_protos.sh                                                  \
-  csharp/global.json                                                         \
+  csharp/install_dotnet_sdk.ps1                                              \
   csharp/keys/Google.Protobuf.public.snk                                     \
   csharp/keys/Google.Protobuf.snk                                            \
   csharp/keys/README.md                                                      \
@@ -75,6 +77,12 @@ csharp_EXTRA_DIST=                                                           \
   csharp/src/AddressBook/ListPeople.cs                                       \
   csharp/src/AddressBook/Program.cs                                          \
   csharp/src/AddressBook/SampleUsage.cs                                      \
+  csharp/src/Google.Protobuf.Benchmarks/SerializationConfig.cs               \
+  csharp/src/Google.Protobuf.Benchmarks/SerializationBenchmark.cs            \
+  csharp/src/Google.Protobuf.Benchmarks/Program.cs                           \
+  csharp/src/Google.Protobuf.Benchmarks/Google.Protobuf.Benchmarks.csproj    \
+  csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs                        \
+  csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs           \
   csharp/src/Google.Protobuf.Conformance/Conformance.cs                      \
   csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj  \
   csharp/src/Google.Protobuf.Conformance/Program.cs                          \
@@ -140,12 +148,17 @@ csharp_EXTRA_DIST=                                                           \
   csharp/src/Google.Protobuf/Compatibility/PropertyInfoExtensions.cs         \
   csharp/src/Google.Protobuf/Compatibility/StreamExtensions.cs               \
   csharp/src/Google.Protobuf/Compatibility/TypeExtensions.cs                 \
+  csharp/src/Google.Protobuf/Extension.cs                                    \
+  csharp/src/Google.Protobuf/ExtensionRegistry.cs                            \
+  csharp/src/Google.Protobuf/ExtensionSet.cs                                 \
+  csharp/src/Google.Protobuf/ExtensionValue.cs                               \
   csharp/src/Google.Protobuf/FieldCodec.cs                                   \
   csharp/src/Google.Protobuf/FieldMaskTree.cs                                \
   csharp/src/Google.Protobuf/FrameworkPortability.cs                         \
   csharp/src/Google.Protobuf/Google.Protobuf.csproj                          \
   csharp/src/Google.Protobuf/ICustomDiagnosticMessage.cs                     \
   csharp/src/Google.Protobuf/IDeepCloneable.cs                               \
+  csharp/src/Google.Protobuf/IExtendableMessage.cs                           \
   csharp/src/Google.Protobuf/IMessage.cs                                     \
   csharp/src/Google.Protobuf/InvalidJsonException.cs                         \
   csharp/src/Google.Protobuf/InvalidProtocolBufferException.cs               \
@@ -156,6 +169,7 @@ csharp_EXTRA_DIST=                                                           \
   csharp/src/Google.Protobuf/LimitedInputStream.cs                           \
   csharp/src/Google.Protobuf/MessageExtensions.cs                            \
   csharp/src/Google.Protobuf/MessageParser.cs                                \
+  csharp/src/Google.Protobuf/ObjectIntPair.cs                                \
   csharp/src/Google.Protobuf/ProtoPreconditions.cs                           \
   csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs                      \
   csharp/src/Google.Protobuf/Reflection/CustomOptions.cs                     \
@@ -167,6 +181,8 @@ csharp_EXTRA_DIST=                                                           \
   csharp/src/Google.Protobuf/Reflection/DescriptorValidationException.cs     \
   csharp/src/Google.Protobuf/Reflection/EnumDescriptor.cs                    \
   csharp/src/Google.Protobuf/Reflection/EnumValueDescriptor.cs               \
+  csharp/src/Google.Protobuf/Reflection/ExtensionAccessor.cs                 \
+  csharp/src/Google.Protobuf/Reflection/ExtensionCollection.cs               \
   csharp/src/Google.Protobuf/Reflection/FieldAccessorBase.cs                 \
   csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs                   \
   csharp/src/Google.Protobuf/Reflection/FieldType.cs                         \
@@ -209,6 +225,7 @@ csharp_EXTRA_DIST=                                                           \
 
 java_EXTRA_DIST=                                                                   \
   java/README.md                                                                   \
+  java/bom/pom.xml                                                                 \
   java/core/generate-sources-build.xml                                             \
   java/core/generate-test-sources-build.xml                                        \
   java/core/pom.xml                                                                \
@@ -216,17 +233,25 @@ java_EXTRA_DIST=
   java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java             \
   java/core/src/main/java/com/google/protobuf/AbstractParser.java                  \
   java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java            \
+  java/core/src/main/java/com/google/protobuf/AllocatedBuffer.java                 \
   java/core/src/main/java/com/google/protobuf/Android.java                         \
+  java/core/src/main/java/com/google/protobuf/ArrayDecoders.java                   \
+  java/core/src/main/java/com/google/protobuf/BinaryReader.java                    \
+  java/core/src/main/java/com/google/protobuf/BinaryWriter.java                    \
   java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java              \
   java/core/src/main/java/com/google/protobuf/BlockingService.java                 \
   java/core/src/main/java/com/google/protobuf/BooleanArrayList.java                \
+  java/core/src/main/java/com/google/protobuf/BufferAllocator.java                 \
   java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java                \
   java/core/src/main/java/com/google/protobuf/ByteOutput.java                      \
   java/core/src/main/java/com/google/protobuf/ByteString.java                      \
   java/core/src/main/java/com/google/protobuf/CodedInputStream.java                \
+  java/core/src/main/java/com/google/protobuf/CodedInputStreamReader.java          \
   java/core/src/main/java/com/google/protobuf/CodedOutputStream.java               \
-  java/core/src/main/java/com/google/protobuf/DiscardUnknownFieldsParser.java      \
+  java/core/src/main/java/com/google/protobuf/CodedOutputStreamWriter.java         \
+  java/core/src/main/java/com/google/protobuf/DescriptorMessageInfoFactory.java    \
   java/core/src/main/java/com/google/protobuf/Descriptors.java                     \
+  java/core/src/main/java/com/google/protobuf/DiscardUnknownFieldsParser.java      \
   java/core/src/main/java/com/google/protobuf/DoubleArrayList.java                 \
   java/core/src/main/java/com/google/protobuf/DynamicMessage.java                  \
   java/core/src/main/java/com/google/protobuf/ExperimentalApi.java                 \
@@ -235,37 +260,65 @@ java_EXTRA_DIST=
   java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java               \
   java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java        \
   java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java           \
+  java/core/src/main/java/com/google/protobuf/ExtensionSchema.java                 \
+  java/core/src/main/java/com/google/protobuf/ExtensionSchemaFull.java             \
+  java/core/src/main/java/com/google/protobuf/ExtensionSchemaLite.java             \
+  java/core/src/main/java/com/google/protobuf/ExtensionSchemas.java                \
+  java/core/src/main/java/com/google/protobuf/FieldInfo.java                       \
   java/core/src/main/java/com/google/protobuf/FieldSet.java                        \
+  java/core/src/main/java/com/google/protobuf/FieldType.java                       \
   java/core/src/main/java/com/google/protobuf/FloatArrayList.java                  \
   java/core/src/main/java/com/google/protobuf/GeneratedMessage.java                \
+  java/core/src/main/java/com/google/protobuf/GeneratedMessageInfoFactory.java     \
   java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java            \
   java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java              \
   java/core/src/main/java/com/google/protobuf/IntArrayList.java                    \
   java/core/src/main/java/com/google/protobuf/Internal.java                        \
   java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java  \
   java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java   \
+  java/core/src/main/java/com/google/protobuf/JavaType.java                        \
   java/core/src/main/java/com/google/protobuf/LazyField.java                       \
   java/core/src/main/java/com/google/protobuf/LazyFieldLite.java                   \
   java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java             \
   java/core/src/main/java/com/google/protobuf/LazyStringList.java                  \
+  java/core/src/main/java/com/google/protobuf/ListFieldSchema.java                 \
   java/core/src/main/java/com/google/protobuf/LongArrayList.java                   \
+  java/core/src/main/java/com/google/protobuf/ManifestSchemaFactory.java           \
   java/core/src/main/java/com/google/protobuf/MapEntry.java                        \
   java/core/src/main/java/com/google/protobuf/MapEntryLite.java                    \
   java/core/src/main/java/com/google/protobuf/MapField.java                        \
   java/core/src/main/java/com/google/protobuf/MapFieldLite.java                    \
+  java/core/src/main/java/com/google/protobuf/MapFieldSchema.java                  \
+  java/core/src/main/java/com/google/protobuf/MapFieldSchemaFull.java              \
+  java/core/src/main/java/com/google/protobuf/MapFieldSchemaLite.java              \
+  java/core/src/main/java/com/google/protobuf/MapFieldSchemas.java                 \
   java/core/src/main/java/com/google/protobuf/Message.java                         \
+  java/core/src/main/java/com/google/protobuf/MessageInfo.java                     \
+  java/core/src/main/java/com/google/protobuf/MessageInfoFactory.java              \
   java/core/src/main/java/com/google/protobuf/MessageLite.java                     \
   java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java            \
   java/core/src/main/java/com/google/protobuf/MessageLiteToString.java             \
   java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java                \
   java/core/src/main/java/com/google/protobuf/MessageReflection.java               \
+  java/core/src/main/java/com/google/protobuf/MessageSchema.java                   \
+  java/core/src/main/java/com/google/protobuf/MessageSetSchema.java                \
   java/core/src/main/java/com/google/protobuf/MutabilityOracle.java                \
+  java/core/src/main/java/com/google/protobuf/NewInstanceSchema.java               \
+  java/core/src/main/java/com/google/protobuf/NewInstanceSchemaFull.java           \
+  java/core/src/main/java/com/google/protobuf/NewInstanceSchemaLite.java           \
+  java/core/src/main/java/com/google/protobuf/NewInstanceSchemas.java              \
   java/core/src/main/java/com/google/protobuf/NioByteString.java                   \
+  java/core/src/main/java/com/google/protobuf/OneofInfo.java                       \
   java/core/src/main/java/com/google/protobuf/Parser.java                          \
   java/core/src/main/java/com/google/protobuf/PrimitiveNonBoxingCollection.java    \
+  java/core/src/main/java/com/google/protobuf/ProtoSyntax.java                     \
+  java/core/src/main/java/com/google/protobuf/Protobuf.java                        \
   java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java               \
+  java/core/src/main/java/com/google/protobuf/ProtobufLists.java                   \
   java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java             \
   java/core/src/main/java/com/google/protobuf/ProtocolStringList.java              \
+  java/core/src/main/java/com/google/protobuf/RawMessageInfo.java                  \
+  java/core/src/main/java/com/google/protobuf/Reader.java                          \
   java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java            \
   java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilderV3.java          \
   java/core/src/main/java/com/google/protobuf/RopeByteString.java                  \
@@ -273,30 +326,47 @@ java_EXTRA_DIST=
   java/core/src/main/java/com/google/protobuf/RpcChannel.java                      \
   java/core/src/main/java/com/google/protobuf/RpcController.java                   \
   java/core/src/main/java/com/google/protobuf/RpcUtil.java                         \
+  java/core/src/main/java/com/google/protobuf/Schema.java                          \
+  java/core/src/main/java/com/google/protobuf/SchemaFactory.java                   \
+  java/core/src/main/java/com/google/protobuf/SchemaUtil.java                      \
   java/core/src/main/java/com/google/protobuf/Service.java                         \
   java/core/src/main/java/com/google/protobuf/ServiceException.java                \
   java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java              \
   java/core/src/main/java/com/google/protobuf/SingleFieldBuilderV3.java            \
   java/core/src/main/java/com/google/protobuf/SmallSortedMap.java                  \
+  java/core/src/main/java/com/google/protobuf/StructuralMessageInfo.java           \
   java/core/src/main/java/com/google/protobuf/TextFormat.java                      \
   java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java               \
   java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java         \
   java/core/src/main/java/com/google/protobuf/TextFormatParseLocation.java         \
   java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java   \
+  java/core/src/main/java/com/google/protobuf/UnknownFieldSchema.java              \
   java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java                 \
   java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java             \
+  java/core/src/main/java/com/google/protobuf/UnknownFieldSetLiteSchema.java       \
+  java/core/src/main/java/com/google/protobuf/UnknownFieldSetSchema.java           \
   java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java      \
   java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java            \
   java/core/src/main/java/com/google/protobuf/UnsafeUtil.java                      \
   java/core/src/main/java/com/google/protobuf/Utf8.java                            \
   java/core/src/main/java/com/google/protobuf/WireFormat.java                      \
+  java/core/src/main/java/com/google/protobuf/Writer.java                          \
   java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java             \
+  java/core/src/test/java/com/google/protobuf/AbstractProto2LiteSchemaTest.java    \
+  java/core/src/test/java/com/google/protobuf/AbstractProto2SchemaTest.java        \
+  java/core/src/test/java/com/google/protobuf/AbstractProto3LiteSchemaTest.java    \
+  java/core/src/test/java/com/google/protobuf/AbstractProto3SchemaTest.java        \
+  java/core/src/test/java/com/google/protobuf/AbstractSchemaTest.java              \
   java/core/src/test/java/com/google/protobuf/AnyTest.java                         \
+  java/core/src/test/java/com/google/protobuf/ArrayDecodersTest.java               \
+  java/core/src/test/java/com/google/protobuf/BinaryProtocolTest.java              \
   java/core/src/test/java/com/google/protobuf/BooleanArrayListTest.java            \
   java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java           \
   java/core/src/test/java/com/google/protobuf/ByteBufferWriterTest.java            \
   java/core/src/test/java/com/google/protobuf/ByteStringTest.java                  \
+  java/core/src/test/java/com/google/protobuf/CachedFieldSizeTest.java             \
   java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java                   \
+  java/core/src/test/java/com/google/protobuf/CodedAdapterTest.java                \
   java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java            \
   java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java           \
   java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java                  \
@@ -306,6 +376,9 @@ java_EXTRA_DIST=
   java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java             \
   java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java              \
   java/core/src/test/java/com/google/protobuf/EnumTest.java                        \
+  java/core/src/test/java/com/google/protobuf/ExperimentalMessageFactory.java      \
+  java/core/src/test/java/com/google/protobuf/ExperimentalSerializationUtil.java   \
+  java/core/src/test/java/com/google/protobuf/ExperimentalTestDataProvider.java    \
   java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java    \
   java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java               \
   java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java              \
@@ -320,17 +393,32 @@ java_EXTRA_DIST=
   java/core/src/test/java/com/google/protobuf/LazyStringArrayListTest.java         \
   java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java          \
   java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java           \
-  java/core/src/test/java/com/google/protobuf/LiteTest.java                        \
   java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java           \
   java/core/src/test/java/com/google/protobuf/LongArrayListTest.java               \
   java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java            \
   java/core/src/test/java/com/google/protobuf/MapForProto2Test.java                \
+  java/core/src/test/java/com/google/protobuf/MapLiteTest.java                     \
   java/core/src/test/java/com/google/protobuf/MapTest.java                         \
   java/core/src/test/java/com/google/protobuf/MessageTest.java                     \
   java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java              \
   java/core/src/test/java/com/google/protobuf/NioByteStringTest.java               \
+  java/core/src/test/java/com/google/protobuf/PackedFieldTest.java                 \
   java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java             \
+  java/core/src/test/java/com/google/protobuf/ParserLiteTest.java                  \
   java/core/src/test/java/com/google/protobuf/ParserTest.java                      \
+  java/core/src/test/java/com/google/protobuf/Proto2ExtensionLookupSchemaTest.java \
+  java/core/src/test/java/com/google/protobuf/Proto2LiteSchemaTest.java            \
+  java/core/src/test/java/com/google/protobuf/Proto2MessageFactory.java            \
+  java/core/src/test/java/com/google/protobuf/Proto2MessageInfoFactory.java        \
+  java/core/src/test/java/com/google/protobuf/Proto2MessageLiteFactory.java        \
+  java/core/src/test/java/com/google/protobuf/Proto2SchemaTest.java                \
+  java/core/src/test/java/com/google/protobuf/Proto2UnknownEnumValueTest.java      \
+  java/core/src/test/java/com/google/protobuf/Proto3LiteSchemaTest.java            \
+  java/core/src/test/java/com/google/protobuf/Proto3MessageFactory.java            \
+  java/core/src/test/java/com/google/protobuf/Proto3MessageInfoFactory.java        \
+  java/core/src/test/java/com/google/protobuf/Proto3MessageLiteFactory.java        \
+  java/core/src/test/java/com/google/protobuf/Proto3MessageLiteInfoFactory.java    \
+  java/core/src/test/java/com/google/protobuf/Proto3SchemaTest.java                \
   java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java           \
   java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java      \
   java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java     \
@@ -340,18 +428,25 @@ java_EXTRA_DIST=
   java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java              \
   java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java              \
   java/core/src/test/java/com/google/protobuf/TestBadIdentifiersLite.java          \
+  java/core/src/test/java/com/google/protobuf/TestSchemas.java                     \
+  java/core/src/test/java/com/google/protobuf/TestSchemasLite.java                 \
   java/core/src/test/java/com/google/protobuf/TestUtil.java                        \
   java/core/src/test/java/com/google/protobuf/TestUtilLite.java                    \
   java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java     \
   java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java     \
   java/core/src/test/java/com/google/protobuf/TextFormatTest.java                  \
   java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java            \
-  java/core/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java         \
   java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java             \
   java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java  \
+  java/core/src/test/java/com/google/protobuf/Utf8Test.java                        \
+  java/core/src/test/java/com/google/protobuf/Utf8Utils.java                       \
   java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java              \
+  java/core/src/test/java/com/google/protobuf/WireFormatLiteTest.java              \
   java/core/src/test/java/com/google/protobuf/WireFormatTest.java                  \
+  java/core/src/test/java/com/google/protobuf/WrappersLiteOfMethodTest.java        \
+  java/core/src/test/java/com/google/protobuf/WrappersOfMethodTest.java            \
   java/core/src/test/proto/com/google/protobuf/any_test.proto                      \
+  java/core/src/test/proto/com/google/protobuf/cached_field_size_test.proto        \
   java/core/src/test/proto/com/google/protobuf/deprecated_file.proto               \
   java/core/src/test/proto/com/google/protobuf/field_presence_test.proto           \
   java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto              \
@@ -361,6 +456,7 @@ java_EXTRA_DIST=
   java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto \
   java/core/src/test/proto/com/google/protobuf/map_lite_test.proto                 \
   java/core/src/test/proto/com/google/protobuf/map_test.proto                      \
+  java/core/src/test/proto/com/google/protobuf/message_lite_extension_util_test.proto\
   java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto           \
   java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto          \
   java/core/src/test/proto/com/google/protobuf/nested_extension.proto              \
@@ -370,12 +466,26 @@ java_EXTRA_DIST=
   java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto         \
   java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto        \
   java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto        \
+  java/core/src/test/proto/com/google/protobuf/packed_field_test.proto             \
+  java/core/src/test/proto/com/google/protobuf/proto2_message.proto                \
+  java/core/src/test/proto/com/google/protobuf/proto2_message_lite.proto           \
+  java/core/src/test/proto/com/google/protobuf/proto2_unknown_enum_values.proto    \
+  java/core/src/test/proto/com/google/protobuf/proto3_message.proto                \
+  java/core/src/test/proto/com/google/protobuf/proto3_message_lite.proto           \
   java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto          \
   java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto               \
   java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto          \
   java/core/src/test/proto/com/google/protobuf/test_custom_options.proto           \
   java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto         \
+  java/core/src/test/proto/com/google/protobuf/wrappers_test.proto                 \
   java/lite.md                                                                     \
+  java/lite/generate-sources-build.xml                                             \
+  java/lite/generate-test-sources-build.xml                                        \
+  java/lite/lite.awk                                                               \
+  java/lite/pom.xml                                                                \
+  java/lite/process-lite-sources-build.xml                                         \
+  java/lite/src/test/java/com/google/protobuf/LiteTest.java                        \
+  java/lite/src/test/java/com/google/protobuf/Proto2MessageLiteInfoFactory.java    \
   java/pom.xml                                                                     \
   java/util/pom.xml                                                                \
   java/util/src/main/java/com/google/protobuf/util/Durations.java                  \
@@ -472,6 +582,12 @@ objectivec_EXTRA_DIST=                                                       \
   objectivec/ProtocolBuffers_OSX.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
   objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme \
   objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme \
+  objectivec/ProtocolBuffers_tvOS.xcodeproj/project.pbxproj                  \
+  objectivec/ProtocolBuffers_tvOS.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
+  objectivec/ProtocolBuffers_tvOS.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist \
+  objectivec/ProtocolBuffers_tvOS.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \
+  objectivec/ProtocolBuffers_tvOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme \
+  objectivec/ProtocolBuffers_tvOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme \
   objectivec/README.md                                                       \
   objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.pbxproj \
   objectivec/Tests/CocoaPods/OSXCocoaPodsTester/OSXCocoaPodsTester.xcodeproj/project.xcworkspace/contents.xcworkspacedata \
@@ -557,6 +673,7 @@ objectivec_EXTRA_DIST=                                                       \
   objectivec/Tests/GPBUtilitiesTests.m                                       \
   objectivec/Tests/GPBWellKnownTypesTest.m                                   \
   objectivec/Tests/GPBWireFormatTests.m                                      \
+  objectivec/Tests/text_format_extensions_unittest_data.txt                   \
   objectivec/Tests/text_format_map_unittest_data.txt                          \
   objectivec/Tests/text_format_unittest_data.txt                              \
   objectivec/Tests/unittest_cycle.proto                                       \
@@ -570,6 +687,7 @@ objectivec_EXTRA_DIST=                                                       \
   objectivec/Tests/unittest_extension_chain_f.proto                           \
   objectivec/Tests/unittest_extension_chain_g.proto                           \
   objectivec/Tests/unittest_objc.proto                                        \
+  objectivec/Tests/unittest_objc_options.proto                                \
   objectivec/Tests/unittest_objc_startup.proto                                \
   objectivec/Tests/unittest_runtime_proto2.proto                              \
   objectivec/Tests/unittest_runtime_proto3.proto                              \
@@ -582,6 +700,7 @@ php_EXTRA_DIST=                                                       \
   php/README.md                                                       \
   php/composer.json                                                   \
   php/ext/google/protobuf/array.c                                     \
+  php/ext/google/protobuf/builtin_descriptors.inc                     \
   php/ext/google/protobuf/config.m4                                   \
   php/ext/google/protobuf/def.c                                       \
   php/ext/google/protobuf/encode_decode.c                             \
@@ -598,6 +717,7 @@ php_EXTRA_DIST=                                                       \
   php/ext/google/protobuf/utf8.h                                      \
   php/generate_descriptor_protos.sh                                   \
   php/phpunit.xml                                                     \
+  php/release.sh                                                      \
   php/src/GPBMetadata/Google/Protobuf/Any.php                         \
   php/src/GPBMetadata/Google/Protobuf/Api.php                         \
   php/src/GPBMetadata/Google/Protobuf/Duration.php                    \
@@ -725,6 +845,7 @@ php_EXTRA_DIST=                                                       \
   php/tests/autoload.php                                              \
   php/tests/bootstrap_phpunit.php                                     \
   php/tests/compatibility_test.sh                                     \
+  php/tests/compile_extension.sh                                      \
   php/tests/descriptors_test.php                                      \
   php/tests/encode_decode_test.php                                    \
   php/tests/gdb_test.sh                                               \
@@ -782,6 +903,7 @@ python_EXTRA_DIST=                                                           \
   python/google/protobuf/internal/descriptor_test.py                         \
   python/google/protobuf/internal/encoder.py                                 \
   python/google/protobuf/internal/enum_type_wrapper.py                       \
+  python/google/protobuf/internal/extension_dict.py                          \
   python/google/protobuf/internal/factory_test1.proto                        \
   python/google/protobuf/internal/factory_test2.proto                        \
   python/google/protobuf/internal/file_options_test.proto                    \
@@ -790,6 +912,7 @@ python_EXTRA_DIST=                                                           \
   python/google/protobuf/internal/import_test_package/inner.proto            \
   python/google/protobuf/internal/import_test_package/outer.proto            \
   python/google/protobuf/internal/json_format_test.py                        \
+  python/google/protobuf/internal/keywords_test.py                           \
   python/google/protobuf/internal/message_factory_test.py                    \
   python/google/protobuf/internal/message_listener.py                        \
   python/google/protobuf/internal/message_set_extensions.proto               \
@@ -857,7 +980,6 @@ python_EXTRA_DIST=                                                           \
   python/google/protobuf/pyext/repeated_scalar_container.h                   \
   python/google/protobuf/pyext/safe_numerics.h                               \
   python/google/protobuf/pyext/scoped_pyobject_ptr.h                         \
-  python/google/protobuf/pyext/thread_unsafe_shared_ptr.h                    \
   python/google/protobuf/reflection.py                                       \
   python/google/protobuf/service.py                                          \
   python/google/protobuf/service_reflection.py                               \
@@ -941,6 +1063,7 @@ ruby_EXTRA_DIST=                                                             \
   ruby/tests/test_ruby_package.proto                                         \
   ruby/tests/generated_code_test.rb                                          \
   ruby/tests/well_known_types_test.rb                                        \
+  ruby/tests/type_errors.rb                                                  \
   ruby/travis-test.sh
 
 js_EXTRA_DIST=                                                         \
@@ -1039,6 +1162,11 @@ js_EXTRA_DIST=                                                         \
   js/test8.proto                                                       \
   js/test9.proto                                                       \
   js/test10.proto                                                      \
+  js/test11.proto                                                      \
+  js/test12.proto                                                      \
+  js/test13.proto                                                      \
+  js/test14.proto                                                      \
+  js/test15.proto                                                      \
   js/test_bootstrap.js                                                 \
   js/testbinary.proto                                                  \
   js/testempty.proto
@@ -1073,6 +1201,7 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST)   \
   cmake/protoc.cmake                     \
   cmake/tests.cmake                      \
   cmake/version.rc.in                    \
+  compiler_config_setting.bzl            \
   editors/README.txt                     \
   editors/proto.vim                      \
   editors/protobuf-mode.el               \
@@ -1084,14 +1213,18 @@ EXTRA_DIST = $(@DIST_LANG@_EXTRA_DIST)   \
   examples/README.md                     \
   examples/WORKSPACE                     \
   examples/add_person.cc                 \
+  examples/add_person.dart               \
   examples/add_person.go                 \
   examples/add_person.py                 \
   examples/add_person_test.go            \
   examples/addressbook.proto             \
   examples/list_people.cc                \
+  examples/list_people.dart              \
   examples/list_people.go                \
   examples/list_people.py                \
   examples/list_people_test.go           \
+  examples/pubspec.yaml                  \
+  examples/third_party/zlib.BUILD        \
   protobuf.bzl                           \
   python/release/wheel/build_wheel_manylinux.sh  \
   python/release/wheel/Dockerfile                \

+ 1 - 1
Protobuf.podspec

@@ -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.6.1'
+  s.version  = '3.7.1'
   s.summary  = 'Protocol Buffers v.3 runtime library for Objective-C.'
   s.homepage = 'https://github.com/protocolbuffers/protobuf'
   s.license  = '3-Clause BSD License'

ファイルの差分が大きいため隠しています
+ 1 - 2
README.md


+ 18 - 2
WORKSPACE

@@ -1,9 +1,15 @@
 workspace(name = "com_google_protobuf")
+
 load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+load("//:protobuf_deps.bzl", "protobuf_deps")
 
-http_archive(
+# Load common dependencies.
+protobuf_deps()
+
+new_local_repository(
     name = "submodule_gmock",
-    urls = ["https://github.com/google/googletest/archive/release-1.8.1.zip"]
+    build_file = "@//:third_party/googletest/BUILD.bazel",
+    path = "third_party/googletest",
 )
 
 http_archive(
@@ -59,3 +65,13 @@ bind(
     name = "gson",
     actual = "@gson_maven//jar",
 )
+
+maven_jar(
+    name = "error_prone_annotations_maven",
+    artifact = "com.google.errorprone:error_prone_annotations:2.3.2",
+)
+
+bind(
+    name = "error_prone_annotations",
+    actual = "@error_prone_annotations_maven//jar",
+)

+ 1 - 1
appveyor.bat

@@ -38,7 +38,7 @@ dotnet restore
 dotnet build -c %configuration% || goto error
 
 echo Testing C#
-dotnet test -c %configuration% -f netcoreapp1.0 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error
+dotnet test -c %configuration% -f netcoreapp2.1 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error
 dotnet test -c %configuration% -f net451 Google.Protobuf.Test\Google.Protobuf.Test.csproj || goto error
 
 goto :EOF

+ 22 - 21
benchmarks/Makefile.am

@@ -25,6 +25,7 @@ make_tmp_dir:
 	mkdir -p 'tmp/java/src/main/java'
 	touch make_tmp_dir
 
+
 # We have to cd to $(srcdir) before executing protoc because $(protoc_inputs) is
 # relative to srcdir, which may not be the same as the current directory when
 # building out-of-tree.
@@ -90,8 +91,8 @@ $(benchmarks_protoc_outputs_proto2_header): protoc_middleman2
 
 initialize_submodule:
 	oldpwd=`pwd`
-	cd $(top_srcdir) && git submodule update --init -r third_party/benchmark
-	cd $(top_srcdir)/third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make
+	cd $(top_srcdir) && git submodule update --init -r third_party/benchmark && \
+		cd third_party/benchmark && cmake -DCMAKE_BUILD_TYPE=Release && make
 	cd $$oldpwd
 	touch initialize_submodule
 
@@ -126,7 +127,7 @@ java_benchmark_testing_files =                                      \
 	java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java
 
 javac_middleman: $(java_benchmark_testing_files) protoc_middleman protoc_middleman2
-	cp -r $(srcdir)/java tmp 
+	cp -r $(srcdir)/java tmp
 	mkdir -p tmp/java/lib
 	cp $(top_srcdir)/java/core/target/*.jar tmp/java/lib/protobuf-java.jar
 	cd tmp/java && mvn clean compile assembly:single -Dprotobuf.version=$(PACKAGE_VERSION) && cd ../..
@@ -253,7 +254,7 @@ go_protoc_middleman: make_tmp_dir $(top_srcdir)/src/protoc$(EXEEXT) $(benchmarks
 	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I. -I$(top_srcdir)/src --go_out=$$oldpwd/tmp $(benchmarks_protoc_inputs_proto2_message4) )
 	touch go_protoc_middleman
 
-go-benchmark: go_protoc_middleman 
+go-benchmark: go_protoc_middleman
 	@echo "Writing shortcut script go-benchmark..."
 	@echo '#! /bin/bash' > go-benchmark
 	@echo 'cd $(srcdir)/go' >> go-benchmark
@@ -265,7 +266,7 @@ go-benchmark: go_protoc_middleman
 	@echo 'cd ..' >> go-benchmark
 	@chmod +x go-benchmark
 
-go: go_protoc_middleman go-benchmark 
+go: go_protoc_middleman go-benchmark
 	./go-benchmark $(all_data)
 
 ############# GO RULES END ##############
@@ -322,9 +323,9 @@ $(cpp_no_group_benchmarks_protoc_outputs_proto2_header): cpp_no_group_protoc_mid
 generate_cpp_no_group_benchmark_code:
 	cp $(srcdir)/cpp/cpp_benchmark.cc gogo/cpp_no_group/cpp_benchmark.cc
 	sed -i -e "s/\#include \"datasets/\#include \"gogo\/cpp_no_group\/datasets/g" gogo/cpp_no_group/cpp_benchmark.cc
-	sed -i -e "s/\#include \"benchmarks.pb.h/\#include \"gogo\/cpp_no_group\/benchmarks.pb.h/g" gogo/cpp_no_group/cpp_benchmark.cc  
+	sed -i -e "s/\#include \"benchmarks.pb.h/\#include \"gogo\/cpp_no_group\/benchmarks.pb.h/g" gogo/cpp_no_group/cpp_benchmark.cc
 	touch generate_cpp_no_group_benchmark_code
-	
+
 bin_PROGRAMS += cpp-no-group-benchmark
 cpp_no_group_benchmark_LDADD = $(top_srcdir)/src/libprotobuf.la $(top_srcdir)/third_party/benchmark/src/libbenchmark.a
 cpp_no_group_benchmark_SOURCES = gogo/cpp_no_group/cpp_benchmark.cc
@@ -343,7 +344,7 @@ nodist_cpp_no_group_benchmark_SOURCES =                                    \
 
 cpp_no_group: cpp_no_group_protoc_middleman generate_gogo_data cpp-no-group-benchmark
 	./cpp-no-group-benchmark $(gogo_data)
- 
+
 gogo_proto_middleman: protoc-gen-gogoproto
 	mkdir -p "tmp/gogo_proto"
 	oldpwd=`pwd` && ( cd $(srcdir) && $$oldpwd/../src/protoc$(EXEEXT) -I$(srcdir) -I$(top_srcdir) --plugin=protoc-gen-gogoproto --gogoproto_out=$$oldpwd/tmp/gogo_proto $(benchmarks_protoc_inputs) $(benchmarks_protoc_inputs_benchmark_wrapper) $(benchmarks_protoc_inputs_proto2) )
@@ -355,7 +356,7 @@ generate_gogo_data: protoc_middleman protoc_middleman2 gogo-data-scrubber
 	mkdir -p `dirname $(gogo_data)`
 	./gogo-data-scrubber $(all_data) $(gogo_data)
 	touch generate_gogo_data
-	
+
 make_tmp_dir_gogo:
 	mkdir -p tmp/go_no_group/benchmark_code
 	mkdir -p tmp/gogofast/benchmark_code
@@ -435,10 +436,10 @@ gogo-benchmark:
 
 go_no_group: go_no_group_protoc_middleman generate_gogo_data generate_all_gogo_benchmark_code gogo-benchmark
 	./gogo-benchmark go_no_group $(gogo_data)
-	
-gogofast: gogofast_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code 
+
+gogofast: gogofast_protoc_middleman generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code
 	./gogo-benchmark gogofast $(gogo_data)
-	
+
 gogofaster: gogofaster_protoc_middleman  generate_gogo_data gogo-benchmark generate_all_gogo_benchmark_code
 	./gogo-benchmark gogofaster $(gogo_data)
 
@@ -448,7 +449,7 @@ gogoslick: gogoslick_protoc_middleman  generate_gogo_data gogo-benchmark generat
 
 ############# GOGO RULES END ############
 
- 
+
 ############ UTIL RULES BEGIN ############
 
 bin_PROGRAMS += protoc-gen-gogoproto gogo-data-scrubber protoc-gen-proto2_to_proto3 proto3-data-stripper
@@ -481,7 +482,7 @@ nodist_proto3_data_stripper_SOURCES =                                      \
 	$(benchmarks_protoc_outputs_proto2_header)                               \
 	$(benchmarks_protoc_outputs_header)
 
-	
+
 ############ UTIL RULES END ############
 
 ############ PROTO3 PREPARATION BEGIN #############
@@ -510,7 +511,7 @@ proto3_middleman_php: proto3_proto_middleman
 
 php-benchmark: proto3_middleman_php generate_proto3_data
 	mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark"
-	cp php/autoload.php "tmp/php"  
+	cp php/autoload.php "tmp/php"
 	@echo "Writing shortcut script php-benchmark..."
 	@echo '#! /bin/bash' > php-benchmark
 	@echo 'export PROTOBUF_PHP_SRCDIR="$$(cd $(top_srcdir) && pwd)/php/src"' >> php-benchmark
@@ -521,14 +522,14 @@ php-benchmark: proto3_middleman_php generate_proto3_data
 	@chmod +x php-benchmark
 
 php: php-benchmark proto3_middleman_php
-	./php-benchmark $(proto3_data)
+	./php-benchmark --behavior_prefix="php" $(proto3_data)
 
 php_c_extension:
-	cd $(top_srcdir)/php/ext/google/protobuf && ./configure CFLAGS='-O3' && make -j8
+	cd $(top_srcdir)/php/ext/google/protobuf && phpize && ./configure CFLAGS='-O3' && make -j8
 
 php-c-benchmark: proto3_middleman_php generate_proto3_data php_c_extension php_c_extension
-	mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark" 
-	cp php/autoload.php "tmp/php"  
+	mkdir -p "tmp/php/Google/Protobuf/Benchmark" && cp php/PhpBenchmark.php "tmp/php/Google/Protobuf/Benchmark"
+	cp php/autoload.php "tmp/php"
 	@echo "Writing shortcut script php-c-benchmark..."
 	@echo '#! /bin/bash' > php-c-benchmark
 	@echo 'export PROTOBUF_PHP_SRCDIR="$$(cd $(top_srcdir) && pwd)/php/src"' >> php-c-benchmark
@@ -540,7 +541,7 @@ php-c-benchmark: proto3_middleman_php generate_proto3_data php_c_extension php_c
 	@chmod +x php-c-benchmark
 
 php_c: php-c-benchmark proto3_middleman_php
-	./php-c-benchmark $(proto3_data)
+	./php-c-benchmark --behavior_prefix="php_c" $(proto3_data)
 
 
 ############ PHP RULES END #################
@@ -654,4 +655,4 @@ CLEANFILES =                                                               \
 
 clean-local:
 	-rm -rf tmp/*
-	
+

+ 20 - 5
benchmarks/README.md

@@ -3,7 +3,7 @@
 
 This directory contains benchmarking schemas and data sets that you
 can use to test a variety of performance scenarios against your
-protobuf language runtime. If you are looking for performance 
+protobuf language runtime. If you are looking for performance
 numbers of officially support languages, see [here](
 https://github.com/protocolbuffers/protobuf/blob/master/docs/performance.md)
 
@@ -45,8 +45,8 @@ And you also need to make sure `pkg-config` is installed.
 
 ### Go
 Go protobufs are maintained at [github.com/golang/protobuf](
-http://github.com/golang/protobuf). If not done already, you need to install the 
-toolchain and the Go protoc-gen-go plugin for protoc. 
+http://github.com/golang/protobuf). If not done already, you need to install the
+toolchain and the Go protoc-gen-go plugin for protoc.
 
 To install protoc-gen-go, run:
 
@@ -59,12 +59,18 @@ The first command installs `protoc-gen-go` into the `bin` directory in your loca
 The second command adds the `bin` directory to your `PATH` so that `protoc` can locate the plugin later.
 
 ### PHP
-PHP benchmark's requirement is the same as PHP protobuf's requirements. The benchmark will automaticly 
+PHP benchmark's requirement is the same as PHP protobuf's requirements. The benchmark will automaticly
 include PHP protobuf's src and build the c extension if required.
 
 ### Node.js
 Node.js benchmark need [node](https://nodejs.org/en/)(higher than V6) and [npm](https://www.npmjs.com/) package manager installed. This benchmark is using the [benchmark](https://www.npmjs.com/package/benchmark) framework to test, which needn't to manually install. And another prerequisite is [protobuf js](https://github.com/protocolbuffers/protobuf/tree/master/js), which needn't to manually install either
 
+### C#
+The C# benchmark code is built as part of the main Google.Protobuf
+solution. It requires the .NET Core SDK, and depends on
+[BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet), which
+will be downloaded automatically.
+
 ### Big data
 
 There's some optional big testing data which is not included in the directory
@@ -74,7 +80,7 @@ initially, you need to run the following command to download the testing data:
 $ ./download_data.sh
 ```
 
-After doing this the big data file will automaticly generated in the
+After doing this the big data file will automatically generated in the
 benchmark directory.
 
 ## Run instructions
@@ -209,6 +215,15 @@ $ make js-benchmark
 $ ./js-benchmark $(specific generated dataset file name)
 ```
 
+### C#
+From `csharp/src/Google.Protobuf.Benchmarks`, run:
+
+```
+$ dotnet run -c Release
+```
+
+We intend to add support for this within the makefile in due course.
+
 ## Benchmark datasets
 
 Each data set is in the format of benchmarks.proto:

+ 13 - 13
benchmarks/java/src/main/java/com/google/protobuf/ProtoCaliperBenchmark.java

@@ -24,8 +24,8 @@ import java.util.ArrayList;
 import java.util.List;
 
 // Caliper set CICompilerCount to 1 for making sure compilation doesn't run in parallel with itself,
-// This makes TieredCompilation not working. We just disable TieredCompilation by default. In master 
-// branch this has been disabled by default in caliper: 
+// This makes TieredCompilation not working. We just disable TieredCompilation by default. In master
+// branch this has been disabled by default in caliper:
 // https://github.com/google/caliper/blob/master/caliper-runner/src/main/java/com/google/caliper/runner/target/Jvm.java#L38:14
 // But this haven't been added into most recent release.
 @VmOptions("-XX:-TieredCompilation")
@@ -89,7 +89,7 @@ public class ProtoCaliperBenchmark {
         return com.google.protobuf.benchmarks.BenchmarkMessage4.GoogleMessage4.getDefaultInstance();
       }
     };
-    
+
     abstract ExtensionRegistry getExtensionRegistry();
     abstract Message getDefaultInstance();
   }
@@ -97,7 +97,7 @@ public class ProtoCaliperBenchmark {
   private BenchmarkMessageType benchmarkMessageType;
   @Param("")
   private String dataFile;
-  
+
   private byte[] inputData;
   private BenchmarkDataset benchmarkDataset;
   private Message defaultMessage;
@@ -125,7 +125,7 @@ public class ProtoCaliperBenchmark {
           + benchmarkDataset.getMessageName());
     }
   }
-  
+
   @BeforeExperiment
   void setUp() throws IOException {
     if (!dataFile.equals("")) {
@@ -145,7 +145,7 @@ public class ProtoCaliperBenchmark {
     inputStreamList = new ArrayList<ByteArrayInputStream>();
     inputStringList = new ArrayList<ByteString>();
     sampleMessageList = new ArrayList<Message>();
-    
+
     for (int i = 0; i < benchmarkDataset.getPayloadCount(); i++) {
       byte[] singleInputData = benchmarkDataset.getPayload(i).toByteArray();
       inputDataList.add(benchmarkDataset.getPayload(i).toByteArray());
@@ -156,8 +156,8 @@ public class ProtoCaliperBenchmark {
           defaultMessage.newBuilderForType().mergeFrom(singleInputData, extensions).build());
     }
   }
-  
-  
+
+
   @Benchmark
   void serializeToByteArray(int reps) throws IOException {
     if (sampleMessageList.size() == 0) {
@@ -165,11 +165,11 @@ public class ProtoCaliperBenchmark {
     }
     for (int i = 0; i < reps; i++) {
       for (int j = 0; j < sampleMessageList.size(); j++) {
-        sampleMessageList.get(j).toByteArray();  
+        sampleMessageList.get(j).toByteArray();
       }
     }
   }
-  
+
   @Benchmark
   void serializeToMemoryStream(int reps) throws IOException {
     if (sampleMessageList.size() == 0) {
@@ -178,11 +178,11 @@ public class ProtoCaliperBenchmark {
     for (int i = 0; i < reps; i++) {
       for (int j = 0; j < sampleMessageList.size(); j++) {
         ByteArrayOutputStream output = new ByteArrayOutputStream();
-        sampleMessageList.get(j).writeTo(output); 
+        sampleMessageList.get(j).writeTo(output);
       }
     }
   }
-  
+
   @Benchmark
   void deserializeFromByteArray(int reps) throws IOException {
     if (inputDataList.size() == 0) {
@@ -195,7 +195,7 @@ public class ProtoCaliperBenchmark {
       }
     }
   }
-  
+
   @Benchmark
   void deserializeFromMemoryStream(int reps) throws IOException {
     if (inputStreamList.size() == 0) {

+ 3 - 3
benchmarks/js/benchmark_suite.js

@@ -9,8 +9,8 @@ function newBenchmark(messageName, filename, language) {
       })
       .on("start", function() {
           process.stdout.write(
-            "benchmarking message " + messageName 
-            + " of dataset file " + filename 
+            "benchmarking message " + messageName
+            + " of dataset file " + filename
             + "'s performance ..." + "\n\n");
       })
       .on("cycle", function(event) {
@@ -21,7 +21,7 @@ function newBenchmark(messageName, filename, language) {
             return 1 / (bench.stats.mean + bench.stats.moe);
           }
           benches.forEach(function(val, index) {
-            benches[index] = getHz(val); 
+            benches[index] = getHz(val);
           });
       }),
      benches: benches

+ 6 - 6
benchmarks/js/js_benchmark.js

@@ -30,7 +30,7 @@ process.argv.forEach(function(filename, index) {
     json_file = filename.replace(/^--json_output=/, '');
     return;
   }
-  
+
   var benchmarkDataset =
       proto.benchmarks.BenchmarkDataset.deserializeBinary(fs.readFileSync(filename));
   var messageList = [];
@@ -40,7 +40,7 @@ process.argv.forEach(function(filename, index) {
     messageList.push(message.deserializeBinary(onePayload));
     totalBytes += onePayload.length;
   });
-  
+
   var senarios = benchmarkSuite.newBenchmark(
       benchmarkDataset.getMessageName(), filename, "js");
   senarios.suite
@@ -48,14 +48,14 @@ process.argv.forEach(function(filename, index) {
     benchmarkDataset.getPayloadList().forEach(function(onePayload) {
       var protoType = getNewPrototype(benchmarkDataset.getMessageName());
       protoType.deserializeBinary(onePayload);
-    });    
+    });
   })
   .add("js serialize", function() {
     var protoType = getNewPrototype(benchmarkDataset.getMessageName());
     messageList.forEach(function(message) {
       message.serializeBinary();
     });
-  }) 
+  })
   .run({"Async": false});
 
   results.push({
@@ -66,9 +66,9 @@ process.argv.forEach(function(filename, index) {
     }
   })
 
-  console.log("Throughput for deserialize: " 
+  console.log("Throughput for deserialize: "
     + senarios.benches[0] * totalBytes / 1024 / 1024 + "MB/s" );
-  console.log("Throughput for serialize: " 
+  console.log("Throughput for serialize: "
     + senarios.benches[1] * totalBytes / 1024 / 1024 + "MB/s" );
   console.log("");
 });

+ 9 - 8
benchmarks/php/PhpBenchmark.php

@@ -1,6 +1,7 @@
 <?php
 
 namespace Google\Protobuf\Benchmark;
+ini_set('memory_limit', '4096M');
 
 const NAME = "PhpBenchmark.php";
 
@@ -32,7 +33,7 @@ class BenchmarkMethod
             (new $args[1]())->mergeFromString($payloads->offsetGet($i));
         }
     }
-    
+
     // $args: array of message
     static function serialize(&$args) {
         foreach ($args as &$temp_message) {
@@ -48,7 +49,7 @@ class Benchmark
     private $benchmark_time;
     private $total_bytes;
     private $coefficient;
-    
+
     public function __construct($benchmark_name, $args, $total_bytes,
         $benchmark_time = 5.0) {
             $this->args = $args;
@@ -57,15 +58,15 @@ class Benchmark
             $this->total_bytes = $total_bytes;
             $this->coefficient = pow (10, 0) / pow(2, 20);
     }
-    
+
     public function runBenchmark() {
         $t = $this->runBenchmarkWithTimes(1);
         $times = ceil($this->benchmark_time / $t);
         return $this->total_bytes * $times /
-        $this->runBenchmarkWithTimes($times) *
+        ($times == 1 ? $t : $this->runBenchmarkWithTimes($times)) *
         $this->coefficient;
     }
-    
+
     private function runBenchmarkWithTimes($times) {
         $st = microtime(true);
         for ($i = 0; $i < $times; $i++) {
@@ -108,14 +109,14 @@ function runBenchmark($file, $behavior_prefix) {
         array_push($message_list, $new_message);
         $total_bytes += strlen($payloads->offsetGet($i));
     }
-    
+
     $parse_benchmark = new Benchmark(
         "\Google\Protobuf\Benchmark\BenchmarkMethod::parse",
         array($dataset, $message_name), $total_bytes);
     $serialize_benchmark = new Benchmark(
         "\Google\Protobuf\Benchmark\BenchmarkMethod::serialize",
         $message_list, $total_bytes);
-    
+
     return array(
         "filename" => $file,
         "benchmarks" => array(
@@ -138,7 +139,7 @@ foreach ($argv as $index => $arg) {
     if ($arg == "--json") {
         $json_output = true;
     } else if (strpos($arg, "--behavior_prefix") == 0) {
-        $behavior_prefix = str_replace("--behavior_prefix=", "", $arg);     
+        $behavior_prefix = str_replace("--behavior_prefix=", "", $arg);
     }
 }
 

+ 5 - 5
benchmarks/protobuf.js/protobufjs_benchmark.js

@@ -30,7 +30,7 @@ process.argv.forEach(function(filename, index) {
     messageList.push(message.decode(onePayload));
     totalBytes += onePayload.length;
   });
-  
+
   var senarios = benchmarkSuite.newBenchmark(
     benchmarkDataset.messageName, filename, "protobufjs");
   senarios.suite
@@ -38,14 +38,14 @@ process.argv.forEach(function(filename, index) {
     benchmarkDataset.payload.forEach(function(onePayload) {
       var protoType = getNewPrototype(benchmarkDataset.messageName);
       protoType.decode(onePayload);
-    });    
+    });
   })
   .add("protobuf.js static encoding", function() {
     var protoType = getNewPrototype(benchmarkDataset.messageName);
     messageList.forEach(function(message) {
       protoType.encode(message).finish();
     });
-  }) 
+  })
   .run({"Async": false});
 
   results.push({
@@ -56,9 +56,9 @@ process.argv.forEach(function(filename, index) {
     }
   })
 
-  console.log("Throughput for decoding: " 
+  console.log("Throughput for decoding: "
     + senarios.benches[0] * totalBytes / 1024 / 1024 + "MB/s" );
-  console.log("Throughput for encoding: " 
+  console.log("Throughput for encoding: "
     + senarios.benches[1] * totalBytes / 1024 / 1024 + "MB/s" );
   console.log("");
 });

+ 8 - 7
benchmarks/python/py_benchmark.py

@@ -8,7 +8,7 @@ import fnmatch
 import json
 
 parser = argparse.ArgumentParser(description="Python protobuf benchmark")
-parser.add_argument("data_files", metavar="dataFile", nargs="+", 
+parser.add_argument("data_files", metavar="dataFile", nargs="+",
                     help="testing data files.")
 parser.add_argument("--json", action="store_const", dest="json",
                     const="yes", default="no",
@@ -134,17 +134,18 @@ class Benchmark:
     t = self.dry_run(test_method_args, setup_method_args);
     if t < 3 :
       reps = int(math.ceil(3 / t)) * self.full_iteration
-    t = timeit.timeit(stmt="%s(%s)" % (self.test_method, test_method_args),
-                      setup=self.full_setup_code(setup_method_args),
-                      number=reps);
-    return self.total_bytes * 1.0 / 2 ** 20 / (1.0 * t / reps)
-  
+    if reps != self.full_iteration:
+        t = timeit.timeit(stmt="%s(%s)" % (self.test_method, test_method_args),
+                          setup=self.full_setup_code(setup_method_args),
+                          number=reps);
+    return self.total_bytes * 1.0 / 2 ** 20 / (1.0 * t / reps * self.full_iteration)
+
 
 if __name__ == "__main__":
   results = []
   for file in args.data_files:
     results.append(run_one_test(file))
-  
+
   if args.json != "no":
     print(json.dumps(results))
   else:

+ 3 - 3
benchmarks/util/result_parser.py

@@ -29,7 +29,7 @@ def __get_data_size(filename):
 
 
 def __extract_file_name(file_name):
-  name_list = re.split("[/\.]", file_name)
+  name_list = re.split(r"[/\.]", file_name)
   short_file_name = ""
   for name in name_list:
     if name[:14] == "google_message":
@@ -213,7 +213,7 @@ def __parse_go_result(filename):
     filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename
   with open(filename) as f:
     for line in f:
-      result_list = re.split("[\ \t]+", line)
+      result_list = re.split(r"[\ \t]+", line)
       if result_list[0][:9] != "Benchmark":
         continue
       first_slash_index = result_list[0].find('/')
@@ -295,6 +295,6 @@ def get_result_from_file(cpp_file="",
   if php_file != "":
     __parse_php_result(php_file, "php")
   if php_c_file != "":
-    __parse_php_result(php_c_file, "php")        
+    __parse_php_result(php_c_file, "php")
 
   return __results

+ 6 - 6
benchmarks/util/result_uploader.py

@@ -60,13 +60,13 @@ def upload_result(result_list, metadata):
     new_result["labels"] = labels_string[1:]
     new_result["timestamp"] = _INITIAL_TIME
     print(labels_string)
- 
-     bq = big_query_utils.create_big_query()
-     row = big_query_utils.make_row(str(uuid.uuid4()), new_result)
-     if not big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET,
+
+    bq = big_query_utils.create_big_query()
+    row = big_query_utils.make_row(str(uuid.uuid4()), new_result)
+    if not big_query_utils.insert_rows(bq, _PROJECT_ID, _DATASET,
                                         _TABLE + "$" + _NOW,
                                         [row]):
-       print('Error when uploading result', new_result)
+      print('Error when uploading result', new_result)
 
 
 if __name__ == "__main__":
@@ -91,7 +91,7 @@ if __name__ == "__main__":
                       default="")
   parser.add_argument("-php_c", "--php_c_input_file",
                       help="The php with c ext benchmark result file's name",
-                      default="")    
+                      default="")
   args = parser.parse_args()
 
   metadata = get_metadata()

+ 8 - 3
cmake/CMakeLists.txt

@@ -68,23 +68,28 @@ string(REGEX REPLACE        "${protobuf_AC_INIT_REGEX}" "\\2"
 string(REGEX REPLACE        "${protobuf_AC_INIT_REGEX}" "\\3"
     protobuf_CONTACT        "${protobuf_AC_INIT_LINE}")
 # Parse version tweaks
-set(protobuf_VERSION_REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9]+)-?(.*)$")
+set(protobuf_VERSION_REGEX "^([0-9]+)\\.([0-9]+)\\.([0-9]+)([-]rc[-]|\\.)?([0-9]*)$")
 string(REGEX REPLACE     "${protobuf_VERSION_REGEX}" "\\1"
   protobuf_VERSION_MAJOR "${protobuf_VERSION_STRING}")
 string(REGEX REPLACE     "${protobuf_VERSION_REGEX}" "\\2"
   protobuf_VERSION_MINOR "${protobuf_VERSION_STRING}")
 string(REGEX REPLACE     "${protobuf_VERSION_REGEX}" "\\3"
   protobuf_VERSION_PATCH "${protobuf_VERSION_STRING}")
-string(REGEX REPLACE     "${protobuf_VERSION_REGEX}" "\\4"
+string(REGEX REPLACE     "${protobuf_VERSION_REGEX}" "\\5"
   protobuf_VERSION_PRERELEASE "${protobuf_VERSION_STRING}")
 
+message(STATUS "${protobuf_VERSION_PRERELEASE}")
+
 # Package version
 set(protobuf_VERSION
   "${protobuf_VERSION_MAJOR}.${protobuf_VERSION_MINOR}.${protobuf_VERSION_PATCH}")
 
 if(protobuf_VERSION_PRERELEASE)
-  set(protobuf_VERSION "${protobuf_VERSION}-${protobuf_VERSION_PRERELEASE}")
+  set(protobuf_VERSION "${protobuf_VERSION}.${protobuf_VERSION_PRERELEASE}")
+else()
+  set(protobuf_VERSION "${protobuf_VERSION}.0")
 endif()
+message(STATUS "${protobuf_VERSION}")
 
 if(protobuf_VERBOSE)
   message(STATUS "Configuration script parsing status [")

+ 11 - 4
cmake/README.md

@@ -130,6 +130,13 @@ It will generate *Visual Studio* solution file *protobuf.sln* in current directo
 If the *gmock* directory does not exist, and you do not want to build protobuf unit tests,
 you need to add *cmake* command argument `-Dprotobuf_BUILD_TESTS=OFF` to disable testing.
 
+To make a *Visual Studio* file for Visual Studio 15 2017, create the *Visual Studio*
+solution file above and edit the CmakeCache file.
+
+	C:Path\to\protobuf\cmake\build\solution\CMakeCache
+
+Then create the *Visual Studio* solution file again
+
 Compiling
 =========
 
@@ -170,9 +177,9 @@ You should see output similar to:
 
      Running main() from gmock_main.cc
      [==========] Running 1546 tests from 165 test cases.
-     
+
      ...
-     
+
      [==========] 1546 tests from 165 test cases ran. (2529 ms total)
      [  PASSED  ] 1546 tests.
 
@@ -191,7 +198,7 @@ To run specific tests:
      [ RUN      ] AnyTest.TestIs
      [       OK ] AnyTest.TestIs (0 ms)
      [----------] 3 tests from AnyTest (1 ms total)
-     
+
      [----------] Global test environment tear-down
      [==========] 3 tests from 1 test case ran. (2 ms total)
      [  PASSED  ] 3 tests.
@@ -303,7 +310,7 @@ If you already have ZLIB library and headers at some other location on your syst
 
 	-DZLIB_INCLUDE_DIR=<path to dir containing zlib headers>
 	-DZLIB_LIB=<path to dir containing zlib>
-	
+
 Build and testing protobuf as usual.
 
 Notes on Compiler Warnings

+ 3 - 1
cmake/conformance.cmake

@@ -21,7 +21,9 @@ add_custom_command(
 add_executable(conformance_test_runner
   ${protobuf_source_dir}/conformance/conformance.pb.cc
   ${protobuf_source_dir}/conformance/conformance_test.cc
-  ${protobuf_source_dir}/conformance/conformance_test_impl.cc
+  ${protobuf_source_dir}/conformance/binary_json_conformance_main.cc
+  ${protobuf_source_dir}/conformance/binary_json_conformance_suite.cc
+  ${protobuf_source_dir}/conformance/binary_json_conformance_suite.h
   ${protobuf_source_dir}/conformance/conformance_test_runner.cc
   ${protobuf_source_dir}/conformance/third_party/jsoncpp/json.h
   ${protobuf_source_dir}/conformance/third_party/jsoncpp/jsoncpp.cpp

+ 4 - 2
cmake/extract_includes.bat.in

@@ -44,6 +44,7 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.pb.h" includ
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\dynamic_message.h" include\google\protobuf\dynamic_message.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\empty.pb.h" include\google\protobuf\empty.pb.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set.h" include\google\protobuf\extension_set.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\extension_set_inl.h" include\google\protobuf\extension_set_inl.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\field_mask.pb.h" include\google\protobuf\field_mask.pb.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_reflection.h" include\google\protobuf\generated_enum_reflection.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_enum_util.h" include\google\protobuf\generated_enum_util.h
@@ -72,6 +73,7 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message.h" include\go
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\message_lite.h" include\google\protobuf\message_lite.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata.h" include\google\protobuf\metadata.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\metadata_lite.h" include\google\protobuf\metadata_lite.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\parse_context.h" include\google\protobuf\parse_context.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port.h" include\google\protobuf\port.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port_def.inc" include\google\protobuf\port_def.inc
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\port_undef.inc" include\google\protobuf\port_undef.inc
@@ -87,16 +89,17 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\casts.h" includ
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\common.h" include\google\protobuf\stubs\common.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\fastmem.h" include\google\protobuf\stubs\fastmem.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\hash.h" include\google\protobuf\stubs\hash.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\io_win32.h" include\google\protobuf\stubs\io_win32.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\logging.h" include\google\protobuf\stubs\logging.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\macros.h" include\google\protobuf\stubs\macros.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\mutex.h" include\google\protobuf\stubs\mutex.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\once.h" include\google\protobuf\stubs\once.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\platform_macros.h" include\google\protobuf\stubs\platform_macros.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\port.h" include\google\protobuf\stubs\port.h
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\singleton.h" include\google\protobuf\stubs\singleton.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\status.h" include\google\protobuf\stubs\status.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stl_util.h" include\google\protobuf\stubs\stl_util.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\stringpiece.h" include\google\protobuf\stubs\stringpiece.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\strutil.h" include\google\protobuf\stubs\strutil.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\template_util.h" include\google\protobuf\stubs\template_util.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\text_format.h" include\google\protobuf\text_format.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\timestamp.pb.h" include\google\protobuf\timestamp.pb.h
@@ -112,7 +115,6 @@ copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver.h"
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\util\type_resolver_util.h" include\google\protobuf\util\type_resolver_util.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format.h" include\google\protobuf\wire_format.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite.h" include\google\protobuf\wire_format_lite.h
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wire_format_lite_inl.h" include\google\protobuf\wire_format_lite_inl.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\wrappers.pb.h" include\google\protobuf\wrappers.pb.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\any.proto" include\google\protobuf\any.proto
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\api.proto" include\google\protobuf\api.proto

+ 9 - 2
cmake/libprotobuf-lite.cmake

@@ -1,19 +1,23 @@
 set(libprotobuf_lite_files
+  ${protobuf_source_dir}/src/google/protobuf/any_lite.cc
   ${protobuf_source_dir}/src/google/protobuf/arena.cc
-  ${protobuf_source_dir}/src/google/protobuf/arenastring.cc
   ${protobuf_source_dir}/src/google/protobuf/extension_set.cc
+  ${protobuf_source_dir}/src/google/protobuf/generated_enum_util.cc
   ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.cc
   ${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc
   ${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.cc
   ${protobuf_source_dir}/src/google/protobuf/io/coded_stream.cc
+  ${protobuf_source_dir}/src/google/protobuf/io/io_win32.cc
+  ${protobuf_source_dir}/src/google/protobuf/io/strtod.cc
   ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.cc
+   ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.cc
   ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
   ${protobuf_source_dir}/src/google/protobuf/message_lite.cc
+  ${protobuf_source_dir}/src/google/protobuf/parse_context.cc
   ${protobuf_source_dir}/src/google/protobuf/repeated_field.cc
   ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.cc
   ${protobuf_source_dir}/src/google/protobuf/stubs/common.cc
   ${protobuf_source_dir}/src/google/protobuf/stubs/int128.cc
-  ${protobuf_source_dir}/src/google/protobuf/stubs/io_win32.cc
   ${protobuf_source_dir}/src/google/protobuf/stubs/status.cc
   ${protobuf_source_dir}/src/google/protobuf/stubs/statusor.cc
   ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.cc
@@ -30,8 +34,11 @@ set(libprotobuf_lite_includes
   ${protobuf_source_dir}/src/google/protobuf/extension_set.h
   ${protobuf_source_dir}/src/google/protobuf/generated_message_util.h
   ${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.h
+  ${protobuf_source_dir}/src/google/protobuf/parse_context.h
   ${protobuf_source_dir}/src/google/protobuf/io/coded_stream.h
+  ${protobuf_source_dir}/src/google/protobuf/io/strtod.h
   ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.h
+  ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.h
   ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.h
   ${protobuf_source_dir}/src/google/protobuf/message_lite.h
   ${protobuf_source_dir}/src/google/protobuf/repeated_field.h

+ 0 - 4
cmake/libprotobuf.cmake

@@ -16,9 +16,7 @@ set(libprotobuf_files
   ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.cc
   ${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.cc
   ${protobuf_source_dir}/src/google/protobuf/io/printer.cc
-  ${protobuf_source_dir}/src/google/protobuf/io/strtod.cc
   ${protobuf_source_dir}/src/google/protobuf/io/tokenizer.cc
-  ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.cc
   ${protobuf_source_dir}/src/google/protobuf/map_field.cc
   ${protobuf_source_dir}/src/google/protobuf/message.cc
   ${protobuf_source_dir}/src/google/protobuf/reflection_ops.cc
@@ -72,9 +70,7 @@ set(libprotobuf_includes
   ${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.h
   ${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.h
   ${protobuf_source_dir}/src/google/protobuf/io/printer.h
-  ${protobuf_source_dir}/src/google/protobuf/io/strtod.h
   ${protobuf_source_dir}/src/google/protobuf/io/tokenizer.h
-  ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.h
   ${protobuf_source_dir}/src/google/protobuf/map_field.h
   ${protobuf_source_dir}/src/google/protobuf/message.h
   ${protobuf_source_dir}/src/google/protobuf/reflection_ops.h

+ 1 - 1
cmake/libprotoc.cmake

@@ -78,7 +78,6 @@ set(libprotoc_files
   ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.cc
   ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.cc
   ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.cc
-  ${protobuf_source_dir}/src/google/protobuf/compiler/scc.cc
   ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.cc
   ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.cc
 )
@@ -152,6 +151,7 @@ set(libprotoc_headers
   ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_map_field.h
   ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message.h
   ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_message_field.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_nsobject_methods.h
   ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_oneof.h
   ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_primitive_field.h
   ${protobuf_source_dir}/src/google/protobuf/compiler/scc.h

+ 1 - 1
cmake/protobuf-config.cmake.in

@@ -37,7 +37,7 @@ function(protobuf_generate)
   if(NOT protobuf_generate_PROTOC_OUT_DIR)
     set(protobuf_generate_PROTOC_OUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
   endif()
-  
+
   if(protobuf_generate_EXPORT_MACRO AND protobuf_generate_LANGUAGE STREQUAL cpp)
     set(_dll_export_decl "dllexport_decl=${protobuf_generate_EXPORT_MACRO}:")
   endif()

+ 1 - 1
cmake/protoc.cmake

@@ -9,7 +9,7 @@ set(protoc_rc_files
 endif()
 
 add_executable(protoc ${protoc_files} ${protoc_rc_files})
-target_link_libraries(protoc libprotobuf libprotoc)
+target_link_libraries(protoc libprotoc libprotobuf)
 add_executable(protobuf::protoc ALIAS protoc)
 
 set_target_properties(protoc PROPERTIES

+ 1 - 1
cmake/tests.cmake

@@ -156,6 +156,7 @@ set(tests_files
   ${protobuf_source_dir}/src/google/protobuf/extension_set_unittest.cc
   ${protobuf_source_dir}/src/google/protobuf/generated_message_reflection_unittest.cc
   ${protobuf_source_dir}/src/google/protobuf/io/coded_stream_unittest.cc
+  ${protobuf_source_dir}/src/google/protobuf/io/io_win32_unittest.cc
   ${protobuf_source_dir}/src/google/protobuf/io/printer_unittest.cc
   ${protobuf_source_dir}/src/google/protobuf/io/tokenizer_unittest.cc
   ${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_unittest.cc
@@ -175,7 +176,6 @@ set(tests_files
   ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream_unittest.cc
   ${protobuf_source_dir}/src/google/protobuf/stubs/common_unittest.cc
   ${protobuf_source_dir}/src/google/protobuf/stubs/int128_unittest.cc
-  ${protobuf_source_dir}/src/google/protobuf/stubs/io_win32_unittest.cc
   ${protobuf_source_dir}/src/google/protobuf/stubs/status_test.cc
   ${protobuf_source_dir}/src/google/protobuf/stubs/statusor_test.cc
   ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece_unittest.cc

+ 3 - 3
cmake/version.rc.in

@@ -15,15 +15,15 @@
 
 
 VS_VERSION_INFO VERSIONINFO
-  FILEVERSION    @protobuf_RC_FILEVERSION@,0
-  PRODUCTVERSION @protobuf_RC_FILEVERSION@,0
+  FILEVERSION    @protobuf_RC_FILEVERSION@
+  PRODUCTVERSION @protobuf_RC_FILEVERSION@
   FILEFLAGSMASK  VS_FFI_FILEFLAGSMASK
   FILEFLAGS      VER_DEBUG
   FILEOS         VOS__WINDOWS32
   FILETYPE       VFT_DLL
 BEGIN
     BLOCK "VarFileInfo"
-    BEGIN 
+    BEGIN
         // English language (0x409) and the Windows Unicode codepage (1200)
         VALUE "Translation", 0x409, 1200
     END

+ 5 - 12
configure.ac

@@ -17,7 +17,7 @@ AC_PREREQ(2.59)
 # In the SVN trunk, the version should always be the next anticipated release
 # version with the "-pre" suffix.  (We used to use "-SNAPSHOT" but this pushed
 # the size of one file name in the dist tarfile over the 99-char limit.)
-AC_INIT([Protocol Buffers],[3.6.1],[protobuf@googlegroups.com],[protobuf])
+AC_INIT([Protocol Buffers],[3.7.1],[protobuf@googlegroups.com],[protobuf])
 
 AM_MAINTAINER_MODE([enable])
 
@@ -165,6 +165,10 @@ AS_IF([test "$with_zlib" != no], [
 ])
 AM_CONDITIONAL([HAVE_ZLIB], [test $HAVE_ZLIB = 1])
 
+# Add -std=c++11 if necesssary. It is important for us to do this before the
+# libatomic check below, since that also depends on C++11.
+AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
+
 dnl On some platforms, std::atomic needs a helper library
 AC_MSG_CHECKING(whether -latomic is needed)
 AC_LINK_IFELSE([AC_LANG_SOURCE([[
@@ -205,15 +209,6 @@ AM_CONDITIONAL([HAVE_PTHREAD], [test "x$ax_pthread_ok" = "xyes"])
 # We still keep this for improving pbconfig.h for unsupported platforms.
 AC_CXX_STL_HASH
 
-case "$target_os" in
-  mingw* | cygwin* | win* | aix* | *android* )
-    ;;
-  *)
-    # Need to link against rt on Solaris
-    AC_SEARCH_LIBS([sched_yield], [rt], [], [AC_MSG_FAILURE([sched_yield was not found on your system])])
-    ;;
-esac
-
 # Enable ObjC support for conformance directory on OS X.
 OBJC_CONFORMANCE_TEST=0
 case "$target_os" in
@@ -223,8 +218,6 @@ case "$target_os" in
 esac
 AM_CONDITIONAL([OBJC_CONFORMANCE_TEST], [test $OBJC_CONFORMANCE_TEST = 1])
 
-AX_CXX_COMPILE_STDCXX([11], [noext], [mandatory])
-
 # HACK:  Make gmock's configure script pick up our copy of CFLAGS and CXXFLAGS,
 #   since the flags added by ACX_CHECK_SUNCC must be used when compiling gmock
 #   too.

+ 47 - 14
conformance/ConformanceJava.java

@@ -1,16 +1,17 @@
-import com.google.protobuf.ByteString;
 import com.google.protobuf.AbstractMessage;
-import com.google.protobuf.Parser;
+import com.google.protobuf.ByteString;
 import com.google.protobuf.CodedInputStream;
-import com.google.protobuf.conformance.Conformance;
-import com.google.protobuf.InvalidProtocolBufferException;
-import com.google.protobuf_test_messages.proto3.TestMessagesProto3;
-import com.google.protobuf_test_messages.proto3.TestMessagesProto3.TestAllTypesProto3;
-import com.google.protobuf_test_messages.proto2.TestMessagesProto2;
-import com.google.protobuf_test_messages.proto2.TestMessagesProto2.TestAllTypesProto2;
 import com.google.protobuf.ExtensionRegistry;
+import com.google.protobuf.InvalidProtocolBufferException;
+import com.google.protobuf.Parser;
+import com.google.protobuf.TextFormat;
+import com.google.protobuf.conformance.Conformance;
 import com.google.protobuf.util.JsonFormat;
 import com.google.protobuf.util.JsonFormat.TypeRegistry;
+import com.google.protobuf_test_messages.proto2.TestMessagesProto2;
+import com.google.protobuf_test_messages.proto2.TestMessagesProto2.TestAllTypesProto2;
+import com.google.protobuf_test_messages.proto3.TestMessagesProto3;
+import com.google.protobuf_test_messages.proto3.TestMessagesProto3.TestAllTypesProto3;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 
@@ -56,7 +57,7 @@ class ConformanceJava {
     buf[3] = (byte)(val >> 24);
     writeToStdout(buf);
   }
-  
+
   private enum BinaryDecoderType {
     BTYE_STRING_DECODER,
     BYTE_ARRAY_DECODER,
@@ -68,11 +69,11 @@ class ConformanceJava {
   }
 
   private static class BinaryDecoder <MessageType extends AbstractMessage> {
-    public MessageType decode (ByteString bytes, BinaryDecoderType type, 
+    public MessageType decode (ByteString bytes, BinaryDecoderType type,
         Parser <MessageType> parser, ExtensionRegistry extensions)
       throws InvalidProtocolBufferException {
       switch (type) {
-        case BTYE_STRING_DECODER: 
+        case BTYE_STRING_DECODER:
           return parser.parseFrom(bytes, extensions);
         case BYTE_ARRAY_DECODER:
           return parser.parseFrom(bytes.toByteArray(), extensions);
@@ -93,7 +94,7 @@ class ConformanceJava {
           } catch (InvalidProtocolBufferException e) {
             throw e;
           }
-        } 
+        }
         case DIRECT_BYTE_BUFFER_DECODER: {
           ByteBuffer buffer = ByteBuffer.allocateDirect(bytes.size());
           bytes.copyTo(buffer);
@@ -134,7 +135,7 @@ class ConformanceJava {
     ArrayList <MessageType> messages = new ArrayList <MessageType> ();
     ArrayList <InvalidProtocolBufferException> exceptions =
         new ArrayList <InvalidProtocolBufferException>();
-    
+
     for (int i = 0; i < BinaryDecoderType.values().length; i++) {
       messages.add(null);
       exceptions.add(null);
@@ -247,6 +248,34 @@ class ConformanceJava {
         }
         break;
       }
+      case TEXT_PAYLOAD: {
+        if (isProto3) {
+          try {
+            TestMessagesProto3.TestAllTypesProto3.Builder builder =
+                TestMessagesProto3.TestAllTypesProto3.newBuilder();
+            TextFormat.merge(request.getTextPayload(), builder);
+            testMessage = builder.build();
+          } catch (TextFormat.ParseException e) {
+              return Conformance.ConformanceResponse.newBuilder()
+                  .setParseError(e.getMessage())
+                  .build();
+          }
+        } else if (isProto2) {
+          try {
+            TestMessagesProto2.TestAllTypesProto2.Builder builder =
+                TestMessagesProto2.TestAllTypesProto2.newBuilder();
+            TextFormat.merge(request.getTextPayload(), builder);
+            testMessage = builder.build();
+          } catch (TextFormat.ParseException e) {
+              return Conformance.ConformanceResponse.newBuilder()
+                  .setParseError(e.getMessage())
+                  .build();
+          }
+        } else {
+          throw new RuntimeException("Protobuf request doesn't have specific payload type.");
+        }
+        break;
+      }
       case PAYLOAD_NOT_SET: {
         throw new RuntimeException("Request didn't have payload.");
       }
@@ -261,7 +290,7 @@ class ConformanceJava {
         throw new RuntimeException("Unspecified output format.");
 
       case PROTOBUF: {
-        ByteString MessageString = testMessage.toByteString(); 
+        ByteString MessageString = testMessage.toByteString();
         return Conformance.ConformanceResponse.newBuilder().setProtobufPayload(MessageString).build();
       }
 
@@ -274,6 +303,10 @@ class ConformanceJava {
               e.getMessage()).build();
         }
 
+      case TEXT_FORMAT:
+        return Conformance.ConformanceResponse.newBuilder().setTextPayload(
+            TextFormat.printToString(testMessage)).build();
+
       default: {
         throw new RuntimeException("Unexpected request output.");
       }

+ 17 - 9
conformance/Makefile.am

@@ -107,6 +107,7 @@ other_language_protoc_outputs =                                \
   google/protobuf/wrappers_pb2.py                              \
   Conformance/ConformanceRequest.php                           \
   Conformance/ConformanceResponse.php                          \
+  Conformance/FailureSet.php                                   \
   Conformance/WireFormat.php                                   \
   GPBMetadata/Conformance.php                                  \
   GPBMetadata/Google/Protobuf/Any.php                          \
@@ -206,7 +207,11 @@ EXTRA_DIST =                  \
 
 conformance_test_runner_LDADD = $(top_srcdir)/src/libprotobuf.la
 conformance_test_runner_SOURCES = conformance_test.h conformance_test.cc \
-                                  conformance_test_impl.cc               \
+                                  conformance_test_main.cc               \
+                                  binary_json_conformance_suite.h        \
+                                  binary_json_conformance_suite.cc       \
+                                  text_format_conformance_suite.h        \
+                                  text_format_conformance_suite.cc       \
                                   conformance_test_runner.cc             \
                                   third_party/jsoncpp/json.h             \
                                   third_party/jsoncpp/jsoncpp.cpp
@@ -311,7 +316,7 @@ conformance-java-lite: javac_middleman_lite
 conformance-csharp: $(other_language_protoc_outputs)
 	@echo "Writing shortcut script conformance-csharp..."
 	@echo '#! /bin/sh' > conformance-csharp
-	@echo 'dotnet ../csharp/src/Google.Protobuf.Conformance/bin/Release/netcoreapp1.0/Google.Protobuf.Conformance.dll "$$@"' >> conformance-csharp
+	@echo 'dotnet ../csharp/src/Google.Protobuf.Conformance/bin/Release/netcoreapp2.1/Google.Protobuf.Conformance.dll "$$@"' >> conformance-csharp
 	@chmod +x conformance-csharp
 
 conformance-php:
@@ -331,30 +336,33 @@ test_cpp: protoc_middleman conformance-test-runner conformance-cpp
 	./conformance-test-runner --enforce_recommended --failure_list failure_list_cpp.txt ./conformance-cpp
 
 test_java: protoc_middleman conformance-test-runner conformance-java
-	./conformance-test-runner --enforce_recommended --failure_list failure_list_java.txt ./conformance-java
+	./conformance-test-runner --enforce_recommended --failure_list failure_list_java.txt --text_format_failure_list text_format_failure_list_java.txt ./conformance-java
 
 test_java_lite: protoc_middleman conformance-test-runner conformance-java-lite
 	./conformance-test-runner --enforce_recommended ./conformance-java-lite
 
 test_csharp: protoc_middleman conformance-test-runner conformance-csharp
-	./conformance-test-runner --enforce_recommended --failure_list failure_list_csharp.txt ./conformance-csharp
+	./conformance-test-runner --enforce_recommended --failure_list failure_list_csharp.txt --text_format_failure_list text_format_failure_list_csharp.txt ./conformance-csharp
 
 test_ruby: protoc_middleman conformance-test-runner $(other_language_protoc_outputs)
-	RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt ./conformance_ruby.rb
+	RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb
+
+test_ruby_mac: protoc_middleman conformance-test-runner $(other_language_protoc_outputs)
+	RUBYLIB=../ruby/lib:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_ruby_mac.txt --text_format_failure_list text_format_failure_list_ruby.txt ./conformance_ruby.rb
 
 test_php: protoc_middleman conformance-test-runner conformance-php $(other_language_protoc_outputs)
-	./conformance-test-runner --enforce_recommended --failure_list failure_list_php.txt ./conformance-php
+	./conformance-test-runner --enforce_recommended --failure_list failure_list_php.txt --text_format_failure_list text_format_failure_list_php.txt ./conformance-php
 
 test_php_c: protoc_middleman conformance-test-runner conformance-php-c $(other_language_protoc_outputs)
-	./conformance-test-runner --enforce_recommended --failure_list failure_list_php_c.txt ./conformance-php-c
+	./conformance-test-runner --enforce_recommended --failure_list failure_list_php_c.txt --text_format_failure_list text_format_failure_list_php.txt ./conformance-php-c
 
 test_php_zts_c: protoc_middleman conformance-test-runner conformance-php-c $(other_language_protoc_outputs)
-	./conformance-test-runner --enforce_recommended --failure_list failure_list_php_zts_c.txt ./conformance-php-c
+	./conformance-test-runner --enforce_recommended --failure_list failure_list_php_zts_c.txt --text_format_failure_list text_format_failure_list_php.txt ./conformance-php-c
 
 # These depend on library paths being properly set up.  The easiest way to
 # run them is to just use "tox" from the python dir.
 test_python: protoc_middleman conformance-test-runner
-	./conformance-test-runner --enforce_recommended --failure_list failure_list_python.txt ./conformance_python.py
+	./conformance-test-runner --enforce_recommended --failure_list failure_list_python.txt --text_format_failure_list text_format_failure_list_python.txt ./conformance_python.py
 
 test_python_cpp: protoc_middleman conformance-test-runner
 	./conformance-test-runner --enforce_recommended --failure_list failure_list_python_cpp.txt ./conformance_python.py

+ 182 - 89
conformance/conformance_test_impl.cc → conformance/binary_json_conformance_suite.cc

@@ -28,6 +28,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+#include "binary_json_conformance_suite.h"
 #include "conformance_test.h"
 #include "third_party/jsoncpp/json.h"
 
@@ -37,11 +38,13 @@
 #include <google/protobuf/stubs/common.h>
 #include <google/protobuf/stubs/strutil.h>
 #include <google/protobuf/text_format.h>
+#include <google/protobuf/util/json_util.h>
 #include <google/protobuf/util/type_resolver_util.h>
 #include <google/protobuf/wire_format_lite.h>
 
 using conformance::ConformanceRequest;
 using conformance::ConformanceResponse;
+using conformance::WireFormat;
 using google::protobuf::Descriptor;
 using google::protobuf::FieldDescriptor;
 using google::protobuf::Message;
@@ -189,73 +192,83 @@ std::unique_ptr<Message> NewTestMessage(bool is_proto3) {
 namespace google {
 namespace protobuf {
 
-class ConformanceTestSuiteImpl : public ConformanceTestSuite {
- public:
-  ConformanceTestSuiteImpl() {}
-
- private:
-  void RunSuiteImpl();
-  void RunValidJsonTest(const string& test_name,
-                        ConformanceLevel level,
-                        const string& input_json,
-                        const string& equivalent_text_format);
-  void RunValidJsonTestWithProtobufInput(
-      const string& test_name,
-      ConformanceLevel level,
-      const protobuf_test_messages::proto3::TestAllTypesProto3& input,
-      const string& equivalent_text_format);
-  void RunValidJsonIgnoreUnknownTest(
-      const string& test_name, ConformanceLevel level, const string& input_json,
-      const string& equivalent_text_format);
-  void RunValidProtobufTest(const string& test_name, ConformanceLevel level,
-                            const string& input_protobuf,
-                            const string& equivalent_text_format,
-                            bool is_proto3);
-  void RunValidBinaryProtobufTest(const string& test_name,
-                                  ConformanceLevel level,
-                                  const string& input_protobuf,
-                                  bool is_proto3);
-  void RunValidProtobufTestWithMessage(
-      const string& test_name, ConformanceLevel level,
-      const Message *input,
-      const string& equivalent_text_format,
-      bool is_proto3);
-
-  typedef std::function<bool(const Json::Value&)> Validator;
-  void RunValidJsonTestWithValidator(const string& test_name,
-                                     ConformanceLevel level,
-                                     const string& input_json,
-                                     const Validator& validator);
-  void ExpectParseFailureForJson(const string& test_name,
-                                 ConformanceLevel level,
-                                 const string& input_json);
-  void ExpectSerializeFailureForJson(const string& test_name,
-                                     ConformanceLevel level,
-                                     const string& text_format);
-  void ExpectParseFailureForProtoWithProtoVersion (const string& proto,
-                                                   const string& test_name,
-                                                   ConformanceLevel level,
-                                                   bool is_proto3);
-  void ExpectParseFailureForProto(const std::string& proto,
-                                  const std::string& test_name,
-                                  ConformanceLevel level);
-  void ExpectHardParseFailureForProto(const std::string& proto,
-                                      const std::string& test_name,
-                                      ConformanceLevel level);
-  void TestPrematureEOFForType(google::protobuf::FieldDescriptor::Type type);
-  void TestIllegalTags();
-  template <class MessageType>
-  void TestOneofMessage (MessageType &message,
-                         bool is_proto3);
-  template <class MessageType>
-  void TestUnknownMessage (MessageType &message,
-                           bool is_proto3);
-  void TestValidDataForType(
-      google::protobuf::FieldDescriptor::Type,
-      std::vector<std::pair<std::string, std::string>> values);
-};
-
-void ConformanceTestSuiteImpl::ExpectParseFailureForProtoWithProtoVersion (
+bool BinaryAndJsonConformanceSuite::ParseJsonResponse(
+    const ConformanceResponse& response,
+    Message* test_message) {
+  string binary_protobuf;
+  util::Status status =
+      JsonToBinaryString(type_resolver_.get(), type_url_,
+                         response.json_payload(), &binary_protobuf);
+
+  if (!status.ok()) {
+    return false;
+  }
+
+  if (!test_message->ParseFromString(binary_protobuf)) {
+    GOOGLE_LOG(FATAL)
+        << "INTERNAL ERROR: internal JSON->protobuf transcode "
+        << "yielded unparseable proto.";
+    return false;
+  }
+
+  return true;
+}
+
+bool BinaryAndJsonConformanceSuite::ParseResponse(
+    const ConformanceResponse& response,
+    const ConformanceRequestSetting& setting,
+    Message* test_message) {
+  const ConformanceRequest& request = setting.GetRequest();
+  WireFormat requested_output = request.requested_output_format();
+  const string& test_name = setting.GetTestName();
+  ConformanceLevel level = setting.GetLevel();
+
+  switch (response.result_case()) {
+    case ConformanceResponse::kProtobufPayload: {
+      if (requested_output != conformance::PROTOBUF) {
+        ReportFailure(
+            test_name, level, request, response,
+            StrCat("Test was asked for ", WireFormatToString(requested_output),
+                   " output but provided PROTOBUF instead.").c_str());
+        return false;
+      }
+
+      if (!test_message->ParseFromString(response.protobuf_payload())) {
+        ReportFailure(test_name, level, request, response,
+                   "Protobuf output we received from test was unparseable.");
+        return false;
+      }
+
+      break;
+    }
+
+    case ConformanceResponse::kJsonPayload: {
+      if (requested_output != conformance::JSON) {
+        ReportFailure(
+            test_name, level, request, response,
+            StrCat("Test was asked for ", WireFormatToString(requested_output),
+                   " output but provided JSON instead.").c_str());
+        return false;
+      }
+
+      if (!ParseJsonResponse(response, test_message)) {
+        ReportFailure(test_name, level, request, response,
+                      "JSON output we received from test was unparseable.");
+        return false;
+      }
+
+      break;
+    }
+
+    default:
+      GOOGLE_LOG(FATAL) << test_name << ": unknown payload type: "
+                        << response.result_case();
+  }
+
+  return true;
+}
+
+void BinaryAndJsonConformanceSuite::ExpectParseFailureForProtoWithProtoVersion (
     const string& proto, const string& test_name, ConformanceLevel level,
     bool is_proto3) {
   std::unique_ptr<Message> prototype = NewTestMessage(is_proto3);
@@ -285,7 +298,7 @@ void ConformanceTestSuiteImpl::ExpectParseFailureForProtoWithProtoVersion (
 }
 
 // Expect that this precise protobuf will cause a parse error.
-void ConformanceTestSuiteImpl::ExpectParseFailureForProto(
+void BinaryAndJsonConformanceSuite::ExpectParseFailureForProto(
     const string& proto, const string& test_name, ConformanceLevel level) {
   ExpectParseFailureForProtoWithProtoVersion(proto, test_name, level, true);
   ExpectParseFailureForProtoWithProtoVersion(proto, test_name, level, false);
@@ -296,12 +309,12 @@ void ConformanceTestSuiteImpl::ExpectParseFailureForProto(
 // data verbatim and once with this data followed by some valid data.
 //
 // TODO(haberman): implement the second of these.
-void ConformanceTestSuiteImpl::ExpectHardParseFailureForProto(
+void BinaryAndJsonConformanceSuite::ExpectHardParseFailureForProto(
     const string& proto, const string& test_name, ConformanceLevel level) {
   return ExpectParseFailureForProto(proto, test_name, level);
 }
 
-void ConformanceTestSuiteImpl::RunValidJsonTest(
+void BinaryAndJsonConformanceSuite::RunValidJsonTest(
     const string& test_name, ConformanceLevel level, const string& input_json,
     const string& equivalent_text_format) {
   TestAllTypesProto3 prototype;
@@ -317,7 +330,7 @@ void ConformanceTestSuiteImpl::RunValidJsonTest(
   RunValidInputTest(setting2, equivalent_text_format);
 }
 
-void ConformanceTestSuiteImpl::RunValidJsonTestWithProtobufInput(
+void BinaryAndJsonConformanceSuite::RunValidJsonTestWithProtobufInput(
     const string& test_name, ConformanceLevel level, const TestAllTypesProto3& input,
     const string& equivalent_text_format) {
   ConformanceRequestSetting setting(
@@ -327,7 +340,7 @@ void ConformanceTestSuiteImpl::RunValidJsonTestWithProtobufInput(
   RunValidInputTest(setting, equivalent_text_format);
 }
 
-void ConformanceTestSuiteImpl::RunValidJsonIgnoreUnknownTest(
+void BinaryAndJsonConformanceSuite::RunValidJsonIgnoreUnknownTest(
     const string& test_name, ConformanceLevel level, const string& input_json,
     const string& equivalent_text_format) {
   TestAllTypesProto3 prototype;
@@ -338,7 +351,7 @@ void ConformanceTestSuiteImpl::RunValidJsonIgnoreUnknownTest(
   RunValidInputTest(setting, equivalent_text_format);
 }
 
-void ConformanceTestSuiteImpl::RunValidProtobufTest(
+void BinaryAndJsonConformanceSuite::RunValidProtobufTest(
     const string& test_name, ConformanceLevel level,
     const string& input_protobuf, const string& equivalent_text_format,
     bool is_proto3) {
@@ -359,7 +372,7 @@ void ConformanceTestSuiteImpl::RunValidProtobufTest(
   }
 }
 
-void ConformanceTestSuiteImpl::RunValidBinaryProtobufTest(
+void BinaryAndJsonConformanceSuite::RunValidBinaryProtobufTest(
     const string& test_name, ConformanceLevel level,
     const string& input_protobuf, bool is_proto3) {
   std::unique_ptr<Message> prototype = NewTestMessage(is_proto3);
@@ -370,7 +383,7 @@ void ConformanceTestSuiteImpl::RunValidBinaryProtobufTest(
   RunValidBinaryInputTest(setting, input_protobuf);
 }
 
-void ConformanceTestSuiteImpl::RunValidProtobufTestWithMessage(
+void BinaryAndJsonConformanceSuite::RunValidProtobufTestWithMessage(
     const string& test_name, ConformanceLevel level, const Message *input,
     const string& equivalent_text_format, bool is_proto3) {
   RunValidProtobufTest(test_name, level, input->SerializeAsString(),
@@ -382,7 +395,7 @@ void ConformanceTestSuiteImpl::RunValidProtobufTestWithMessage(
 // numbers while the parser is allowed to accept them as JSON strings). This
 // method allows strict checking on a proto3 JSON serializer by inspecting
 // the JSON output directly.
-void ConformanceTestSuiteImpl::RunValidJsonTestWithValidator(
+void BinaryAndJsonConformanceSuite::RunValidJsonTestWithValidator(
     const string& test_name, ConformanceLevel level, const string& input_json,
     const Validator& validator) {
   TestAllTypesProto3 prototype;
@@ -426,7 +439,7 @@ void ConformanceTestSuiteImpl::RunValidJsonTestWithValidator(
   ReportSuccess(effective_test_name);
 }
 
-void ConformanceTestSuiteImpl::ExpectParseFailureForJson(
+void BinaryAndJsonConformanceSuite::ExpectParseFailureForJson(
     const string& test_name, ConformanceLevel level, const string& input_json) {
   TestAllTypesProto3 prototype;
   // We don't expect output, but if the program erroneously accepts the protobuf
@@ -452,7 +465,7 @@ void ConformanceTestSuiteImpl::ExpectParseFailureForJson(
   }
 }
 
-void ConformanceTestSuiteImpl::ExpectSerializeFailureForJson(
+void BinaryAndJsonConformanceSuite::ExpectSerializeFailureForJson(
     const string& test_name, ConformanceLevel level, const string& text_format) {
   TestAllTypesProto3 payload_message;
   GOOGLE_CHECK(
@@ -482,7 +495,7 @@ void ConformanceTestSuiteImpl::ExpectSerializeFailureForJson(
 }
 
 //TODO: proto2?
-void ConformanceTestSuiteImpl::TestPrematureEOFForType(
+void BinaryAndJsonConformanceSuite::TestPrematureEOFForType(
     FieldDescriptor::Type type) {
   // Incomplete values for each wire type.
   static const string incompletes[6] = {
@@ -570,7 +583,7 @@ void ConformanceTestSuiteImpl::TestPrematureEOFForType(
   }
 }
 
-void ConformanceTestSuiteImpl::TestValidDataForType(
+void BinaryAndJsonConformanceSuite::TestValidDataForType(
     FieldDescriptor::Type type,
     std::vector<std::pair<std::string, std::string>> values) {
   for (int is_proto3 = 0; is_proto3 < 2; is_proto3++) {
@@ -606,7 +619,7 @@ void ConformanceTestSuiteImpl::TestValidDataForType(
 }
 
 // TODO: proto2?
-void ConformanceTestSuiteImpl::TestIllegalTags() {
+void BinaryAndJsonConformanceSuite::TestIllegalTags() {
   // field num 0 is illegal
   string nullfield[] = {
     "\1DEADBEEF",
@@ -621,7 +634,7 @@ void ConformanceTestSuiteImpl::TestIllegalTags() {
   }
 }
 template <class MessageType>
-void ConformanceTestSuiteImpl::TestOneofMessage (
+void BinaryAndJsonConformanceSuite::TestOneofMessage (
     MessageType &message, bool is_proto3) {
   message.set_oneof_uint32(0);
   RunValidProtobufTestWithMessage(
@@ -660,14 +673,28 @@ void ConformanceTestSuiteImpl::TestOneofMessage (
 }
 
 template <class MessageType>
-void ConformanceTestSuiteImpl::TestUnknownMessage(
+void BinaryAndJsonConformanceSuite::TestUnknownMessage(
     MessageType& message, bool is_proto3) {
   message.ParseFromString("\xA8\x1F\x01");
   RunValidBinaryProtobufTest("UnknownVarint", REQUIRED,
                              message.SerializeAsString(), is_proto3);
 }
 
-void ConformanceTestSuiteImpl::RunSuiteImpl() {
+void BinaryAndJsonConformanceSuite::RunSuiteImpl() {
+  // Hack to get the list of test failures based on whether
+  // GOOGLE3_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER is enabled or not.
+  conformance::FailureSet failure_set;
+  ConformanceRequest req;
+  ConformanceResponse res;
+  req.set_message_type(failure_set.GetTypeName());
+  req.set_protobuf_payload("");
+  req.set_requested_output_format(conformance::WireFormat::PROTOBUF);
+  RunTest("FindFailures", req, &res);
+  GOOGLE_CHECK(failure_set.MergeFromString(res.protobuf_payload()));
+  for (const string& failure : failure_set.failure()) {
+    AddExpectedFailedTest(failure);
+  }
+
   type_resolver_.reset(NewTypeResolverForDescriptorPool(
       kTypeUrlPrefix, DescriptorPool::generated_pool()));
   type_url_ = GetTypeUrl(TestAllTypesProto3::descriptor());
@@ -1373,6 +1400,23 @@ void ConformanceTestSuiteImpl::RunSuiteImpl() {
       "EnumField", REQUIRED,
       R"({"optionalNestedEnum": "FOO"})",
       "optional_nested_enum: FOO");
+  // Enum fields with alias
+  RunValidJsonTest(
+      "EnumFieldWithAlias", REQUIRED,
+      R"({"optionalAliasedEnum": "ALIAS_BAZ"})",
+      "optional_aliased_enum: ALIAS_BAZ");
+  RunValidJsonTest(
+      "EnumFieldWithAliasUseAlias", REQUIRED,
+      R"({"optionalAliasedEnum": "QUX"})",
+      "optional_aliased_enum: ALIAS_BAZ");
+  RunValidJsonTest(
+      "EnumFieldWithAliasLowerCase", REQUIRED,
+      R"({"optionalAliasedEnum": "qux"})",
+      "optional_aliased_enum: ALIAS_BAZ");
+  RunValidJsonTest(
+      "EnumFieldWithAliasDifferentCase", REQUIRED,
+      R"({"optionalAliasedEnum": "bAz"})",
+      "optional_aliased_enum: ALIAS_BAZ");
   // Enum values must be represented as strings.
   ExpectParseFailureForJson(
       "EnumFieldNotQuoted", REQUIRED,
@@ -2012,6 +2056,10 @@ void ConformanceTestSuiteImpl::RunSuiteImpl() {
       "FieldMask", REQUIRED,
       R"({"optionalFieldMask": "foo,barBaz"})",
       R"(optional_field_mask: {paths: "foo" paths: "bar_baz"})");
+  RunValidJsonTest(
+      "EmptyFieldMask", REQUIRED,
+      R"({"optionalFieldMask": ""})",
+      R"(optional_field_mask: {})");
   ExpectParseFailureForJson(
       "FieldMaskInvalidCharacter", RECOMMENDED,
       R"({"optionalFieldMask": "foo,bar_bar"})");
@@ -2091,6 +2139,24 @@ void ConformanceTestSuiteImpl::RunSuiteImpl() {
           }
         }
       )");
+  RunValidJsonTest(
+      "StructWithEmptyListValue", REQUIRED,
+      R"({
+        "optionalStruct": {
+          "listValue": []
+        }
+      })",
+      R"(
+        optional_struct: {
+          fields: {
+            key: "listValue"
+            value: {
+              list_value: {
+              }
+            }
+          }
+        }
+      )");
   // Value
   RunValidJsonTest(
       "ValueAcceptInteger", REQUIRED,
@@ -2142,6 +2208,36 @@ void ConformanceTestSuiteImpl::RunSuiteImpl() {
           }
         }
       )");
+  RunValidJsonTest(
+      "RepeatedValue", REQUIRED,
+      R"({
+        "repeatedValue": [["a"]]
+      })",
+      R"(
+        repeated_value: [
+          {
+            list_value: {
+              values: [
+                { string_value: "a"}
+              ]
+            }
+          }
+        ]
+      )");
+  RunValidJsonTest(
+      "RepeatedListValue", REQUIRED,
+      R"({
+        "repeatedListValue": [["a"]]
+      })",
+      R"(
+        repeated_list_value: [
+          {
+            values: [
+              { string_value: "a"}
+            ]
+          }
+        ]
+      )");
 
   // Any
   RunValidJsonTest(
@@ -2356,12 +2452,9 @@ void ConformanceTestSuiteImpl::RunSuiteImpl() {
         "unknown": {"a": 1}
       })",
       "");
+
+  ExpectParseFailureForJson("RejectTopLevelNull", REQUIRED, "null");
 }
 
 }  // namespace protobuf
 }  // namespace google
-
-int main(int argc, char *argv[]) {
-  google::protobuf::ConformanceTestSuiteImpl suite;
-  return google::protobuf::ForkPipeRunner::Run(argc, argv, &suite);
-}

+ 121 - 0
conformance/binary_json_conformance_suite.h

@@ -0,0 +1,121 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H
+#define CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H
+
+#include "conformance_test.h"
+#include "third_party/jsoncpp/json.h"
+
+namespace google {
+namespace protobuf {
+
+class BinaryAndJsonConformanceSuite : public ConformanceTestSuite {
+ public:
+  BinaryAndJsonConformanceSuite() {}
+
+ private:
+  void RunSuiteImpl();
+  void RunValidJsonTest(const string& test_name,
+                        ConformanceLevel level,
+                        const string& input_json,
+                        const string& equivalent_text_format);
+  void RunValidJsonTestWithProtobufInput(
+      const string& test_name,
+      ConformanceLevel level,
+      const protobuf_test_messages::proto3::TestAllTypesProto3& input,
+      const string& equivalent_text_format);
+  void RunValidJsonIgnoreUnknownTest(
+      const string& test_name, ConformanceLevel level, const string& input_json,
+      const string& equivalent_text_format);
+  void RunValidProtobufTest(const string& test_name, ConformanceLevel level,
+                            const string& input_protobuf,
+                            const string& equivalent_text_format,
+                            bool is_proto3);
+  void RunValidBinaryProtobufTest(const string& test_name,
+                                  ConformanceLevel level,
+                                  const string& input_protobuf,
+                                  bool is_proto3);
+  void RunValidProtobufTestWithMessage(
+      const string& test_name, ConformanceLevel level,
+      const Message *input,
+      const string& equivalent_text_format,
+      bool is_proto3);
+
+  bool ParseJsonResponse(
+      const conformance::ConformanceResponse& response,
+      Message* test_message);
+  bool ParseResponse(
+      const conformance::ConformanceResponse& response,
+      const ConformanceRequestSetting& setting,
+      Message* test_message) override;
+
+  typedef std::function<bool(const Json::Value&)> Validator;
+  void RunValidJsonTestWithValidator(const string& test_name,
+                                     ConformanceLevel level,
+                                     const string& input_json,
+                                     const Validator& validator);
+  void ExpectParseFailureForJson(const string& test_name,
+                                 ConformanceLevel level,
+                                 const string& input_json);
+  void ExpectSerializeFailureForJson(const string& test_name,
+                                     ConformanceLevel level,
+                                     const string& text_format);
+  void ExpectParseFailureForProtoWithProtoVersion (const string& proto,
+                                                   const string& test_name,
+                                                   ConformanceLevel level,
+                                                   bool is_proto3);
+  void ExpectParseFailureForProto(const std::string& proto,
+                                  const std::string& test_name,
+                                  ConformanceLevel level);
+  void ExpectHardParseFailureForProto(const std::string& proto,
+                                      const std::string& test_name,
+                                      ConformanceLevel level);
+  void TestPrematureEOFForType(google::protobuf::FieldDescriptor::Type type);
+  void TestIllegalTags();
+  template <class MessageType>
+  void TestOneofMessage (MessageType &message,
+                         bool is_proto3);
+  template <class MessageType>
+  void TestUnknownMessage (MessageType &message,
+                           bool is_proto3);
+  void TestValidDataForType(
+      google::protobuf::FieldDescriptor::Type,
+      std::vector<std::pair<std::string, std::string>> values);
+
+  std::unique_ptr<google::protobuf::util::TypeResolver>
+      type_resolver_;
+  std::string type_url_;
+};
+
+}  // namespace protobuf
+}  // namespace google
+
+#endif  // CONFORMANCE_BINARY_JSON_CONFORMANCE_SUITE_H

+ 41 - 1
conformance/conformance.proto

@@ -55,18 +55,32 @@ enum WireFormat {
   UNSPECIFIED = 0;
   PROTOBUF = 1;
   JSON = 2;
+  JSPB = 3;  // Google internal only. Opensource testees just skip it.
+  TEXT_FORMAT = 4;
 }
 
 enum TestCategory {
   UNSPECIFIED_TEST = 0;
   BINARY_TEST = 1;  // Test binary wire format.
-  JSON_TEST = 2;  // Test json wire format.
+  JSON_TEST = 2;    // Test json wire format.
   // Similar to JSON_TEST. However, during parsing json, testee should ignore
   // unknown fields. This feature is optional. Each implementation can descide
   // whether to support it.  See
   // https://developers.google.com/protocol-buffers/docs/proto3#json_options
   // for more detail.
   JSON_IGNORE_UNKNOWN_PARSING_TEST = 3;
+  // Test jspb wire format. Google internal only. Opensource testees just skip it.
+  JSPB_TEST = 4;
+  // Test text format. For cpp, java and python, testees can already deal with
+  // this type. Testees of other languages can simply skip it.
+  TEXT_FORMAT_TEST = 5;
+}
+
+// The conformance runner will request a list of failures as the first request.
+// This will be known by message_type == "conformance.FailureSet", a conformance
+// test should return a serialized FailureSet in protobuf_payload.
+message FailureSet {
+  repeated string failure = 1;
 }
 
 // Represents a single test case's input.  The testee should:
@@ -85,6 +99,9 @@ message ConformanceRequest {
   oneof payload {
     bytes protobuf_payload = 1;
     string json_payload = 2;
+    // Google internal only.  Opensource testees just skip it.
+    string jspb_payload = 7;
+    string text_payload = 8;
   }
 
   // Which format should the testee serialize its message to?
@@ -99,6 +116,13 @@ message ConformanceRequest {
   // spedific support in testee programs. Refer to the defintion of TestCategory
   // for more information.
   TestCategory test_category = 5;
+
+  // Specify details for how to encode jspb.
+  JspbEncodingConfig jspb_encoding_options = 6;
+
+  // This can be used in json and text format. If true, testee should print
+  // unknown fields instead of ignore. This feature is optional.
+  bool print_unknown_fields = 9;
 }
 
 // Represents a single test case's output.
@@ -132,5 +156,21 @@ message ConformanceResponse {
     // For when the testee skipped the test, likely because a certain feature
     // wasn't supported, like JSON input/output.
     string skipped = 5;
+
+    // If the input was successfully parsed and the requested output was JSPB,
+    // serialize to JSPB and set it in this field. JSPB is google internal only
+    // format. Opensource testees can just skip it.
+    string jspb_payload = 7;
+
+    // If the input was successfully parsed and the requested output was
+    // TEXT_FORMAT, serialize to TEXT_FORMAT and set it in this field.
+    string text_payload = 8;
   }
 }
+
+// Encoding options for jspb format.
+message JspbEncodingConfig {
+  // Encode the value field of Any as jspb array if ture, otherwise binary.
+  bool use_jspb_array_any_format = 1;
+}
+

+ 59 - 1
conformance/conformance_cpp.cc

@@ -36,6 +36,7 @@
 #include <google/protobuf/test_messages_proto3.pb.h>
 #include <google/protobuf/test_messages_proto2.pb.h>
 #include <google/protobuf/message.h>
+#include <google/protobuf/text_format.h>
 #include <google/protobuf/util/json_util.h>
 #include <google/protobuf/util/type_resolver_util.h>
 
@@ -45,18 +46,48 @@ using google::protobuf::Descriptor;
 using google::protobuf::DescriptorPool;
 using google::protobuf::Message;
 using google::protobuf::MessageFactory;
+using google::protobuf::TextFormat;
 using google::protobuf::util::BinaryToJsonString;
 using google::protobuf::util::JsonParseOptions;
 using google::protobuf::util::JsonToBinaryString;
 using google::protobuf::util::NewTypeResolverForDescriptorPool;
 using google::protobuf::util::Status;
 using google::protobuf::util::TypeResolver;
-using protobuf_test_messages::proto3::TestAllTypesProto3;
 using protobuf_test_messages::proto2::TestAllTypesProto2;
+using protobuf_test_messages::proto3::TestAllTypesProto3;
 using std::string;
 
 static const char kTypeUrlPrefix[] = "type.googleapis.com";
 
+const char* kFailures[] = {
+#if !GOOGLE_PROTOBUF_ENABLE_EXPERIMENTAL_PARSER
+    "Required.Proto2.ProtobufInput."
+    "PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE",
+    "Required.Proto2.ProtobufInput."
+    "PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE",
+    "Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL",
+    "Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM",
+    "Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32",
+    "Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64",
+    "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32",
+    "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64",
+    "Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32",
+    "Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64",
+    "Required.Proto3.ProtobufInput."
+    "PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE",
+    "Required.Proto3.ProtobufInput."
+    "PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE",
+    "Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL",
+    "Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM",
+    "Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32",
+    "Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64",
+    "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32",
+    "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64",
+    "Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32",
+    "Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64",
+#endif
+};
+
 static string GetTypeUrl(const Descriptor* message) {
   return string(kTypeUrlPrefix) + "/" + message->full_name();
 }
@@ -134,9 +165,28 @@ void DoTest(const ConformanceRequest& request, ConformanceResponse* response) {
       break;
     }
 
+    case ConformanceRequest::kTextPayload: {
+      if (!TextFormat::ParseFromString(request.text_payload(), test_message)) {
+        response->set_parse_error("Parse error");
+        return;
+      }
+      break;
+    }
+
     case ConformanceRequest::PAYLOAD_NOT_SET:
       GOOGLE_LOG(FATAL) << "Request didn't have payload.";
       break;
+
+    default:
+      GOOGLE_LOG(FATAL) << "unknown payload type: "
+                        << request.payload_case();
+      break;
+  }
+
+  conformance::FailureSet failures;
+  if (descriptor == failures.GetDescriptor()) {
+    for (const char* s : kFailures) failures.add_failure(s);
+    test_message = &failures;
   }
 
   switch (request.requested_output_format()) {
@@ -163,6 +213,14 @@ void DoTest(const ConformanceRequest& request, ConformanceResponse* response) {
       break;
     }
 
+    case conformance::TEXT_FORMAT: {
+      TextFormat::Printer printer;
+      printer.SetHideUnknownFields(!request.print_unknown_fields());
+      GOOGLE_CHECK(printer.PrintToString(*test_message,
+                                         response->mutable_text_payload()));
+      break;
+    }
+
     default:
       GOOGLE_LOG(FATAL) << "Unknown output format: "
                         << request.requested_output_format();

+ 4 - 0
conformance/conformance_nodejs.js

@@ -76,6 +76,10 @@ function doTest(request) {
         response.setSkipped("JSON not supported.");
         return response;
 
+	  case conformance.ConformanceRequest.PayloadCase.TEXT_PAYLOAD:
+	    response.setSkipped("Text format not supported.");
+        return response;
+		
       case conformance.ConformanceRequest.PayloadCase.PAYLOAD_NOT_SET:
         response.setRuntimeError("Request didn't have payload");
         return response;

+ 22 - 0
conformance/conformance_objc.m

@@ -92,6 +92,16 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) {
     case ConformanceRequest_Payload_OneOfCase_JsonPayload:
       response.skipped = @"ObjC doesn't support parsing JSON";
       break;
+
+    case ConformanceRequest_Payload_OneOfCase_JspbPayload:
+      response.skipped =
+          @"ConformanceRequest had a jspb_payload ConformanceRequest.payload;"
+          " those aren't supposed to happen with opensource.";
+      break;
+
+    case ConformanceRequest_Payload_OneOfCase_TextPayload:
+      response.skipped = @"ObjC doesn't support parsing TextFormat";
+      break;
   }
 
   if (testMessage) {
@@ -112,6 +122,18 @@ static ConformanceResponse *DoTest(ConformanceRequest *request) {
       case WireFormat_Json:
         response.skipped = @"ObjC doesn't support generating JSON";
         break;
+
+      case WireFormat_Jspb:
+        response.skipped =
+            @"ConformanceRequest had a requested_output_format of JSPB WireFormat; that"
+            " isn't supposed to happen with opensource.";
+        break;
+
+      case WireFormat_TextFormat:
+        // ObjC only has partial objc generation, so don't attempt any tests that need
+        // support.
+        response.skipped = @"ObjC doesn't support generating TextFormat";
+        break;
     }
   }
 

+ 11 - 2
conformance/conformance_php.php

@@ -3,10 +3,13 @@
 require_once("Conformance/WireFormat.php");
 require_once("Conformance/ConformanceResponse.php");
 require_once("Conformance/ConformanceRequest.php");
+require_once("Conformance/FailureSet.php");
+require_once("Conformance/JspbEncodingConfig.php");
 require_once("Conformance/TestCategory.php");
 require_once("Protobuf_test_messages/Proto3/ForeignMessage.php");
 require_once("Protobuf_test_messages/Proto3/ForeignEnum.php");
 require_once("Protobuf_test_messages/Proto3/TestAllTypesProto3.php");
+require_once("Protobuf_test_messages/Proto3/TestAllTypesProto3/AliasedEnum.php");
 require_once("Protobuf_test_messages/Proto3/TestAllTypesProto3/NestedMessage.php");
 require_once("Protobuf_test_messages/Proto3/TestAllTypesProto3/NestedEnum.php");
 
@@ -27,7 +30,10 @@ function doTest($request)
     $test_message = new \Protobuf_test_messages\Proto3\TestAllTypesProto3();
     $response = new \Conformance\ConformanceResponse();
     if ($request->getPayload() == "protobuf_payload") {
-      if ($request->getMessageType() == "protobuf_test_messages.proto3.TestAllTypesProto3") {
+      if ($request->getMessageType() == "conformance.FailureSet") {
+        $response->setProtobufPayload("");
+        return $response;
+      } elseif ($request->getMessageType() == "protobuf_test_messages.proto3.TestAllTypesProto3") {
         try {
           $test_message->mergeFromString($request->getProtobufPayload());
         } catch (Exception $e) {
@@ -51,7 +57,10 @@ function doTest($request)
           $response->setParseError($e->getMessage());
           return $response;
       }
-    } else {
+	} elseif ($request->getPayload() == "text_payload") {
+		$response->setSkipped("PHP doesn't support text format yet");
+        return $response;
+	} else {
       trigger_error("Request didn't have payload.", E_USER_ERROR);
     }
 

+ 73 - 7
conformance/conformance_python.py

@@ -44,6 +44,7 @@ from google.protobuf import json_format
 from google.protobuf import message
 from google.protobuf import test_messages_proto3_pb2
 from google.protobuf import test_messages_proto2_pb2
+from google.protobuf import text_format
 import conformance_pb2
 
 sys.stdout = os.fdopen(sys.stdout.fileno(), 'wb', 0)
@@ -56,26 +57,80 @@ class ProtocolError(Exception):
   pass
 
 def do_test(request):
+  response = conformance_pb2.ConformanceResponse()
+
+  if request.message_type == "conformance.FailureSet":
+    failure_set = conformance_pb2.FailureSet()
+    failures = []
+    # TODO(gerbens): Remove, this is a hack to detect if the old vs new
+    # parser is used by the cpp code. Relying on a bug in the old parser.
+    hack_proto = test_messages_proto2_pb2.TestAllTypesProto2()
+    old_parser = True
+    try:
+      hack_proto.ParseFromString(b"\322\002\001")
+    except message.DecodeError as e:
+      old_parser = False
+    if old_parser:
+      # the string above is one of the failing conformance test strings of the
+      # old parser. If we succeed the c++ implementation is using the old
+      # parser so we add the list of failing conformance tests.
+      failures = [
+          "Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE",
+          "Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.DOUBLE",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED32",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED64",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.FLOAT",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED32",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED64",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32",
+          "Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64",
+          "Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE",
+          "Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.DOUBLE",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED32",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED64",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.FLOAT",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED32",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED64",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32",
+          "Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64",
+      ]
+    for x in failures:
+      failure_set.failure.append(x)
+    response.protobuf_payload = failure_set.SerializeToString()
+    return response
+
   isProto3 = (request.message_type == "protobuf_test_messages.proto3.TestAllTypesProto3")
   isJson = (request.WhichOneof('payload') == 'json_payload')
   isProto2 = (request.message_type == "protobuf_test_messages.proto2.TestAllTypesProto2")
-  
+
   if (not isProto3) and (not isJson) and (not isProto2):
     raise ProtocolError("Protobuf request doesn't have specific payload type")
-      
+
   test_message = test_messages_proto2_pb2.TestAllTypesProto2() if isProto2 else \
     test_messages_proto3_pb2.TestAllTypesProto3()
 
-  response = conformance_pb2.ConformanceResponse()
-
   try:
     if request.WhichOneof('payload') == 'protobuf_payload':
       try:
         test_message.ParseFromString(request.protobuf_payload)
       except message.DecodeError as e:
         response.parse_error = str(e)
-        return response  
-      
+        return response
+
     elif request.WhichOneof('payload') == 'json_payload':
       try:
         ignore_unknown_fields = \
@@ -87,6 +142,13 @@ def do_test(request):
         response.parse_error = str(e)
         return response
 
+    elif request.WhichOneof('payload') == 'text_payload':
+      try:
+        text_format.Parse(request.text_payload, test_message)
+      except Exception as e:
+        response.parse_error = str(e)
+        return response
+
     else:
       raise ProtocolError("Request didn't have payload.")
 
@@ -97,12 +159,16 @@ def do_test(request):
       response.protobuf_payload = test_message.SerializeToString()
 
     elif request.requested_output_format == conformance_pb2.JSON:
-      try: 
+      try:
         response.json_payload = json_format.MessageToJson(test_message)
       except Exception as e:
         response.serialize_error = str(e)
         return response
 
+    elif request.requested_output_format == conformance_pb2.TEXT_FORMAT:
+      response.text_payload = text_format.MessageToString(
+          test_message, print_unknown_fields=request.print_unknown_fields)
+
   except Exception as e:
     response.runtime_error = str(e)
 

+ 7 - 1
conformance/conformance_ruby.rb

@@ -54,7 +54,7 @@ def do_test(request)
       elsif request.message_type.eql?('protobuf_test_messages.proto2.TestAllTypesProto2')
         response.skipped = "Ruby doesn't support proto2"
         return response
-      else 
+      else
         fail "Protobuf request doesn't have specific payload type"
       end
 
@@ -66,6 +66,12 @@ def do_test(request)
         response.parse_error = err.message.encode('utf-8')
         return response
       end
+	
+	when :text_payload
+	  begin
+		response.skipped = "Ruby doesn't support proto2"
+        return response   
+	  end
 
     when nil
       fail "Request didn't have payload"

+ 66 - 69
conformance/conformance_test.cc

@@ -68,6 +68,7 @@ ConformanceTestSuite::ConformanceRequestSetting::ConformanceRequestSetting(
       input_format_(input_format),
       output_format_(output_format),
       prototype_message_(prototype_message),
+      prototype_message_for_compare_(prototype_message.New()),
       test_name_(test_name) {
   switch (input_format) {
     case conformance::PROTOBUF: {
@@ -80,6 +81,16 @@ ConformanceTestSuite::ConformanceRequestSetting::ConformanceRequestSetting(
       break;
     }
 
+    case conformance::JSPB: {
+      request_.set_jspb_payload(input);
+      break;
+    }
+
+    case conformance::TEXT_FORMAT: {
+      request_.set_text_payload(input);
+      break;
+    }
+
     default:
       GOOGLE_LOG(FATAL) << "Unspecified input format";
   }
@@ -92,7 +103,7 @@ ConformanceTestSuite::ConformanceRequestSetting::ConformanceRequestSetting(
 
 Message* ConformanceTestSuite::ConformanceRequestSetting::
     GetTestMessage() const {
-  return prototype_message_.New();
+  return prototype_message_for_compare_->New();
 }
 
 string ConformanceTestSuite::ConformanceRequestSetting::
@@ -126,6 +137,8 @@ string ConformanceTestSuite::ConformanceRequestSetting::
       return "ProtobufInput";
     case conformance::JSON:
       return "JsonInput";
+    case conformance::TEXT_FORMAT:
+      return "TextFormatInput";
     default:
       GOOGLE_LOG(FATAL) << "Unspecified output format";
   }
@@ -139,21 +152,14 @@ string ConformanceTestSuite::ConformanceRequestSetting::
       return "ProtobufOutput";
     case conformance::JSON:
       return "JsonOutput";
+    case conformance::TEXT_FORMAT:
+      return "TextFormatOutput";
     default:
       GOOGLE_LOG(FATAL) << "Unspecified output format";
   }
   return "";
 }
 
-void ConformanceTestSuite::SetFailureList(
-    const string& filename,
-    const std::vector<string>& failure_list) {
-  failure_list_filename_ = filename;
-  expected_to_fail_.clear();
-  std::copy(failure_list.begin(), failure_list.end(),
-            std::inserter(expected_to_fail_, expected_to_fail_.end()));
-}
-
 void ConformanceTestSuite::ReportSuccess(const string& test_name) {
   if (expected_to_fail_.erase(test_name) != 0) {
     StringAppendF(&output_,
@@ -215,23 +221,27 @@ void ConformanceTestSuite::RunValidInputTest(
 void ConformanceTestSuite::RunValidBinaryInputTest(
     const ConformanceRequestSetting& setting,
     const string& equivalent_wire_format) {
+  const ConformanceRequest& request = setting.GetRequest();
+  ConformanceResponse response;
+  RunTest(setting.GetTestName(), request, &response);
+  VerifyResponse(setting, equivalent_wire_format, response, true);
+}
+
+void ConformanceTestSuite::VerifyResponse(
+    const ConformanceRequestSetting& setting,
+    const string& equivalent_wire_format,
+    const ConformanceResponse& response,
+    bool need_report_success) {
+  Message* test_message = setting.GetTestMessage();
+  const ConformanceRequest& request = setting.GetRequest();
   const string& test_name = setting.GetTestName();
   ConformanceLevel level = setting.GetLevel();
-
   Message* reference_message = setting.GetTestMessage();
+
   GOOGLE_CHECK(
       reference_message->ParseFromString(equivalent_wire_format))
           << "Failed to parse wire data for test case: " << test_name;
 
-  const ConformanceRequest& request = setting.GetRequest();
-  ConformanceResponse response;
-
-  RunTest(test_name, request, &response);
-
-  Message* test_message = setting.GetTestMessage();
-
-  WireFormat requested_output = request.requested_output_format();
-
   switch (response.result_case()) {
     case ConformanceResponse::RESULT_NOT_SET:
       ReportFailure(test_name, level, request, response,
@@ -249,53 +259,8 @@ void ConformanceTestSuite::RunValidBinaryInputTest(
       ReportSkip(test_name, request, response);
       return;
 
-    case ConformanceResponse::kJsonPayload: {
-      if (requested_output != conformance::JSON) {
-        ReportFailure(
-            test_name, level, request, response,
-            "Test was asked for protobuf output but provided JSON instead.");
-        return;
-      }
-      string binary_protobuf;
-      Status status =
-          JsonToBinaryString(type_resolver_.get(), type_url_,
-                             response.json_payload(), &binary_protobuf);
-      if (!status.ok()) {
-        ReportFailure(test_name, level, request, response,
-                      "JSON output we received from test was unparseable.");
-        return;
-      }
-
-      if (!test_message->ParseFromString(binary_protobuf)) {
-        ReportFailure(test_name, level, request, response,
-                    "INTERNAL ERROR: internal JSON->protobuf transcode "
-                    "yielded unparseable proto.");
-        return;
-      }
-
-      break;
-    }
-
-    case ConformanceResponse::kProtobufPayload: {
-      if (requested_output != conformance::PROTOBUF) {
-        ReportFailure(
-            test_name, level, request, response,
-            "Test was asked for JSON output but provided protobuf instead.");
-        return;
-      }
-
-      if (!test_message->ParseFromString(response.protobuf_payload())) {
-        ReportFailure(test_name, level, request, response,
-                   "Protobuf output we received from test was unparseable.");
-        return;
-      }
-
-      break;
-    }
-
     default:
-      GOOGLE_LOG(FATAL) << test_name << ": unknown payload type: "
-                        << response.result_case();
+      if (!ParseResponse(response, setting, test_message)) return;
   }
 
   MessageDifferencer differencer;
@@ -308,7 +273,9 @@ void ConformanceTestSuite::RunValidBinaryInputTest(
   bool check;
   check = differencer.Compare(*reference_message, *test_message);
   if (check) {
-    ReportSuccess(test_name);
+    if (need_report_success) {
+      ReportSuccess(test_name);
+    }
   } else {
     ReportFailure(test_name, level, request, response,
                   "Output was not equivalent to reference message: %s.",
@@ -375,8 +342,33 @@ bool ConformanceTestSuite::CheckSetEmpty(
   }
 }
 
-bool ConformanceTestSuite::RunSuite(
-    ConformanceTestRunner* runner, std::string* output) {
+string ConformanceTestSuite::WireFormatToString(
+    WireFormat wire_format) {
+  switch (wire_format) {
+    case conformance::PROTOBUF:
+      return "PROTOBUF";
+    case conformance::JSON:
+      return "JSON";
+    case conformance::JSPB:
+      return "JSPB";
+    case conformance::TEXT_FORMAT:
+      return "TEXT_FORMAT";
+    case conformance::UNSPECIFIED:
+      return "UNSPECIFIED";
+    default:
+      GOOGLE_LOG(FATAL) << "unknown wire type: "
+                        << wire_format;
+  }
+  return "";
+}
+
+void ConformanceTestSuite::AddExpectedFailedTest(const std::string& test_name) {
+  expected_to_fail_.insert(test_name);
+}
+
+bool ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
+                                    std::string* output, const string& filename,
+                                    conformance::FailureSet* failure_list) {
   runner_ = runner;
   successes_ = 0;
   expected_failures_ = 0;
@@ -387,6 +379,11 @@ bool ConformanceTestSuite::RunSuite(
 
   output_ = "\nCONFORMANCE TEST BEGIN ====================================\n\n";
 
+  failure_list_filename_ = filename;
+  expected_to_fail_.clear();
+  for (const string& failure : failure_list->failure()) {
+    AddExpectedFailedTest(failure);
+  }
   RunSuiteImpl();
 
   bool ok = true;

+ 50 - 38
conformance/conformance_test.h

@@ -84,10 +84,10 @@ class ConformanceTestRunner {
 // over a pipe.
 class ForkPipeRunner : public ConformanceTestRunner {
  public:
+  // Note: Run() doesn't take ownership of the pointers inside suites.
   static int Run(int argc, char *argv[],
-                 ConformanceTestSuite* suite);
+                 const std::vector<ConformanceTestSuite*>& suites);
 
- private:
   ForkPipeRunner(const std::string &executable)
       : child_pid_(-1), executable_(executable) {}
 
@@ -97,24 +97,7 @@ class ForkPipeRunner : public ConformanceTestRunner {
                const std::string& request,
                std::string* response);
 
-  // TODO(haberman): make this work on Windows, instead of using these
-  // UNIX-specific APIs.
-  //
-  // There is a platform-agnostic API in
-  //    src/google/protobuf/compiler/subprocess.h
-  //
-  // However that API only supports sending a single message to the subprocess.
-  // We really want to be able to send messages and receive responses one at a
-  // time:
-  //
-  // 1. Spawning a new process for each test would take way too long for thousands
-  //    of tests and subprocesses like java that can take 100ms or more to start
-  //    up.
-  //
-  // 2. Sending all the tests in one big message and receiving all results in one
-  //    big message would take away our visibility about which test(s) caused a
-  //    crash or other fatal error.  It would also give us only a single failure
-  //    instead of all of them.
+ private:
   void SpawnTestProgram();
 
   void CheckedWrite(int fd, const void *buf, size_t len);
@@ -157,20 +140,14 @@ class ForkPipeRunner : public ConformanceTestRunner {
 //
 class ConformanceTestSuite {
  public:
-  ConformanceTestSuite() : verbose_(false), enforce_recommended_(false) {}
+  ConformanceTestSuite()
+      : verbose_(false),
+        enforce_recommended_(false),
+        failure_list_flag_name_("--failure_list") {}
   virtual ~ConformanceTestSuite() {}
 
   void SetVerbose(bool verbose) { verbose_ = verbose; }
 
-  // Sets the list of tests that are expected to fail when RunSuite() is called.
-  // RunSuite() will fail unless the set of failing tests is exactly the same
-  // as this list.
-  //
-  // The filename here is *only* used to create/format useful error messages for
-  // how to update the failure list.  We do NOT read this file at all.
-  void SetFailureList(const std::string& filename,
-                      const std::vector<std::string>& failure_list);
-
   // Whether to require the testee to pass RECOMMENDED tests. By default failing
   // a RECOMMENDED test case will not fail the entire suite but will only
   // generated a warning. If this flag is set to true, RECOMMENDED tests will
@@ -183,13 +160,26 @@ class ConformanceTestSuite {
     enforce_recommended_ = value;
   }
 
+  // Gets the flag name to the failure list file.
+  // By default, this would return --failure_list
+  string GetFailureListFlagName() {
+    return failure_list_flag_name_;
+  }
+
+  void SetFailureListFlagName(const std::string& failure_list_flag_name) {
+    failure_list_flag_name_ = failure_list_flag_name;
+  }
+
   // Run all the conformance tests against the given test runner.
   // Test output will be stored in "output".
   //
   // Returns true if the set of failing tests was exactly the same as the
-  // failure list.  If SetFailureList() was not called, returns true if all
-  // tests passed.
-  bool RunSuite(ConformanceTestRunner* runner, std::string* output);
+  // failure list.
+  // The filename here is *only* used to create/format useful error messages for
+  // how to update the failure list.  We do NOT read this file at all.
+  bool RunSuite(ConformanceTestRunner* runner, std::string* output,
+                const std::string& filename,
+                conformance::FailureSet* failure_list);
 
  protected:
   // Test cases are classified into a few categories:
@@ -234,21 +224,44 @@ class ConformanceTestSuite {
 
     string ConformanceLevelToString(ConformanceLevel level) const;
 
+    void SetPrintUnknownFields(bool print_unknown_fields) {
+      request_.set_print_unknown_fields(true);
+    }
+
+    void SetPrototypeMessageForCompare(const Message& message) {
+      prototype_message_for_compare_.reset(message.New());
+    }
+
    protected:
     virtual string InputFormatString(conformance::WireFormat format) const;
     virtual string OutputFormatString(conformance::WireFormat format) const;
+    conformance::ConformanceRequest request_;
 
    private:
     ConformanceLevel level_;
     ::conformance::WireFormat input_format_;
     ::conformance::WireFormat output_format_;
     const Message& prototype_message_;
+    std::unique_ptr<Message> prototype_message_for_compare_;
     string test_name_;
-    conformance::ConformanceRequest request_;
   };
 
   bool CheckSetEmpty(const std::set<string>& set_to_check,
                      const std::string& write_to_file, const std::string& msg);
+  string WireFormatToString(conformance::WireFormat wire_format);
+
+  // Parse payload in the response to the given message. Returns true on
+  // success.
+  virtual bool ParseResponse(
+      const conformance::ConformanceResponse& response,
+      const ConformanceRequestSetting& setting,
+      Message* test_message) = 0;
+
+  void VerifyResponse(
+      const ConformanceRequestSetting& setting,
+      const string& equivalent_wire_format,
+      const conformance::ConformanceResponse& response,
+      bool need_report_success);
 
   void ReportSuccess(const std::string& test_name);
   void ReportFailure(const string& test_name,
@@ -269,6 +282,8 @@ class ConformanceTestSuite {
                const conformance::ConformanceRequest& request,
                conformance::ConformanceResponse* response);
 
+  void AddExpectedFailedTest(const std::string& test_name);
+
   virtual void RunSuiteImpl() = 0;
 
   ConformanceTestRunner* runner_;
@@ -277,6 +292,7 @@ class ConformanceTestSuite {
   bool verbose_;
   bool enforce_recommended_;
   std::string output_;
+  std::string failure_list_flag_name_;
   std::string failure_list_filename_;
 
   // The set of test names that are expected to fail in this run, but haven't
@@ -295,10 +311,6 @@ class ConformanceTestSuite {
 
   // The set of tests that the testee opted out of;
   std::set<std::string> skipped_;
-
-  std::unique_ptr<google::protobuf::util::TypeResolver>
-      type_resolver_;
-  std::string type_url_;
 };
 
 }  // namespace protobuf

+ 40 - 0
conformance/conformance_test_main.cc

@@ -0,0 +1,40 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "binary_json_conformance_suite.h"
+#include "conformance_test.h"
+#include "text_format_conformance_suite.h"
+
+int main(int argc, char *argv[]) {
+  google::protobuf::BinaryAndJsonConformanceSuite binary_and_json_suite;
+  google::protobuf::TextFormatConformanceTestSuite text_format_suite;
+  return google::protobuf::ForkPipeRunner::Run(
+      argc, argv, {&binary_and_json_suite, &text_format_suite});
+}

+ 78 - 32
conformance/conformance_test_runner.cc

@@ -84,7 +84,7 @@ namespace google {
 namespace protobuf {
 
 void ParseFailureList(const char *filename,
-                      std::vector<string>* failure_list) {
+                      conformance::FailureSet *failure_list) {
   std::ifstream infile(filename);
 
   if (!infile.is_open()) {
@@ -101,7 +101,7 @@ void ParseFailureList(const char *filename,
     line = line.substr(0, line.find("#"));
 
     if (!line.empty()) {
-      failure_list->push_back(line);
+      failure_list->add_failure(line);
     }
   }
 }
@@ -119,6 +119,19 @@ void UsageError() {
           "                              should contain one test name per\n");
   fprintf(stderr,
           "                              line.  Use '#' for comments.\n");
+  fprintf(stderr,
+          "  --text_format_failure_list <filename>   Use to specify list \n");
+  fprintf(stderr,
+          "                              of tests that are expected to \n");
+  fprintf(stderr,
+          "                              fail in the \n");
+  fprintf(stderr,
+          "                              text_format_conformance_suite.  \n");
+  fprintf(stderr,
+          "                              File should contain one test name \n");
+  fprintf(stderr,
+          "                              per line.  Use '#' for comments.\n");
+
   fprintf(stderr,
           "  --enforce_recommended       Enforce that recommended test\n");
   fprintf(stderr,
@@ -175,43 +188,76 @@ void ForkPipeRunner::RunTest(
 }
 
 int ForkPipeRunner::Run(
-    int argc, char *argv[], ConformanceTestSuite* suite) {
-  char *program;
-  string failure_list_filename;
-  std::vector<string> failure_list;
-
-  for (int arg = 1; arg < argc; ++arg) {
-    if (strcmp(argv[arg], "--failure_list") == 0) {
-      if (++arg == argc) UsageError();
-      failure_list_filename = argv[arg];
-      ParseFailureList(argv[arg], &failure_list);
-    } else if (strcmp(argv[arg], "--verbose") == 0) {
-      suite->SetVerbose(true);
-    } else if (strcmp(argv[arg], "--enforce_recommended") == 0) {
-      suite->SetEnforceRecommended(true);
-    } else if (argv[arg][0] == '-') {
-      fprintf(stderr, "Unknown option: %s\n", argv[arg]);
-      UsageError();
-    } else {
-      if (arg != argc - 1) {
-        fprintf(stderr, "Too many arguments.\n");
-        UsageError();
+    int argc, char *argv[], const std::vector<ConformanceTestSuite*>& suites) {
+  if (suites.empty()) {
+    fprintf(stderr, "No test suites found.\n");
+    return EXIT_FAILURE;
+  }
+  bool all_ok = true;
+  for (ConformanceTestSuite* suite : suites) {
+    char *program;
+    string failure_list_filename;
+    conformance::FailureSet failure_list;
+
+    for (int arg = 1; arg < argc; ++arg) {
+      if (strcmp(argv[arg], suite->GetFailureListFlagName().c_str()) == 0) {
+        if (++arg == argc) UsageError();
+        failure_list_filename = argv[arg];
+        ParseFailureList(argv[arg], &failure_list);
+      } else if (strcmp(argv[arg], "--verbose") == 0) {
+        suite->SetVerbose(true);
+      } else if (strcmp(argv[arg], "--enforce_recommended") == 0) {
+        suite->SetEnforceRecommended(true);
+      } else if (argv[arg][0] == '-') {
+        bool recognized_flag = false;
+        for (ConformanceTestSuite* suite : suites) {
+          if (strcmp(argv[arg], suite->GetFailureListFlagName().c_str()) == 0) {
+            if (++arg == argc) UsageError();
+            recognized_flag = true;
+          }
+        }
+        if (!recognized_flag) {
+          fprintf(stderr, "Unknown option: %s\n", argv[arg]);
+          UsageError();
+        }
+      } else {
+        if (arg != argc - 1) {
+          fprintf(stderr, "Too many arguments.\n");
+          UsageError();
+        }
+        program = argv[arg];
       }
-      program = argv[arg];
     }
-  }
-
-  suite->SetFailureList(failure_list_filename, failure_list);
-  ForkPipeRunner runner(program);
 
-  std::string output;
-  bool ok =  suite->RunSuite(&runner, &output);
+    ForkPipeRunner runner(program);
 
-  fwrite(output.c_str(), 1, output.size(), stderr);
+    std::string output;
+    all_ok = all_ok &&
+        suite->RunSuite(&runner, &output, failure_list_filename, &failure_list);
 
-  return ok ? EXIT_SUCCESS : EXIT_FAILURE;
+    fwrite(output.c_str(), 1, output.size(), stderr);
+  }
+  return all_ok ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 
+// TODO(haberman): make this work on Windows, instead of using these
+// UNIX-specific APIs.
+//
+// There is a platform-agnostic API in
+//    src/google/protobuf/compiler/subprocess.h
+//
+// However that API only supports sending a single message to the subprocess.
+// We really want to be able to send messages and receive responses one at a
+// time:
+//
+// 1. Spawning a new process for each test would take way too long for thousands
+//    of tests and subprocesses like java that can take 100ms or more to start
+//    up.
+//
+// 2. Sending all the tests in one big message and receiving all results in one
+//    big message would take away our visibility about which test(s) caused a
+//    crash or other fatal error.  It would also give us only a single failure
+//    instead of all of them.
 void ForkPipeRunner::SpawnTestProgram() {
   int toproc_pipe_fd[2];
   int fromproc_pipe_fd[2];

+ 0 - 20
conformance/failure_list_cpp.txt

@@ -34,23 +34,3 @@ Recommended.Proto3.JsonInput.TrailingCommaInAnObject
 Recommended.Proto3.JsonInput.TrailingCommaInAnObjectWithNewlines
 Recommended.Proto3.JsonInput.TrailingCommaInAnObjectWithSpace
 Recommended.Proto3.JsonInput.TrailingCommaInAnObjectWithSpaceCommaSpace
-Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
-Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64
-Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
-Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64

+ 4 - 0
conformance/failure_list_php.txt

@@ -13,6 +13,10 @@ Required.Proto3.JsonInput.FloatFieldTooSmall
 Required.Proto3.JsonInput.DoubleFieldTooSmall
 Required.Proto3.JsonInput.Int32FieldNotInteger
 Required.Proto3.JsonInput.Int64FieldNotInteger
+Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
+Required.Proto3.JsonInput.RepeatedListValue.JsonOutput
+Required.Proto3.JsonInput.RepeatedListValue.ProtobufOutput
+Required.Proto3.JsonInput.StringFieldNotAString
 Required.Proto3.JsonInput.Uint32FieldNotInteger
 Required.Proto3.JsonInput.Uint64FieldNotInteger
 Required.Proto3.JsonInput.Int32FieldLeadingSpace

+ 2 - 29
conformance/failure_list_php_c.txt

@@ -5,6 +5,7 @@ Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
 Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
 Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
 Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator
+Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter
 Recommended.Proto3.JsonInput.Int64FieldBeString.Validator
 Recommended.Proto3.JsonInput.MapFieldValueIsNull
 Recommended.Proto3.JsonInput.OneofZeroBytes.JsonOutput
@@ -22,27 +23,6 @@ Required.DurationProtoInputTooLarge.JsonOutput
 Required.DurationProtoInputTooSmall.JsonOutput
 Required.TimestampProtoInputTooLarge.JsonOutput
 Required.TimestampProtoInputTooSmall.JsonOutput
-Required.Proto3.JsonInput.Any.JsonOutput
-Required.Proto3.JsonInput.Any.ProtobufOutput
-Required.Proto3.JsonInput.AnyNested.JsonOutput
-Required.Proto3.JsonInput.AnyNested.ProtobufOutput
-Required.Proto3.JsonInput.AnyUnorderedTypeTag.JsonOutput
-Required.Proto3.JsonInput.AnyUnorderedTypeTag.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithDuration.JsonOutput
-Required.Proto3.JsonInput.AnyWithDuration.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithFieldMask.JsonOutput
-Required.Proto3.JsonInput.AnyWithFieldMask.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.JsonOutput
-Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithStruct.JsonOutput
-Required.Proto3.JsonInput.AnyWithStruct.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithTimestamp.JsonOutput
-Required.Proto3.JsonInput.AnyWithTimestamp.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithValueForInteger.JsonOutput
-Required.Proto3.JsonInput.AnyWithValueForInteger.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithValueForJsonObject.JsonOutput
-Required.Proto3.JsonInput.AnyWithValueForJsonObject.ProtobufOutput
-Required.Proto3.JsonInput.BoolMapField.JsonOutput
 Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput
 Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput
 Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.JsonOutput
@@ -50,24 +30,17 @@ Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput
 Required.Proto3.JsonInput.DoubleFieldNan.JsonOutput
 Required.Proto3.JsonInput.DurationMinValue.JsonOutput
 Required.Proto3.JsonInput.DurationRepeatedValue.JsonOutput
-Required.Proto3.JsonInput.FieldMask.JsonOutput
-Required.Proto3.JsonInput.FieldMask.ProtobufOutput
 Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput
 Required.Proto3.JsonInput.FloatFieldNan.JsonOutput
 Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput
 Required.Proto3.JsonInput.OneofFieldDuplicate
 Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput
 Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput
-Required.Proto3.JsonInput.StringFieldEscape.JsonOutput
-Required.Proto3.JsonInput.StringFieldEscape.ProtobufOutput
 Required.Proto3.JsonInput.StringFieldSurrogatePair.JsonOutput
 Required.Proto3.JsonInput.StringFieldSurrogatePair.ProtobufOutput
-Required.Proto3.JsonInput.StringFieldUnicodeEscape.JsonOutput
-Required.Proto3.JsonInput.StringFieldUnicodeEscape.ProtobufOutput
-Required.Proto3.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.JsonOutput
-Required.Proto3.JsonInput.StringFieldUnicodeEscapeWithLowercaseHexLetters.ProtobufOutput
 Required.Proto3.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput
 Required.Proto3.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput
 Required.Proto3.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput
 Required.Proto3.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput
 Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput
+Required.Proto3.JsonInput.RejectTopLevelNull

+ 0 - 32
conformance/failure_list_python_cpp.txt

@@ -20,35 +20,3 @@ Required.Proto3.JsonInput.FloatFieldTooLarge
 Required.Proto3.JsonInput.FloatFieldTooSmall
 Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingIntegersGotBool
 Required.Proto3.JsonInput.TimestampJsonInputLowercaseT
-Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
-Required.Proto3.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.BOOL
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.DOUBLE
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.ENUM
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED32
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.FIXED64
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.FLOAT
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT32
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.INT64
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED32
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.SFIXED64
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT32
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.SINT64
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT32
-Required.Proto3.ProtobufInput.PrematureEofInPackedField.UINT64
-Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownNonRepeatedValue.MESSAGE
-Required.Proto2.ProtobufInput.PrematureEofInDelimitedDataForKnownRepeatedValue.MESSAGE
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.BOOL
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.DOUBLE
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.ENUM
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED32
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.FIXED64
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.FLOAT
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT32
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.INT64
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED32
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.SFIXED64
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT32
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.SINT64
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT32
-Required.Proto2.ProtobufInput.PrematureEofInPackedField.UINT64

+ 2 - 75
conformance/failure_list_ruby.txt

@@ -5,8 +5,7 @@ Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
 Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
 Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
 Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator
-Recommended.Proto3.JsonInput.DurationHas9FractionalDigits.Validator
-Recommended.Proto3.JsonInput.DurationHasZeroFractionalDigit.Validator
+Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter
 Recommended.Proto3.JsonInput.Int64FieldBeString.Validator
 Recommended.Proto3.JsonInput.MapFieldValueIsNull
 Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull
@@ -17,115 +16,42 @@ Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate
 Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate
 Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator
 Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator
-Recommended.Proto3.JsonInput.TimestampHas9FractionalDigits.Validator
-Recommended.Proto3.JsonInput.TimestampHasZeroFractionalDigit.Validator
-Recommended.Proto3.JsonInput.TimestampZeroNormalized.Validator
 Recommended.Proto3.JsonInput.Uint64FieldBeString.Validator
 Required.DurationProtoInputTooLarge.JsonOutput
 Required.DurationProtoInputTooSmall.JsonOutput
-Required.Proto3.JsonInput.Any.JsonOutput
-Required.Proto3.JsonInput.Any.ProtobufOutput
-Required.Proto3.JsonInput.AnyNested.JsonOutput
-Required.Proto3.JsonInput.AnyNested.ProtobufOutput
-Required.Proto3.JsonInput.AnyUnorderedTypeTag.JsonOutput
-Required.Proto3.JsonInput.AnyUnorderedTypeTag.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithDuration.JsonOutput
-Required.Proto3.JsonInput.AnyWithDuration.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithFieldMask.JsonOutput
-Required.Proto3.JsonInput.AnyWithFieldMask.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.JsonOutput
-Required.Proto3.JsonInput.AnyWithInt32ValueWrapper.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithStruct.JsonOutput
-Required.Proto3.JsonInput.AnyWithStruct.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithTimestamp.JsonOutput
-Required.Proto3.JsonInput.AnyWithTimestamp.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithValueForInteger.JsonOutput
-Required.Proto3.JsonInput.AnyWithValueForInteger.ProtobufOutput
-Required.Proto3.JsonInput.AnyWithValueForJsonObject.JsonOutput
-Required.Proto3.JsonInput.AnyWithValueForJsonObject.ProtobufOutput
 Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput
 Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput
 Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.JsonOutput
 Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput
 Required.Proto3.JsonInput.DoubleFieldNan.JsonOutput
-Required.Proto3.JsonInput.DurationMaxValue.JsonOutput
-Required.Proto3.JsonInput.DurationMaxValue.ProtobufOutput
 Required.Proto3.JsonInput.DurationMinValue.JsonOutput
-Required.Proto3.JsonInput.DurationMinValue.ProtobufOutput
 Required.Proto3.JsonInput.DurationRepeatedValue.JsonOutput
-Required.Proto3.JsonInput.DurationRepeatedValue.ProtobufOutput
-Required.Proto3.JsonInput.FieldMask.JsonOutput
-Required.Proto3.JsonInput.FieldMask.ProtobufOutput
 Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput
 Required.Proto3.JsonInput.FloatFieldNan.JsonOutput
 Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput
 Required.Proto3.JsonInput.OneofFieldDuplicate
 Required.Proto3.JsonInput.OptionalBoolWrapper.JsonOutput
-Required.Proto3.JsonInput.OptionalBoolWrapper.ProtobufOutput
 Required.Proto3.JsonInput.OptionalBytesWrapper.JsonOutput
-Required.Proto3.JsonInput.OptionalBytesWrapper.ProtobufOutput
 Required.Proto3.JsonInput.OptionalDoubleWrapper.JsonOutput
-Required.Proto3.JsonInput.OptionalDoubleWrapper.ProtobufOutput
 Required.Proto3.JsonInput.OptionalFloatWrapper.JsonOutput
-Required.Proto3.JsonInput.OptionalFloatWrapper.ProtobufOutput
 Required.Proto3.JsonInput.OptionalInt32Wrapper.JsonOutput
-Required.Proto3.JsonInput.OptionalInt32Wrapper.ProtobufOutput
 Required.Proto3.JsonInput.OptionalInt64Wrapper.JsonOutput
-Required.Proto3.JsonInput.OptionalInt64Wrapper.ProtobufOutput
 Required.Proto3.JsonInput.OptionalStringWrapper.JsonOutput
-Required.Proto3.JsonInput.OptionalStringWrapper.ProtobufOutput
 Required.Proto3.JsonInput.OptionalUint32Wrapper.JsonOutput
-Required.Proto3.JsonInput.OptionalUint32Wrapper.ProtobufOutput
 Required.Proto3.JsonInput.OptionalUint64Wrapper.JsonOutput
-Required.Proto3.JsonInput.OptionalUint64Wrapper.ProtobufOutput
 Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput
 Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput
 Required.Proto3.JsonInput.RepeatedBoolWrapper.JsonOutput
-Required.Proto3.JsonInput.RepeatedBoolWrapper.ProtobufOutput
 Required.Proto3.JsonInput.RepeatedBytesWrapper.JsonOutput
-Required.Proto3.JsonInput.RepeatedBytesWrapper.ProtobufOutput
 Required.Proto3.JsonInput.RepeatedDoubleWrapper.JsonOutput
-Required.Proto3.JsonInput.RepeatedDoubleWrapper.ProtobufOutput
 Required.Proto3.JsonInput.RepeatedFloatWrapper.JsonOutput
-Required.Proto3.JsonInput.RepeatedFloatWrapper.ProtobufOutput
 Required.Proto3.JsonInput.RepeatedInt32Wrapper.JsonOutput
-Required.Proto3.JsonInput.RepeatedInt32Wrapper.ProtobufOutput
 Required.Proto3.JsonInput.RepeatedInt64Wrapper.JsonOutput
-Required.Proto3.JsonInput.RepeatedInt64Wrapper.ProtobufOutput
 Required.Proto3.JsonInput.RepeatedStringWrapper.JsonOutput
-Required.Proto3.JsonInput.RepeatedStringWrapper.ProtobufOutput
 Required.Proto3.JsonInput.RepeatedUint32Wrapper.JsonOutput
-Required.Proto3.JsonInput.RepeatedUint32Wrapper.ProtobufOutput
 Required.Proto3.JsonInput.RepeatedUint64Wrapper.JsonOutput
-Required.Proto3.JsonInput.RepeatedUint64Wrapper.ProtobufOutput
 Required.Proto3.JsonInput.StringFieldSurrogatePair.JsonOutput
 Required.Proto3.JsonInput.StringFieldSurrogatePair.ProtobufOutput
-Required.Proto3.JsonInput.Struct.JsonOutput
-Required.Proto3.JsonInput.Struct.ProtobufOutput
-Required.Proto3.JsonInput.TimestampMaxValue.JsonOutput
-Required.Proto3.JsonInput.TimestampMaxValue.ProtobufOutput
-Required.Proto3.JsonInput.TimestampMinValue.JsonOutput
-Required.Proto3.JsonInput.TimestampMinValue.ProtobufOutput
-Required.Proto3.JsonInput.TimestampRepeatedValue.JsonOutput
-Required.Proto3.JsonInput.TimestampRepeatedValue.ProtobufOutput
-Required.Proto3.JsonInput.TimestampWithNegativeOffset.JsonOutput
-Required.Proto3.JsonInput.TimestampWithNegativeOffset.ProtobufOutput
-Required.Proto3.JsonInput.TimestampWithPositiveOffset.JsonOutput
-Required.Proto3.JsonInput.TimestampWithPositiveOffset.ProtobufOutput
-Required.Proto3.JsonInput.ValueAcceptBool.JsonOutput
-Required.Proto3.JsonInput.ValueAcceptBool.ProtobufOutput
-Required.Proto3.JsonInput.ValueAcceptFloat.JsonOutput
-Required.Proto3.JsonInput.ValueAcceptFloat.ProtobufOutput
-Required.Proto3.JsonInput.ValueAcceptInteger.JsonOutput
-Required.Proto3.JsonInput.ValueAcceptInteger.ProtobufOutput
-Required.Proto3.JsonInput.ValueAcceptList.JsonOutput
-Required.Proto3.JsonInput.ValueAcceptList.ProtobufOutput
-Required.Proto3.JsonInput.ValueAcceptNull.JsonOutput
-Required.Proto3.JsonInput.ValueAcceptNull.ProtobufOutput
-Required.Proto3.JsonInput.ValueAcceptObject.JsonOutput
-Required.Proto3.JsonInput.ValueAcceptObject.ProtobufOutput
-Required.Proto3.JsonInput.ValueAcceptString.JsonOutput
-Required.Proto3.JsonInput.ValueAcceptString.ProtobufOutput
 Required.Proto3.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput
 Required.Proto3.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput
 Required.Proto3.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput
@@ -139,3 +65,4 @@ Required.Proto3.JsonInput.IgnoreUnknownJsonNumber.ProtobufOutput
 Required.Proto3.JsonInput.IgnoreUnknownJsonObject.ProtobufOutput
 Required.Proto3.JsonInput.IgnoreUnknownJsonString.ProtobufOutput
 Required.Proto3.JsonInput.IgnoreUnknownJsonTrue.ProtobufOutput
+Required.Proto3.JsonInput.RejectTopLevelNull

+ 73 - 0
conformance/failure_list_ruby_mac.txt

@@ -0,0 +1,73 @@
+Recommended.FieldMaskNumbersDontRoundTrip.JsonOutput
+Recommended.FieldMaskPathsDontRoundTrip.JsonOutput
+Recommended.FieldMaskTooManyUnderscore.JsonOutput
+Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
+Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
+Recommended.Proto3.JsonInput.DurationHas3FractionalDigits.Validator
+Recommended.Proto3.JsonInput.DurationHas6FractionalDigits.Validator
+Recommended.Proto3.JsonInput.Int64FieldBeString.Validator
+Recommended.Proto3.JsonInput.MapFieldValueIsNull
+Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull
+Recommended.Proto3.JsonInput.RepeatedFieldPrimitiveElementIsNull
+Recommended.Proto3.JsonInput.StringEndsWithEscapeChar
+Recommended.Proto3.JsonInput.StringFieldSurrogateInWrongOrder
+Recommended.Proto3.JsonInput.StringFieldUnpairedHighSurrogate
+Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate
+Recommended.Proto3.JsonInput.TimestampHas3FractionalDigits.Validator
+Recommended.Proto3.JsonInput.TimestampHas6FractionalDigits.Validator
+Recommended.Proto3.JsonInput.Uint64FieldBeString.Validator
+Required.DurationProtoInputTooLarge.JsonOutput
+Required.DurationProtoInputTooSmall.JsonOutput
+Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.JsonOutput
+Required.Proto3.JsonInput.DoubleFieldMaxNegativeValue.ProtobufOutput
+Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.JsonOutput
+Required.Proto3.JsonInput.DoubleFieldMinPositiveValue.ProtobufOutput
+Required.Proto3.JsonInput.DoubleFieldNan.JsonOutput
+Required.Proto3.JsonInput.DurationMinValue.JsonOutput
+Required.Proto3.JsonInput.DurationRepeatedValue.JsonOutput
+Required.Proto3.JsonInput.FloatFieldInfinity.JsonOutput
+Required.Proto3.JsonInput.FloatFieldNan.JsonOutput
+Required.Proto3.JsonInput.FloatFieldNegativeInfinity.JsonOutput
+Required.Proto3.JsonInput.OneofFieldDuplicate
+Required.Proto3.JsonInput.OptionalBoolWrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalBytesWrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalDoubleWrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalFloatWrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalInt32Wrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalInt64Wrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalStringWrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalUint32Wrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalUint64Wrapper.JsonOutput
+Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.JsonOutput
+Required.Proto3.JsonInput.OptionalWrapperTypesWithNonDefaultValue.ProtobufOutput
+Required.Proto3.JsonInput.RepeatedBoolWrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedBytesWrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedDoubleWrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedFloatWrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedInt32Wrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedInt64Wrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedStringWrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedUint32Wrapper.JsonOutput
+Required.Proto3.JsonInput.RepeatedUint64Wrapper.JsonOutput
+Required.Proto3.JsonInput.StringFieldSurrogatePair.JsonOutput
+Required.Proto3.JsonInput.StringFieldSurrogatePair.ProtobufOutput
+Required.Proto3.JsonInput.TimestampJsonInputTooSmall
+Required.Proto3.JsonInput.TimestampMinValue.JsonOutput
+Required.Proto3.JsonInput.TimestampMinValue.ProtobufOutput
+Required.Proto3.JsonInput.TimestampRepeatedValue.JsonOutput
+Required.Proto3.JsonInput.TimestampRepeatedValue.ProtobufOutput
+Required.Proto3.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput
+Required.Proto3.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput
+Required.Proto3.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput
+Required.Proto3.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput
+Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.JsonOutput
+Required.TimestampProtoInputTooLarge.JsonOutput
+Required.TimestampProtoInputTooSmall.JsonOutput
+Required.Proto3.JsonInput.IgnoreUnknownJsonFalse.ProtobufOutput
+Required.Proto3.JsonInput.IgnoreUnknownJsonNull.ProtobufOutput
+Required.Proto3.JsonInput.IgnoreUnknownJsonNumber.ProtobufOutput
+Required.Proto3.JsonInput.IgnoreUnknownJsonObject.ProtobufOutput
+Required.Proto3.JsonInput.IgnoreUnknownJsonString.ProtobufOutput
+Required.Proto3.JsonInput.IgnoreUnknownJsonTrue.ProtobufOutput
+Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter
+Required.Proto3.JsonInput.RejectTopLevelNull

+ 317 - 0
conformance/text_format_conformance_suite.cc

@@ -0,0 +1,317 @@
+// Protocol Buffers - Google's data interchange format
+// Copyright 2008 Google Inc.  All rights reserved.
+// https://developers.google.com/protocol-buffers/
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#include "text_format_conformance_suite.h"
+
+#include "conformance_test.h"
+
+#include <google/protobuf/any.pb.h>
+#include <google/protobuf/test_messages_proto2.pb.h>
+#include <google/protobuf/test_messages_proto3.pb.h>
+#include <google/protobuf/text_format.h>
+
+using conformance::ConformanceRequest;
+using conformance::ConformanceResponse;
+using conformance::WireFormat;
+using google::protobuf::Message;
+using google::protobuf::TextFormat;
+using protobuf_test_messages::proto2::TestAllTypesProto2;
+using protobuf_test_messages::proto2::UnknownToTestAllTypes;
+using protobuf_test_messages::proto3::TestAllTypesProto3;
+using std::string;
+
+namespace google {
+namespace protobuf {
+
+TextFormatConformanceTestSuite::TextFormatConformanceTestSuite() {
+  SetFailureListFlagName("--text_format_failure_list");
+}
+
+bool TextFormatConformanceTestSuite::ParseTextFormatResponse(
+    const ConformanceResponse& response,
+    const ConformanceRequestSetting& setting, Message* test_message) {
+  TextFormat::Parser parser;
+  const ConformanceRequest& request = setting.GetRequest();
+  if (request.print_unknown_fields()) {
+    parser.AllowFieldNumber(true);
+  }
+  if (!parser.ParseFromString(response.text_payload(), test_message)) {
+    GOOGLE_LOG(ERROR) << "INTERNAL ERROR: internal text->protobuf transcode "
+                      << "yielded unparseable proto. Text payload: "
+                      << response.text_payload();
+    return false;
+  }
+
+  return true;
+}
+
+bool TextFormatConformanceTestSuite::ParseResponse(
+    const ConformanceResponse& response,
+    const ConformanceRequestSetting& setting, Message* test_message) {
+  const ConformanceRequest& request = setting.GetRequest();
+  WireFormat requested_output = request.requested_output_format();
+  const string& test_name = setting.GetTestName();
+  ConformanceLevel level = setting.GetLevel();
+
+  switch (response.result_case()) {
+    case ConformanceResponse::kProtobufPayload: {
+      if (requested_output != conformance::PROTOBUF) {
+        ReportFailure(
+            test_name, level, request, response,
+            StrCat("Test was asked for ", WireFormatToString(requested_output),
+                   " output but provided PROTOBUF instead.")
+                .c_str());
+        return false;
+      }
+
+      if (!test_message->ParseFromString(response.protobuf_payload())) {
+        ReportFailure(test_name, level, request, response,
+                      "Protobuf output we received from test was unparseable.");
+        return false;
+      }
+
+      break;
+    }
+
+    case ConformanceResponse::kTextPayload: {
+      if (requested_output != conformance::TEXT_FORMAT) {
+        ReportFailure(
+            test_name, level, request, response,
+            StrCat("Test was asked for ", WireFormatToString(requested_output),
+                   " output but provided TEXT_FORMAT instead.")
+                .c_str());
+        return false;
+      }
+
+      if (!ParseTextFormatResponse(response, setting, test_message)) {
+        ReportFailure(
+            test_name, level, request, response,
+            "TEXT_FORMAT output we received from test was unparseable.");
+        return false;
+      }
+
+      break;
+    }
+
+    default:
+      GOOGLE_LOG(FATAL) << test_name
+                        << ": unknown payload type: " << response.result_case();
+  }
+
+  return true;
+}
+
+void TextFormatConformanceTestSuite::ExpectParseFailure(const string& test_name,
+                                                        ConformanceLevel level,
+                                                        const string& input) {
+  TestAllTypesProto3 prototype;
+  // We don't expect output, but if the program erroneously accepts the protobuf
+  // we let it send its response as this.  We must not leave it unspecified.
+  ConformanceRequestSetting setting(
+      level, conformance::TEXT_FORMAT, conformance::TEXT_FORMAT,
+      conformance::TEXT_FORMAT_TEST, prototype, test_name, input);
+  const ConformanceRequest& request = setting.GetRequest();
+  ConformanceResponse response;
+  string effective_test_name = StrCat(setting.ConformanceLevelToString(level),
+                                      ".Proto3.TextFormatInput.", test_name);
+
+  RunTest(effective_test_name, request, &response);
+  if (response.result_case() == ConformanceResponse::kParseError) {
+    ReportSuccess(effective_test_name);
+  } else if (response.result_case() == ConformanceResponse::kSkipped) {
+    ReportSkip(effective_test_name, request, response);
+  } else {
+    ReportFailure(effective_test_name, level, request, response,
+                  "Should have failed to parse, but didn't.");
+  }
+}
+
+void TextFormatConformanceTestSuite::RunValidTextFormatTest(
+    const string& test_name, ConformanceLevel level, const string& input_text) {
+  TestAllTypesProto3 prototype;
+  RunValidTextFormatTestWithMessage(test_name, level, input_text, prototype);
+}
+
+void TextFormatConformanceTestSuite::RunValidTextFormatTestProto2(
+    const string& test_name, ConformanceLevel level, const string& input_text) {
+  TestAllTypesProto2 prototype;
+  RunValidTextFormatTestWithMessage(test_name, level, input_text, prototype);
+}
+
+void TextFormatConformanceTestSuite::RunValidTextFormatTestWithMessage(
+    const string& test_name, ConformanceLevel level, const string& input_text,
+    const Message& prototype) {
+  ConformanceRequestSetting setting1(
+      level, conformance::TEXT_FORMAT, conformance::PROTOBUF,
+      conformance::TEXT_FORMAT_TEST, prototype, test_name, input_text);
+  RunValidInputTest(setting1, input_text);
+  ConformanceRequestSetting setting2(
+      level, conformance::TEXT_FORMAT, conformance::TEXT_FORMAT,
+      conformance::TEXT_FORMAT_TEST, prototype, test_name, input_text);
+  RunValidInputTest(setting2, input_text);
+}
+
+void TextFormatConformanceTestSuite::RunValidUnknownTextFormatTest(
+    const string& test_name, const Message& message) {
+  string serialized_input;
+  message.SerializeToString(&serialized_input);
+  TestAllTypesProto3 prototype;
+  ConformanceRequestSetting setting1(
+      RECOMMENDED, conformance::PROTOBUF, conformance::TEXT_FORMAT,
+      conformance::TEXT_FORMAT_TEST, prototype, test_name + "_Drop",
+      serialized_input);
+  setting1.SetPrototypeMessageForCompare(message);
+  RunValidBinaryInputTest(setting1, "");
+
+  ConformanceRequestSetting setting2(
+      RECOMMENDED, conformance::PROTOBUF, conformance::TEXT_FORMAT,
+      conformance::TEXT_FORMAT_TEST, prototype, test_name + "_Print",
+      serialized_input);
+  setting2.SetPrototypeMessageForCompare(message);
+  setting2.SetPrintUnknownFields(true);
+  RunValidBinaryInputTest(setting2, serialized_input);
+}
+
+void TextFormatConformanceTestSuite::RunSuiteImpl() {
+  RunValidTextFormatTest("HelloWorld", REQUIRED,
+                         "optional_string: 'Hello, World!'");
+  // Integer fields.
+  RunValidTextFormatTest("Int32FieldMaxValue", REQUIRED,
+                         "optional_int32: 2147483647");
+  RunValidTextFormatTest("Int32FieldMinValue", REQUIRED,
+                         "optional_int32: -2147483648");
+  RunValidTextFormatTest("Uint32FieldMaxValue", REQUIRED,
+                         "optional_uint32: 4294967295");
+  RunValidTextFormatTest("Int64FieldMaxValue", REQUIRED,
+                         "optional_int64: 9223372036854775807");
+  RunValidTextFormatTest("Int64FieldMinValue", REQUIRED,
+                         "optional_int64: -9223372036854775808");
+  RunValidTextFormatTest("Uint64FieldMaxValue", REQUIRED,
+                         "optional_uint64: 18446744073709551615");
+
+  // Parsers reject out-of-bound integer values.
+  ExpectParseFailure("Int32FieldTooLarge", REQUIRED,
+                     "optional_int32: 2147483648");
+  ExpectParseFailure("Int32FieldTooSmall", REQUIRED,
+                     "optional_int32: -2147483649");
+  ExpectParseFailure("Uint32FieldTooLarge", REQUIRED,
+                     "optional_uint32: 4294967296");
+  ExpectParseFailure("Int64FieldTooLarge", REQUIRED,
+                     "optional_int64: 9223372036854775808");
+  ExpectParseFailure("Int64FieldTooSmall", REQUIRED,
+                     "optional_int64: -9223372036854775809");
+  ExpectParseFailure("Uint64FieldTooLarge", REQUIRED,
+                     "optional_uint64: 18446744073709551616");
+
+  // Floating point fields
+  RunValidTextFormatTest("FloatField", REQUIRED,
+                         "optional_float: 3.192837");
+  RunValidTextFormatTest("FloatFieldWithVeryPreciseNumber", REQUIRED,
+                         "optional_float: 3.123456789123456789");
+  RunValidTextFormatTest("FloatFieldMaxValue", REQUIRED,
+                         "optional_float: 3.4028235e+38");
+  RunValidTextFormatTest("FloatFieldMinValue", REQUIRED,
+                         "optional_float: 1.17549e-38");
+  RunValidTextFormatTest("FloatFieldNaNValue", REQUIRED,
+                         "optional_float: NaN");
+  RunValidTextFormatTest("FloatFieldPosInfValue", REQUIRED,
+                         "optional_float: inf");
+  RunValidTextFormatTest("FloatFieldNegInfValue", REQUIRED,
+                         "optional_float: -inf");
+  RunValidTextFormatTest("FloatFieldWithInt32Max", REQUIRED,
+                         "optional_float: 4294967296");
+  RunValidTextFormatTest("FloatFieldLargerThanInt64", REQUIRED,
+                         "optional_float: 9223372036854775808");
+  RunValidTextFormatTest("FloatFieldTooLarge", REQUIRED,
+                         "optional_float: 3.4028235e+39");
+  RunValidTextFormatTest("FloatFieldTooSmall", REQUIRED,
+                         "optional_float: 1.17549e-39");
+  RunValidTextFormatTest("FloatFieldLargerThanUint64", REQUIRED,
+                         "optional_float: 18446744073709551616");
+
+  // Group fields
+  RunValidTextFormatTestProto2("GroupFieldNoColon", REQUIRED,
+                               "Data { group_int32: 1 }");
+  RunValidTextFormatTestProto2("GroupFieldWithColon", REQUIRED,
+                               "Data: { group_int32: 1 }");
+  RunValidTextFormatTestProto2("GroupFieldEmpty", REQUIRED,
+                               "Data {}");
+
+
+  // Unknown Fields
+  UnknownToTestAllTypes message;
+  // Unable to print unknown Fixed32/Fixed64 fields as if they are known.
+  // Fixed32/Fixed64 fields are not added in the tests.
+  message.set_optional_int32(123);
+  message.set_optional_string("hello");
+  message.set_optional_bool(true);
+  RunValidUnknownTextFormatTest("ScalarUnknownFields", message);
+
+  message.Clear();
+  message.mutable_nested_message()->set_c(111);
+  RunValidUnknownTextFormatTest("MessageUnknownFields", message);
+
+  message.Clear();
+  message.mutable_optionalgroup()->set_a(321);
+  RunValidUnknownTextFormatTest("GroupUnknownFields", message);
+
+  message.add_repeated_int32(1);
+  message.add_repeated_int32(2);
+  message.add_repeated_int32(3);
+  RunValidUnknownTextFormatTest("RepeatedUnknownFields", message);
+
+  // Any fields
+  RunValidTextFormatTest("AnyField", REQUIRED,
+                         R"(
+      optional_any: {
+        [type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3] {
+          optional_int32: 12345
+        }
+      }
+      )");
+  RunValidTextFormatTest("AnyFieldWithRawBytes", REQUIRED,
+                         R"(
+      optional_any: {
+        type_url: "type.googleapis.com/protobuf_test_messages.proto3.TestAllTypesProto3"
+        value: "\b\271`"
+      }
+      )");
+  ExpectParseFailure("AnyFieldWithInvalidType", REQUIRED,
+                     R"(
+      optional_any: {
+        [type.googleapis.com/unknown] {
+          optional_int32: 12345
+        }
+      }
+      )");
+}
+
+}  // namespace protobuf
+}  // namespace google

+ 26 - 61
python/google/protobuf/pyext/thread_unsafe_shared_ptr.h → conformance/text_format_conformance_suite.h

@@ -28,77 +28,42 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-// ThreadUnsafeSharedPtr<T> is the same as shared_ptr<T> without the locking
-// overhread (and thread-safety).
-#ifndef GOOGLE_PROTOBUF_PYTHON_CPP_THREAD_UNSAFE_SHARED_PTR_H__
-#define GOOGLE_PROTOBUF_PYTHON_CPP_THREAD_UNSAFE_SHARED_PTR_H__
+#ifndef TEXT_FORMAT_CONFORMANCE_SUITE_H_
+#define TEXT_FORMAT_CONFORMANCE_SUITE_H_
 
-#include <algorithm>
-#include <utility>
-
-#include <google/protobuf/stubs/logging.h>
-#include <google/protobuf/stubs/common.h>
+#include "conformance_test.h"
 
 namespace google {
 namespace protobuf {
-namespace python {
 
-template <typename T>
-class ThreadUnsafeSharedPtr {
+class TextFormatConformanceTestSuite : public ConformanceTestSuite {
  public:
-  // Takes ownership.
-  explicit ThreadUnsafeSharedPtr(T* ptr)
-      : ptr_(ptr), refcount_(ptr ? new RefcountT(1) : nullptr) {
-  }
-
-  ThreadUnsafeSharedPtr(const ThreadUnsafeSharedPtr& other)
-      : ThreadUnsafeSharedPtr(nullptr) {
-    *this = other;
-  }
-
-  ThreadUnsafeSharedPtr& operator=(const ThreadUnsafeSharedPtr& other) {
-    if (other.refcount_ == refcount_) {
-      return *this;
-    }
-    this->~ThreadUnsafeSharedPtr();
-    ptr_ = other.ptr_;
-    refcount_ = other.refcount_;
-    if (refcount_) {
-      ++*refcount_;
-    }
-    return *this;
-  }
-
-  ~ThreadUnsafeSharedPtr() {
-    if (refcount_ == nullptr) {
-      GOOGLE_DCHECK(ptr_ == nullptr);
-      return;
-    }
-    if (--*refcount_ == 0) {
-      delete refcount_;
-      delete ptr_;
-    }
-  }
-
-  void reset(T* ptr = nullptr) { *this = ThreadUnsafeSharedPtr(ptr); }
-
-  T* get() { return ptr_; }
-  const T* get() const { return ptr_; }
-
-  void swap(ThreadUnsafeSharedPtr& other) {
-    using std::swap;
-    swap(ptr_, other.ptr_);
-    swap(refcount_, other.refcount_);
-  }
+  TextFormatConformanceTestSuite();
 
  private:
-  typedef int RefcountT;
-  T* ptr_;
-  RefcountT* refcount_;
+  void RunSuiteImpl();
+  void RunValidTextFormatTest(const string& test_name, ConformanceLevel level,
+                              const string& input);
+  void RunValidTextFormatTestProto2(const string& test_name,
+                                    ConformanceLevel level,
+                                    const string& input);
+  void RunValidTextFormatTestWithMessage(const string& test_name,
+                                         ConformanceLevel level,
+                                         const string& input_text,
+                                         const Message& prototype);
+  void RunValidUnknownTextFormatTest(const string& test_name,
+                                     const Message& message);
+  void ExpectParseFailure(const string& test_name, ConformanceLevel level,
+                          const string& input);
+  bool ParseTextFormatResponse(const conformance::ConformanceResponse& response,
+                               const ConformanceRequestSetting& setting,
+                               Message* test_message);
+  bool ParseResponse(const conformance::ConformanceResponse& response,
+                     const ConformanceRequestSetting& setting,
+                     Message* test_message) override;
 };
 
-}  // namespace python
 }  // namespace protobuf
 }  // namespace google
 
-#endif  // GOOGLE_PROTOBUF_PYTHON_CPP_THREAD_UNSAFE_SHARED_PTR_H__
+#endif  // TEXT_FORMAT_CONFORMANCE_SUITE_H_

+ 8 - 0
conformance/text_format_failure_list_csharp.txt

@@ -0,0 +1,8 @@
+Recommended.Proto3.ProtobufInput.GroupUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.GroupUnknownFields_Print.TextFormatOutput
+Recommended.Proto3.ProtobufInput.MessageUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.MessageUnknownFields_Print.TextFormatOutput
+Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Print.TextFormatOutput
+Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Print.TextFormatOutput

+ 6 - 0
conformance/text_format_failure_list_java.txt

@@ -0,0 +1,6 @@
+Recommended.Proto3.ProtobufInput.GroupUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.MessageUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Drop.TextFormatOutput
+Required.Proto3.TextFormatInput.AnyField.ProtobufOutput
+Required.Proto3.TextFormatInput.AnyField.TextFormatOutput

+ 8 - 0
conformance/text_format_failure_list_php.txt

@@ -0,0 +1,8 @@
+Recommended.Proto3.ProtobufInput.GroupUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.GroupUnknownFields_Print.TextFormatOutput
+Recommended.Proto3.ProtobufInput.MessageUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.MessageUnknownFields_Print.TextFormatOutput
+Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Print.TextFormatOutput
+Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Print.TextFormatOutput

+ 5 - 0
conformance/text_format_failure_list_python.txt

@@ -0,0 +1,5 @@
+# This is the list of text format conformance tests that are known to fail right
+# now.
+# TODO: These should be fixed.
+Required.Proto3.TextFormatInput.FloatFieldMaxValue.ProtobufOutput
+Required.Proto3.TextFormatInput.FloatFieldMaxValue.TextFormatOutput

+ 8 - 0
conformance/text_format_failure_list_ruby.txt

@@ -0,0 +1,8 @@
+Recommended.Proto3.ProtobufInput.GroupUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.GroupUnknownFields_Print.TextFormatOutput
+Recommended.Proto3.ProtobufInput.MessageUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.MessageUnknownFields_Print.TextFormatOutput
+Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.RepeatedUnknownFields_Print.TextFormatOutput
+Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Drop.TextFormatOutput
+Recommended.Proto3.ProtobufInput.ScalarUnknownFields_Print.TextFormatOutput

+ 10 - 10
conformance/third_party/jsoncpp/json.h

@@ -6,28 +6,28 @@
 // //////////////////////////////////////////////////////////////////////
 
 /*
-The JsonCpp library's source code, including accompanying documentation, 
+The JsonCpp library's source code, including accompanying documentation,
 tests and demonstration applications, are licensed under the following
 conditions...
 
-The author (Baptiste Lepilleur) explicitly disclaims copyright in all 
-jurisdictions which recognize such a disclaimer. In such jurisdictions, 
+The author (Baptiste Lepilleur) explicitly disclaims copyright in all
+jurisdictions which recognize such a disclaimer. In such jurisdictions,
 this software is released into the Public Domain.
 
 In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
 released under the terms of the MIT License (see below).
 
-In jurisdictions which recognize Public Domain property, the user of this 
-software may choose to accept it either as 1) Public Domain, 2) under the 
-conditions of the MIT License (see below), or 3) under the terms of dual 
+In jurisdictions which recognize Public Domain property, the user of this
+software may choose to accept it either as 1) Public Domain, 2) under the
+conditions of the MIT License (see below), or 3) under the terms of dual
 Public Domain/MIT License conditions described here, as they choose.
 
 The MIT License is about as close to Public Domain as a license can get, and is
 described in clear, concise terms at:
 
    http://en.wikipedia.org/wiki/MIT_License
-   
+
 The full text of the MIT License follows:
 
 ========================================================================
@@ -434,7 +434,7 @@ protected:
 /** Exceptions which the user cannot easily avoid.
  *
  * E.g. out-of-memory (when we use malloc), stack-overflow, malicious input
- * 
+ *
  * \remark derived from Json::Exception
  */
 class JSON_API RuntimeError : public Exception {
@@ -445,7 +445,7 @@ public:
 /** Exceptions thrown by JSON_ASSERT/JSON_FAIL macros.
  *
  * These are precondition-violations (user bugs) and internal errors (our bugs).
- * 
+ *
  * \remark derived from Json::Exception
  */
 class JSON_API LogicError : public Exception {
@@ -1570,7 +1570,7 @@ public:
     - `"rejectDupKeys": false or true`
       - If true, `parse()` returns false when a key is duplicated within an object.
     - `"allowSpecialFloats": false or true`
-      - If true, special float values (NaNs and infinities) are allowed 
+      - If true, special float values (NaNs and infinities) are allowed
         and their values are lossfree restorable.
 
     You can examine 'settings_` yourself

+ 10 - 10
conformance/third_party/jsoncpp/jsoncpp.cpp

@@ -6,28 +6,28 @@
 // //////////////////////////////////////////////////////////////////////
 
 /*
-The JsonCpp library's source code, including accompanying documentation, 
+The JsonCpp library's source code, including accompanying documentation,
 tests and demonstration applications, are licensed under the following
 conditions...
 
-The author (Baptiste Lepilleur) explicitly disclaims copyright in all 
-jurisdictions which recognize such a disclaimer. In such jurisdictions, 
+The author (Baptiste Lepilleur) explicitly disclaims copyright in all
+jurisdictions which recognize such a disclaimer. In such jurisdictions,
 this software is released into the Public Domain.
 
 In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur, and is
 released under the terms of the MIT License (see below).
 
-In jurisdictions which recognize Public Domain property, the user of this 
-software may choose to accept it either as 1) Public Domain, 2) under the 
-conditions of the MIT License (see below), or 3) under the terms of dual 
+In jurisdictions which recognize Public Domain property, the user of this
+software may choose to accept it either as 1) Public Domain, 2) under the
+conditions of the MIT License (see below), or 3) under the terms of dual
 Public Domain/MIT License conditions described here, as they choose.
 
 The MIT License is about as close to Public Domain as a license can get, and is
 described in clear, concise terms at:
 
    http://en.wikipedia.org/wiki/MIT_License
-   
+
 The full text of the MIT License follows:
 
 ========================================================================
@@ -207,7 +207,7 @@ static inline void fixNumericLocale(char* begin, char* end) {
 #include <limits>
 
 #if defined(_MSC_VER)
-#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above 
+#if !defined(WINCE) && defined(__STDC_SECURE_LIB__) && _MSC_VER >= 1500 // VC++ 9.0 and above
 #define snprintf sprintf_s
 #elif _MSC_VER >= 1900 // VC++ 14.0 and above
 #define snprintf std::snprintf
@@ -4029,7 +4029,7 @@ Value& Path::make(Value& root) const {
 #define snprintf std::snprintf
 #endif
 
-#if defined(__BORLANDC__)  
+#if defined(__BORLANDC__)
 #include <float.h>
 #define isfinite _finite
 #define snprintf _snprintf
@@ -5096,7 +5096,7 @@ StreamWriter* StreamWriterBuilder::newStreamWriter() const
   std::string cs_str = settings_["commentStyle"].asString();
   bool eyc = settings_["enableYAMLCompatibility"].asBool();
   bool dnp = settings_["dropNullPlaceholders"].asBool();
-  bool usf = settings_["useSpecialFloats"].asBool(); 
+  bool usf = settings_["useSpecialFloats"].asBool();
   unsigned int pre = settings_["precision"].asUInt();
   CommentStyle::Enum cs = CommentStyle::All;
   if (cs_str == "All") {

+ 3 - 0
csharp/.gitignore

@@ -29,3 +29,6 @@ mono/*.exe
 mono/*.dll
 lib/protoc.exe
 *.ncrunch*
+
+# Benchmark output
+BenchmarkDotNet.Artifacts/

+ 9 - 9
csharp/CHANGES.txt

@@ -26,7 +26,7 @@ Changes:
 - Optimized enum parsing.
 
 Fixes:
-- Fix for bug in limited input stream's Position, Introduced Position on 
+- Fix for bug in limited input stream's Position, Introduced Position on
   output stream
 - Fix for writing a character to a JSON output overflows allocated buffer
 - Optimize FromBase64String to return Empty when presented with empty string.
@@ -47,14 +47,14 @@ Changes:
 - Added 'Unsafe' static type in ByteString to allow direct buffer access
 
 Fixes:
-- Issue 50: The XML serializer will fail to deserialize a message with empty 
+- Issue 50: The XML serializer will fail to deserialize a message with empty
   child message
 - Issue 45: Use of 'item' as a field name causes AmbiguousMatchException
 - Issue 49: Generated nested static Types class should be partial
 - Issue 38: Disable CLSCompliant warnings (3021)
 - Issue 40: proto_path does not work for command-line file names
 - Issue 54: should retire all bytes in buffer (bufferSize)
-- Issue 43: Fix to correct identical 'umbrella_classname' options from trying 
+- Issue 43: Fix to correct identical 'umbrella_classname' options from trying
   to write to the same filename.
 
 ===============================================================================
@@ -66,7 +66,7 @@ Features:
   NONE, GENERIC, INTERFACE, or IRPCDISPATCH
 - Added interfaces IRpcDispatch and IRpcServerStub to provide for blocking
   services and implementations.
-- Added ProtoGen.exe command-line argument "--protoc_dir=" to specify the 
+- Added ProtoGen.exe command-line argument "--protoc_dir=" to specify the
   location of protoc.exe.
 - Extracted interfaces for ICodedInputStream and ICodedOutputStream to allow
   custom implementation of writers with both speed and size optimizations.
@@ -86,9 +86,9 @@ Fixes:
 - Issue 16:	Does not integrate well with other tooling
 - Issue 19:	Support for negative enum values
 - Issue 26:	AddRange in GeneratedBuilder iterates twice.
-- Issue 27:	Remove XML documentation output from test projects to clear 
+- Issue 27:	Remove XML documentation output from test projects to clear
   warnings/errors.
-- Issue 28: Circular message dependencies result in null default values for 
+- Issue 28: Circular message dependencies result in null default values for
   Message fields.
 - Issue 29: Message classes generated have a public default constructor.  You
   can disable private ctor generation with the option generate_private_ctor.
@@ -109,14 +109,14 @@ RELEASE NOTES - Version 2.3.0.277
 ===============================================================================
 
 Features:
-- Added cls_compliance option to generate attributes indicating 
+- Added cls_compliance option to generate attributes indicating
   non-CLS-compliance.
 - Added file_extension option to control the generated output file's extension.
 - Added umbrella_namespace option to place the umbrella class into a nested
-  namespace to address issues with proto files having the same name as a 
+  namespace to address issues with proto files having the same name as a
   message it contains.
 - Added output_directory option to set the output path for the source file(s).
-- Added ignore_google_protobuf option to avoid generating code for includes 
+- Added ignore_google_protobuf option to avoid generating code for includes
   from the google.protobuf package.
 - Added the LITE framework (Google.ProtoBuffersLite.dll) and the ability to
   generate code with "option optimize_for = LITE_RUNTIME;".

+ 21 - 21
csharp/Google.Protobuf.Tools.nuspec

@@ -1,11 +1,11 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
 <package>
   <metadata>
     <id>Google.Protobuf.Tools</id>
     <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.6.1</version>
+    <version>3.7.1</version>
     <authors>Google Inc.</authors>
     <owners>protobuf-packages</owners>
     <licenseUrl>https://github.com/protocolbuffers/protobuf/blob/master/LICENSE</licenseUrl>
@@ -16,24 +16,24 @@
     <tags>Protocol Buffers Binary Serialization Format Google proto proto3</tags>
   </metadata>
   <files>
-    <file src="protoc\windows_x86\protoc.exe" target="tools\windows_x86\protoc.exe" />
-    <file src="protoc\windows_x64\protoc.exe" target="tools\windows_x64\protoc.exe" />
-    <file src="protoc\linux_x86\protoc" target="tools\linux_x86\protoc" />
-    <file src="protoc\linux_x64\protoc" target="tools\linux_x64\protoc" />
-    <file src="protoc\macosx_x86\protoc" target="tools\macosx_x86\protoc" />
-    <file src="protoc\macosx_x64\protoc" target="tools\macosx_x64\protoc" />
-    <file src="..\src\google\protobuf\any.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\api.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\descriptor.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\duration.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\empty.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\field_mask.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\source_context.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\struct.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\timestamp.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\type.proto" target="tools\google\protobuf" />
-    <file src="..\src\google\protobuf\wrappers.proto" target="tools\google\protobuf" />
-    <file src="Google.Protobuf.Tools.targets" target="buildCrossTargeting" />
-    <file src="Google.Protobuf.Tools.targets" target="build" />
+    <file src="protoc\windows_x86\protoc.exe" target="tools\windows_x86\protoc.exe"/>
+    <file src="protoc\windows_x64\protoc.exe" target="tools\windows_x64\protoc.exe"/>
+    <file src="protoc\linux_x86\protoc" target="tools\linux_x86\protoc"/>
+    <file src="protoc\linux_x64\protoc" target="tools\linux_x64\protoc"/>
+    <file src="protoc\macosx_x86\protoc" target="tools\macosx_x86\protoc"/>
+    <file src="protoc\macosx_x64\protoc" target="tools\macosx_x64\protoc"/>
+    <file src="..\src\google\protobuf\any.proto" target="tools\google\protobuf"/>
+    <file src="..\src\google\protobuf\api.proto" target="tools\google\protobuf"/>
+    <file src="..\src\google\protobuf\descriptor.proto" target="tools\google\protobuf"/>
+    <file src="..\src\google\protobuf\duration.proto" target="tools\google\protobuf"/>
+    <file src="..\src\google\protobuf\empty.proto" target="tools\google\protobuf"/>
+    <file src="..\src\google\protobuf\field_mask.proto" target="tools\google\protobuf"/>
+    <file src="..\src\google\protobuf\source_context.proto" target="tools\google\protobuf"/>
+    <file src="..\src\google\protobuf\struct.proto" target="tools\google\protobuf"/>
+    <file src="..\src\google\protobuf\timestamp.proto" target="tools\google\protobuf"/>
+    <file src="..\src\google\protobuf\type.proto" target="tools\google\protobuf"/>
+    <file src="..\src\google\protobuf\wrappers.proto" target="tools\google\protobuf"/>
+    <file src="Google.Protobuf.Tools.targets" target="buildCrossTargeting"/>
+    <file src="Google.Protobuf.Tools.targets" target="build"/>
   </files>
 </package>

+ 13 - 13
csharp/README.md

@@ -10,7 +10,7 @@ You will also want to install the `Google.Protobuf.Tools` NuGet package, which
 contains precompiled version of `protoc.exe` and a copy of well known `.proto`
 files under the package's `tools` directory.
 
-To generate C# files from your `.proto` files, invoke `protoc` with the 
+To generate C# files from your `.proto` files, invoke `protoc` with the
 `--csharp_out` option.
 
 Supported platforms
@@ -37,8 +37,8 @@ later.
 Although *users* of this project are only expected to have Visual
 Studio 2012 or later, *developers* of the library are required to
 have Visual Studio 2017 or later, as the library uses C# 6 features
-in its implementation, as well as the new Visual Studio 2017 csproj 
-format. These features have no impact when using the compiled code - 
+in its implementation, as well as the new Visual Studio 2017 csproj
+format. These features have no impact when using the compiled code -
 they're only relevant when building the `Google.Protobuf` assembly.
 
 In order to run and debug the AddressBook example in the IDE, you must
@@ -56,19 +56,19 @@ run using the Visual Studio Test Explorer or `dotnet test`.
 .NET 3.5
 ========
 
-We don't officially support .NET 3.5. However, there has been some effort 
-to make enabling .NET 3.5 support relatively painless in case you require it. 
-There's no guarantee that this will continue in the future, so rely on .NET 
+We don't officially support .NET 3.5. However, there has been some effort
+to make enabling .NET 3.5 support relatively painless in case you require it.
+There's no guarantee that this will continue in the future, so rely on .NET
 3.5 support at your peril.
 
-To enable .NET 3.5 support, you must edit the `TargetFrameworks` elements of 
-[src/Google.Protobuf/Google.Protobuf.csproj](src/Google.Protobuf/Google.Protobuf.csproj) 
-(and [src/Google.Protobuf.Test/Google.Protobuf.Test.csproj](src/Google.Protobuf.Test/Google.Protobuf.Test.csproj) 
-if you want to run the unit tests): 
+To enable .NET 3.5 support, you must edit the `TargetFrameworks` elements of
+[src/Google.Protobuf/Google.Protobuf.csproj](src/Google.Protobuf/Google.Protobuf.csproj)
+(and [src/Google.Protobuf.Test/Google.Protobuf.Test.csproj](src/Google.Protobuf.Test/Google.Protobuf.Test.csproj)
+if you want to run the unit tests):
 
-Open the .csproj file in a text editor and simply add `net35` to the list of 
-target frameworks, noting that the `TargetFrameworks` element appears twice in 
-the file (once in the first `PropertyGroup` element, and again in the second 
+Open the .csproj file in a text editor and simply add `net35` to the list of
+target frameworks, noting that the `TargetFrameworks` element appears twice in
+the file (once in the first `PropertyGroup` element, and again in the second
 `PropertyGroup` element, i.e., the one with the conditional).
 
 History of C# protobufs

+ 1 - 1
csharp/build_packages.bat

@@ -1,7 +1,7 @@
 @rem Builds Google.Protobuf NuGet packages
 
 dotnet restore src/Google.Protobuf.sln
-dotnet pack -c Release src/Google.Protobuf.sln /p:SourceLinkCreate=true || goto :error
+dotnet pack -c Release src/Google.Protobuf.sln || goto :error
 
 goto :EOF
 

+ 13 - 0
csharp/buildall.bat

@@ -0,0 +1,13 @@
+@rem Builds Google.Protobuf and runs the tests
+
+dotnet build src/Google.Protobuf.sln || goto :error
+
+echo Running tests.
+
+dotnet test src/Google.Protobuf.Test/Google.Protobuf.Test.csproj || goto :error
+
+goto :EOF
+
+:error
+echo Failed!
+exit /b %errorlevel%

+ 3 - 3
csharp/buildall.sh

@@ -10,8 +10,8 @@ dotnet restore $SRC/Google.Protobuf.sln
 dotnet build -c $CONFIG $SRC/Google.Protobuf.sln
 
 echo Running tests.
-# Only test netcoreapp1.0, which uses the .NET Core runtime.
+# Only test netcoreapp2.1, which uses the .NET Core runtime.
 # If we want to test the .NET 4.5 version separately, we could
 # run Mono explicitly. However, we don't have any differences between
-# the .NET 4.5 and netstandard1.0 assemblies.
-dotnet test -c $CONFIG -f netcoreapp1.0 $SRC/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+# the .NET 4.5 and netstandard2.1 assemblies.
+dotnet test -c $CONFIG -f netcoreapp2.1 $SRC/Google.Protobuf.Test/Google.Protobuf.Test.csproj

+ 5 - 5
csharp/compatibility_tests/v3.0.0/protos/csharp/protos/unittest_issues.proto

@@ -20,7 +20,7 @@ message Issue307 {
 
 // Old issue 13: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13
 // New issue 309: https://github.com/protocolbuffers/protobuf/issues/309
- 
+
 // message A {
 //    optional int32 _A = 1;
 // }
@@ -101,21 +101,21 @@ message TestJsonFieldOrdering {
   // that will require fixing other tests in multiple platforms.
   // Alternatively, consider just adding this to
   // unittest_proto3.proto if multiple platforms want it.
-  
+
   int32 plain_int32 = 4;
 
   oneof o1 {
     string o1_string = 2;
     int32 o1_int32 = 5;
   }
-  
+
   string plain_string = 1;
-  
+
   oneof o2 {
     int32 o2_int32 = 6;
     string o2_string = 3;
   }
-  
+
 }
 
 message TestJsonName {

+ 5 - 5
csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/CodedInputStreamTest.cs

@@ -313,14 +313,14 @@ namespace Google.Protobuf
         [Test]
         public void MaliciousRecursion()
         {
-            ByteString data64 = MakeRecursiveMessage(64).ToByteString();
-            ByteString data65 = MakeRecursiveMessage(65).ToByteString();
+            ByteString atRecursiveLimit = MakeRecursiveMessage(CodedInputStream.DefaultRecursionLimit).ToByteString();
+            ByteString beyondRecursiveLimit = MakeRecursiveMessage(CodedInputStream.DefaultRecursionLimit + 1).ToByteString();
 
-            AssertMessageDepth(TestRecursiveMessage.Parser.ParseFrom(data64), 64);
+            AssertMessageDepth(TestRecursiveMessage.Parser.ParseFrom(atRecursiveLimit), CodedInputStream.DefaultRecursionLimit);
 
-            Assert.Throws<InvalidProtocolBufferException>(() => TestRecursiveMessage.Parser.ParseFrom(data65));
+            Assert.Throws<InvalidProtocolBufferException>(() => TestRecursiveMessage.Parser.ParseFrom(beyondRecursiveLimit));
 
-            CodedInputStream input = CodedInputStream.CreateWithLimits(new MemoryStream(data64.ToByteArray()), 1000000, 63);
+            CodedInputStream input = CodedInputStream.CreateWithLimits(new MemoryStream(atRecursiveLimit.ToByteArray()), 1000000, CodedInputStream.DefaultRecursionLimit - 1);
             Assert.Throws<InvalidProtocolBufferException>(() => TestRecursiveMessage.Parser.ParseFrom(input));
         }
 

+ 2 - 2
csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Collections/MapFieldTest.cs

@@ -86,7 +86,7 @@ namespace Google.Protobuf.Collections
             var map = new MapField<string, ForeignMessage>();
             Assert.Throws<ArgumentNullException>(() => map[null] = new ForeignMessage());
         }
-        
+
         [Test]
         public void AddPreservesInsertionOrder()
         {
@@ -471,7 +471,7 @@ namespace Google.Protobuf.Collections
             keys.CopyTo(array, 1);
             CollectionAssert.AreEqual(new[] { null, "foo", "x", null }, array);
         }
-        
+
         // Just test keys - we know the implementation is the same for values
         [Test]
         public void NonGenericViewCopyTo()

+ 1 - 1
csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Compatibility/TypeExtensionsTest.cs

@@ -59,7 +59,7 @@ namespace Google.Protobuf.Compatibility
         [TestCase(typeof(string), typeof(int), false)]
         [TestCase(typeof(int), typeof(int), true)]
         [TestCase(typeof(ValueType), typeof(int), true)]
-        [TestCase(typeof(long), typeof(int), false)] // 
+        [TestCase(typeof(long), typeof(int), false)] //
         public void IsAssignableFrom(Type target, Type argument, bool expected)
         {
             Assert.AreEqual(expected, TypeExtensions.IsAssignableFrom(target, argument));

+ 3 - 3
csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/FieldCodecTest.cs

@@ -43,7 +43,7 @@ namespace Google.Protobuf
 #pragma warning disable 0414 // Used by tests via reflection - do not remove!
         private static readonly List<ICodecTestData> Codecs = new List<ICodecTestData>
         {
-            new FieldCodecTestData<bool>(FieldCodec.ForBool(100), true, "Bool"),
+            new FieldCodecTestData<bool>(FieldCodec.ForBool(100), true, "FixedBool"),
             new FieldCodecTestData<string>(FieldCodec.ForString(100), "sample", "String"),
             new FieldCodecTestData<ByteString>(FieldCodec.ForBytes(100), ByteString.CopyFrom(1, 2, 3), "Bytes"),
             new FieldCodecTestData<int>(FieldCodec.ForInt32(100), -1000, "Int32"),
@@ -56,8 +56,8 @@ namespace Google.Protobuf
             new FieldCodecTestData<long>(FieldCodec.ForSFixed64(100), -1000, "SFixed64"),
             new FieldCodecTestData<ulong>(FieldCodec.ForUInt64(100), 1234, "UInt64"),
             new FieldCodecTestData<ulong>(FieldCodec.ForFixed64(100), 1234, "Fixed64"),
-            new FieldCodecTestData<float>(FieldCodec.ForFloat(100), 1234.5f, "Float"),
-            new FieldCodecTestData<double>(FieldCodec.ForDouble(100), 1234567890.5d, "Double"),
+            new FieldCodecTestData<float>(FieldCodec.ForFloat(100), 1234.5f, "FixedFloat"),
+            new FieldCodecTestData<double>(FieldCodec.ForDouble(100), 1234567890.5d, "FixedDouble"),
             new FieldCodecTestData<ForeignEnum>(
                 FieldCodec.ForEnum(100, t => (int) t, t => (ForeignEnum) t), ForeignEnum.ForeignBaz, "Enum"),
             new FieldCodecTestData<ForeignMessage>(

+ 4 - 4
csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Google.Protobuf.Test.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFrameworks>net451;netcoreapp1.0</TargetFrameworks>
+    <TargetFrameworks>net451;netcoreapp2.1</TargetFrameworks>
     <AssemblyOriginatorKeyFile>../../keys/Google.Protobuf.snk</AssemblyOriginatorKeyFile>
     <SignAssembly>true</SignAssembly>
     <PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign>
@@ -18,13 +18,13 @@
     <PackageReference Include="NUnitLite" Version="3.6.1" />
   </ItemGroup>
 
-  <!-- 
+  <!--
     - Override target frameworks on non-Windows to just .NET Core
     - Doing this conditionally in the initial PropertyGroup confuses
     - Visual Studio.
     -->
   <PropertyGroup Condition="'$(OS)' != 'Windows_NT'">
-    <TargetFrameworks>netcoreapp1.0</TargetFrameworks>
+    <TargetFrameworks>netcoreapp2.1</TargetFrameworks>
   </PropertyGroup>
-  
+
 </Project>

+ 5 - 5
csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/JsonTokenizerTest.cs

@@ -240,7 +240,7 @@ namespace Google.Protobuf
             AssertTokens("{'x': 'y'}",
                 JsonToken.StartObject, JsonToken.Name("x"), JsonToken.Value("y"), JsonToken.EndObject);
         }
-        
+
         [Test]
         [TestCase("[10, 20", 3)]
         [TestCase("[10,", 2)]
@@ -305,7 +305,7 @@ namespace Google.Protobuf
         [Test]
         public void ObjectMixedType()
         {
-            AssertTokens(@"{'a': 1, 'b': 'bar', 'c': null, 'd': false, 'e': true, 
+            AssertTokens(@"{'a': 1, 'b': 'bar', 'c': null, 'd': false, 'e': true,
                            'f': [2], 'g': {'x':'y' }}",
                 JsonToken.StartObject,
                 JsonToken.Name("a"),
@@ -349,12 +349,12 @@ namespace Google.Protobuf
             Assert.AreEqual(JsonToken.EndDocument, tokenizer.Next());
             Assert.Throws<InvalidOperationException>(() => tokenizer.Next());
         }
-       
+
         /// <summary>
         /// Asserts that the specified JSON is tokenized into the given sequence of tokens.
         /// All apostrophes are first converted to double quotes, allowing any tests
         /// that don't need to check actual apostrophe handling to use apostrophes in the JSON, avoiding
-        /// messy string literal escaping. The "end document" token is not specified in the list of 
+        /// messy string literal escaping. The "end document" token is not specified in the list of
         /// expected tokens, but is implicit.
         /// </summary>
         private static void AssertTokens(string json, params JsonToken[] expectedTokens)
@@ -366,7 +366,7 @@ namespace Google.Protobuf
         /// Asserts that the specified JSON is tokenized into the given sequence of tokens.
         /// Unlike <see cref="AssertTokens(string, JsonToken[])"/>, this does not perform any character
         /// replacement on the specified JSON, and should be used when the text contains apostrophes which
-        /// are expected to be used *as* apostrophes. The "end document" token is not specified in the list of 
+        /// are expected to be used *as* apostrophes. The "end document" token is not specified in the list of
         /// expected tokens, but is implicit.
         /// </summary>
         private static void AssertTokensNoReplacement(string json, params JsonToken[] expectedTokens)

+ 2 - 2
csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/DescriptorsTest.cs

@@ -150,7 +150,7 @@ namespace Google.Protobuf.Reflection
             Assert.AreEqual(UnittestProto3Reflection.Descriptor, primitiveField.File);
             Assert.AreEqual(FieldType.Int32, primitiveField.FieldType);
             Assert.IsNull(primitiveField.Proto.Options);
-            
+
             Assert.AreEqual("single_nested_enum", enumField.Name);
             Assert.AreEqual(FieldType.Enum, enumField.FieldType);
             // Assert.AreEqual(TestAllTypes.Types.NestedEnum.DescriptorProtoFile, enumField.EnumType);
@@ -242,7 +242,7 @@ namespace Google.Protobuf.Reflection
         // NestedMessage single_nested_message = 200;
         [Test]
         public void FieldListOrderings()
-        { 
+        {
             var fields = TestFieldOrderings.Descriptor.Fields;
             Assert.AreEqual(new[] { 11, 1, 101, 200 }, fields.InDeclarationOrder().Select(x => x.FieldNumber));
             Assert.AreEqual(new[] { 1, 11, 101, 200 }, fields.InFieldNumberOrder().Select(x => x.FieldNumber));

+ 1 - 1
csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/Reflection/FieldAccessTest.cs

@@ -213,6 +213,6 @@ namespace Google.Protobuf.Reflection
             var descriptor = TestAllTypes.Descriptor;
             Assert.Throws<KeyNotFoundException>(() => descriptor.Fields[999999].ToString());
             Assert.Throws<KeyNotFoundException>(() => descriptor.Fields["not found"].ToString());
-        }        
+        }
     }
 }

+ 1 - 1
csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/SampleEnum.cs

@@ -29,7 +29,7 @@
 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #endregion
-    
+
 namespace Google.Protobuf
 {
     // Just a sample enum with positive and negative values to be used in tests.

+ 1 - 1
csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/TimestampTest.cs

@@ -99,7 +99,7 @@ namespace Google.Protobuf.WellKnownTypes
             Duration difference = new Duration { Seconds = 1999, Nanos = Duration.NanosecondsPerSecond - 5000 };
             Assert.AreEqual(difference, t1 - t2);
             Assert.AreEqual(-difference, t2 - t1);
-            
+
             Assert.AreEqual(t1, t2 + difference);
             Assert.AreEqual(t2, t1 - difference);
         }

+ 2 - 2
csharp/compatibility_tests/v3.0.0/src/Google.Protobuf.Test/WellKnownTypes/WrappersTest.cs

@@ -135,7 +135,7 @@ namespace Google.Protobuf.WellKnownTypes
                 DoubleField = { 12.5, -1.5, 0d },
                 FloatField = { 123.25f, -20f, 0f },
                 Int32Field = { int.MaxValue, int.MinValue, 0 },
-                Int64Field = { long.MaxValue, long.MinValue, 0L },                
+                Int64Field = { long.MaxValue, long.MinValue, 0L },
                 StringField = { "First", "Second", "" },
                 Uint32Field = { uint.MaxValue, uint.MinValue, 0U },
                 Uint64Field = { ulong.MaxValue, ulong.MinValue, 0UL },
@@ -403,7 +403,7 @@ namespace Google.Protobuf.WellKnownTypes
 
             output.Flush();
             stream.Position = 0;
-            
+
             var message = TestWellKnownTypes.Parser.ParseFrom(stream);
             Assert.AreEqual(6, message.Int32Field);
         }

+ 7 - 15
csharp/compatibility_tests/v3.0.0/test.sh

@@ -2,17 +2,17 @@
 
 function run_test() {
   # Generate test proto files.
-  ./protoc_1 -Iprotos/src -I../../../src/ --csharp_out=src/Google.Protobuf.Test \
+  $1 -Iprotos/src -I../../../src/ --csharp_out=src/Google.Protobuf.Test \
     --csharp_opt=base_namespace=Google.Protobuf \
     protos/src/google/protobuf/unittest_import_proto3.proto \
     protos/src/google/protobuf/unittest_import_public_proto3.proto \
     protos/src/google/protobuf/unittest_well_known_types.proto
 
-  ./protoc_1 -Iprotos/csharp --csharp_out=src/Google.Protobuf.Test \
+  $1 -Iprotos/csharp --csharp_out=src/Google.Protobuf.Test \
     --csharp_opt=base_namespace=UnitTest.Issues \
     protos/csharp/protos/unittest_issues.proto
 
-  ./protoc_2 -Iprotos/src --csharp_out=src/Google.Protobuf.Test \
+  $2 -Iprotos/src --csharp_out=src/Google.Protobuf.Test \
     --csharp_opt=base_namespace=Google.Protobuf \
     protos/src/google/protobuf/unittest_proto3.proto \
     protos/src/google/protobuf/map_unittest_proto3.proto
@@ -22,7 +22,7 @@ function run_test() {
   dotnet restore src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
   dotnet build -c Release src/Google.Protobuf/Google.Protobuf.csproj
   dotnet build -c Release src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
-  dotnet run -c Release -f netcoreapp1.0 -p src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
+  dotnet run -c Release -f netcoreapp2.1 -p src/Google.Protobuf.Test/Google.Protobuf.Test.csproj
 }
 
 set -ex
@@ -79,26 +79,18 @@ cp ../../keys . -r
 # Test A.1:
 #   proto set 1: use old version
 #   proto set 2 which may import protos in set 1: use old version
-cp old_protoc protoc_1
-cp old_protoc protoc_2
-run_test
+run_test "./old_protoc" "./old_protoc"
 
 # Test A.2:
 #   proto set 1: use new version
 #   proto set 2 which may import protos in set 1: use old version
-cp ../../../src/protoc protoc_1
-cp old_protoc protoc_2
-run_test
+run_test "../../../src/protoc" "./old_protoc"
 
 # Test A.3:
 #   proto set 1: use old version
 #   proto set 2 which may import protos in set 1: use new version
-cp old_protoc protoc_1
-cp ../../../src/protoc protoc_2
-run_test
+run_test "./old_protoc" "../../../src/protoc"
 
-rm protoc_1
-rm protoc_2
 rm old_protoc
 rm keys -r
 rm src/Google.Protobuf -r

+ 6 - 0
csharp/generate_protos.sh

@@ -61,3 +61,9 @@ $PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \
 
 $PROTOC -Iconformance -Isrc --csharp_out=csharp/src/Google.Protobuf.Conformance \
     conformance/conformance.proto
+
+# Benchmark protos
+$PROTOC -Ibenchmarks \
+  benchmarks/datasets/google_message1/proto3/*.proto \
+  benchmarks/benchmarks.proto \
+  --csharp_out=csharp/src/Google.Protobuf.Benchmarks

+ 0 - 5
csharp/global.json

@@ -1,5 +0,0 @@
-{
-  "sdk": {
-    "version": "2.1.3"
-  }
-}

+ 21 - 0
csharp/install_dotnet_sdk.ps1

@@ -0,0 +1,21 @@
+#!/usr/bin/env powershell
+# Install dotnet SDK based on the SDK version from global.json
+
+Set-StrictMode -Version 2
+$ErrorActionPreference = 'Stop'
+
+# avoid "Unknown error on a send" in Invoke-WebRequest
+[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
+
+$InstallScriptUrl = 'https://dot.net/v1/dotnet-install.ps1'
+$InstallScriptPath = Join-Path  "$env:TEMP" 'dotnet-install.ps1'
+$GlobalJsonPath = Join-Path $PSScriptRoot '..' | Join-Path -ChildPath 'global.json'
+
+# Resolve SDK version from global.json file
+$GlobalJson = Get-Content -Raw $GlobalJsonPath | ConvertFrom-Json
+$SDKVersion = $GlobalJson.sdk.version
+
+# Download install script
+Write-Host "Downloading install script: $InstallScriptUrl => $InstallScriptPath"
+Invoke-WebRequest -Uri $InstallScriptUrl -OutFile $InstallScriptPath
+&$InstallScriptPath -Version $SDKVersion

+ 5 - 5
csharp/protos/unittest_issues.proto

@@ -19,7 +19,7 @@ message Issue307 {
 
 // Old issue 13: http://code.google.com/p/protobuf-csharp-port/issues/detail?id=13
 // New issue 309: https://github.com/protocolbuffers/protobuf/issues/309
- 
+
 // message A {
 //    optional int32 _A = 1;
 // }
@@ -100,21 +100,21 @@ message TestJsonFieldOrdering {
   // that will require fixing other tests in multiple platforms.
   // Alternatively, consider just adding this to
   // unittest_proto3.proto if multiple platforms want it.
-  
+
   int32 plain_int32 = 4;
 
   oneof o1 {
     string o1_string = 2;
     int32 o1_int32 = 5;
   }
-  
+
   string plain_string = 1;
-  
+
   oneof o2 {
     int32 o2_int32 = 6;
     string o2_string = 3;
   }
-  
+
 }
 
 message TestJsonName {

+ 2 - 2
csharp/protos/unittest_proto3.proto

@@ -392,13 +392,13 @@ message CommentMessage {
     // Leading nested message field comment
     string nested_text = 1;
   }
-  
+
   // Leading nested enum comment
   enum NestedCommentEnum {
     // Zero value comment
     ZERO_VALUE = 0;
   }
-  
+
   // Leading field comment
   string text = 1; // Trailing field comment
 }

+ 1 - 1
csharp/src/AddressBook/AddressBook.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp1.0</TargetFramework>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
     <OutputType>Exe</OutputType>
     <StartupObject>Google.Protobuf.Examples.AddressBook.Program</StartupObject>
     <IsPackable>False</IsPackable>

+ 8 - 8
csharp/src/AddressBook/Addressbook.cs

@@ -37,9 +37,9 @@ namespace Google.Protobuf.Examples.AddressBook {
             "ZHJlc3NCb29rYgZwcm90bzM="));
       descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
           new pbr::FileDescriptor[] { global::Google.Protobuf.WellKnownTypes.TimestampReflection.Descriptor, },
-          new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] {
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones", "LastUpdated" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null)}),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), global::Google.Protobuf.Examples.AddressBook.AddressBook.Parser, new[]{ "People" }, null, null, null)
+          new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
+            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person), global::Google.Protobuf.Examples.AddressBook.Person.Parser, new[]{ "Name", "Id", "Email", "Phones", "LastUpdated" }, null, new[]{ typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber), global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneNumber.Parser, new[]{ "Number", "Type" }, null, null, null, null)}),
+            new pbr::GeneratedClrTypeInfo(typeof(global::Google.Protobuf.Examples.AddressBook.AddressBook), global::Google.Protobuf.Examples.AddressBook.AddressBook.Parser, new[]{ "People" }, null, null, null, null)
           }));
     }
     #endregion
@@ -347,7 +347,7 @@ namespace Google.Protobuf.Examples.AddressBook {
 
         /// <summary>Field number for the "type" field.</summary>
         public const int TypeFieldNumber = 2;
-        private global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType type_ = 0;
+        private global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType type_ = global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile;
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
         public global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType Type {
           get { return type_; }
@@ -378,7 +378,7 @@ namespace Google.Protobuf.Examples.AddressBook {
         public override int GetHashCode() {
           int hash = 1;
           if (Number.Length != 0) hash ^= Number.GetHashCode();
-          if (Type != 0) hash ^= Type.GetHashCode();
+          if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) hash ^= Type.GetHashCode();
           if (_unknownFields != null) {
             hash ^= _unknownFields.GetHashCode();
           }
@@ -396,7 +396,7 @@ namespace Google.Protobuf.Examples.AddressBook {
             output.WriteRawTag(10);
             output.WriteString(Number);
           }
-          if (Type != 0) {
+          if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) {
             output.WriteRawTag(16);
             output.WriteEnum((int) Type);
           }
@@ -411,7 +411,7 @@ namespace Google.Protobuf.Examples.AddressBook {
           if (Number.Length != 0) {
             size += 1 + pb::CodedOutputStream.ComputeStringSize(Number);
           }
-          if (Type != 0) {
+          if (Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) {
             size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) Type);
           }
           if (_unknownFields != null) {
@@ -428,7 +428,7 @@ namespace Google.Protobuf.Examples.AddressBook {
           if (other.Number.Length != 0) {
             Number = other.Number;
           }
-          if (other.Type != 0) {
+          if (other.Type != global::Google.Protobuf.Examples.AddressBook.Person.Types.PhoneType.Mobile) {
             Type = other.Type;
           }
           _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);

+ 1980 - 0
csharp/src/Google.Protobuf.Benchmarks/BenchmarkMessage1Proto3.cs

@@ -0,0 +1,1980 @@
+// <auto-generated>
+//     Generated by the protocol buffer compiler.  DO NOT EDIT!
+//     source: datasets/google_message1/proto3/benchmark_message1_proto3.proto
+// </auto-generated>
+#pragma warning disable 1591, 0612, 3021
+#region Designer generated code
+
+using pb = global::Google.Protobuf;
+using pbc = global::Google.Protobuf.Collections;
+using pbr = global::Google.Protobuf.Reflection;
+using scg = global::System.Collections.Generic;
+namespace Benchmarks.Proto3 {
+
+  /// <summary>Holder for reflection information generated from datasets/google_message1/proto3/benchmark_message1_proto3.proto</summary>
+  public static partial class BenchmarkMessage1Proto3Reflection {
+
+    #region Descriptor
+    /// <summary>File descriptor for datasets/google_message1/proto3/benchmark_message1_proto3.proto</summary>
+    public static pbr::FileDescriptor Descriptor {
+      get { return descriptor; }
+    }
+    private static pbr::FileDescriptor descriptor;
+
+    static BenchmarkMessage1Proto3Reflection() {
+      byte[] descriptorData = global::System.Convert.FromBase64String(
+          string.Concat(
+            "Cj9kYXRhc2V0cy9nb29nbGVfbWVzc2FnZTEvcHJvdG8zL2JlbmNobWFya19t",
+            "ZXNzYWdlMV9wcm90bzMucHJvdG8SEWJlbmNobWFya3MucHJvdG8zIoMGCg5H",
+            "b29nbGVNZXNzYWdlMRIOCgZmaWVsZDEYASABKAkSDgoGZmllbGQ5GAkgASgJ",
+            "Eg8KB2ZpZWxkMTgYEiABKAkSDwoHZmllbGQ4MBhQIAEoCBIPCgdmaWVsZDgx",
+            "GFEgASgIEg4KBmZpZWxkMhgCIAEoBRIOCgZmaWVsZDMYAyABKAUSEQoIZmll",
+            "bGQyODAYmAIgASgFEg4KBmZpZWxkNhgGIAEoBRIPCgdmaWVsZDIyGBYgASgD",
+            "Eg4KBmZpZWxkNBgEIAEoCRIOCgZmaWVsZDUYBSADKAYSDwoHZmllbGQ1ORg7",
+            "IAEoCBIOCgZmaWVsZDcYByABKAkSDwoHZmllbGQxNhgQIAEoBRIRCghmaWVs",
+            "ZDEzMBiCASABKAUSDwoHZmllbGQxMhgMIAEoCBIPCgdmaWVsZDE3GBEgASgI",
+            "Eg8KB2ZpZWxkMTMYDSABKAgSDwoHZmllbGQxNBgOIAEoCBIQCghmaWVsZDEw",
+            "NBhoIAEoBRIQCghmaWVsZDEwMBhkIAEoBRIQCghmaWVsZDEwMRhlIAEoBRIQ",
+            "CghmaWVsZDEwMhhmIAEoCRIQCghmaWVsZDEwMxhnIAEoCRIPCgdmaWVsZDI5",
+            "GB0gASgFEg8KB2ZpZWxkMzAYHiABKAgSDwoHZmllbGQ2MBg8IAEoBRIRCghm",
+            "aWVsZDI3MRiPAiABKAUSEQoIZmllbGQyNzIYkAIgASgFEhEKCGZpZWxkMTUw",
+            "GJYBIAEoBRIPCgdmaWVsZDIzGBcgASgFEg8KB2ZpZWxkMjQYGCABKAgSDwoH",
+            "ZmllbGQyNRgZIAEoBRI8CgdmaWVsZDE1GA8gASgLMisuYmVuY2htYXJrcy5w",
+            "cm90bzMuR29vZ2xlTWVzc2FnZTFTdWJNZXNzYWdlEg8KB2ZpZWxkNzgYTiAB",
+            "KAgSDwoHZmllbGQ2NxhDIAEoBRIPCgdmaWVsZDY4GEQgASgFEhEKCGZpZWxk",
+            "MTI4GIABIAEoBRIRCghmaWVsZDEyORiBASABKAkSEQoIZmllbGQxMzEYgwEg",
+            "ASgFIvcCChhHb29nbGVNZXNzYWdlMVN1Yk1lc3NhZ2USDgoGZmllbGQxGAEg",
+            "ASgFEg4KBmZpZWxkMhgCIAEoBRIOCgZmaWVsZDMYAyABKAUSDwoHZmllbGQx",
+            "NRgPIAEoCRIPCgdmaWVsZDEyGAwgASgIEg8KB2ZpZWxkMTMYDSABKAMSDwoH",
+            "ZmllbGQxNBgOIAEoAxIPCgdmaWVsZDE2GBAgASgFEg8KB2ZpZWxkMTkYEyAB",
+            "KAUSDwoHZmllbGQyMBgUIAEoCBIPCgdmaWVsZDI4GBwgASgIEg8KB2ZpZWxk",
+            "MjEYFSABKAYSDwoHZmllbGQyMhgWIAEoBRIPCgdmaWVsZDIzGBcgASgIEhEK",
+            "CGZpZWxkMjA2GM4BIAEoCBIRCghmaWVsZDIwMxjLASABKAcSEQoIZmllbGQy",
+            "MDQYzAEgASgFEhEKCGZpZWxkMjA1GM0BIAEoCRIRCghmaWVsZDIwNxjPASAB",
+            "KAQSEQoIZmllbGQzMDAYrAIgASgEQiUKHmNvbS5nb29nbGUucHJvdG9idWYu",
+            "YmVuY2htYXJrc0gB+AEBYgZwcm90bzM="));
+      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+          new pbr::FileDescriptor[] { },
+          new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
+            new pbr::GeneratedClrTypeInfo(typeof(global::Benchmarks.Proto3.GoogleMessage1), global::Benchmarks.Proto3.GoogleMessage1.Parser, new[]{ "Field1", "Field9", "Field18", "Field80", "Field81", "Field2", "Field3", "Field280", "Field6", "Field22", "Field4", "Field5", "Field59", "Field7", "Field16", "Field130", "Field12", "Field17", "Field13", "Field14", "Field104", "Field100", "Field101", "Field102", "Field103", "Field29", "Field30", "Field60", "Field271", "Field272", "Field150", "Field23", "Field24", "Field25", "Field15", "Field78", "Field67", "Field68", "Field128", "Field129", "Field131" }, null, null, null, null),
+            new pbr::GeneratedClrTypeInfo(typeof(global::Benchmarks.Proto3.GoogleMessage1SubMessage), global::Benchmarks.Proto3.GoogleMessage1SubMessage.Parser, new[]{ "Field1", "Field2", "Field3", "Field15", "Field12", "Field13", "Field14", "Field16", "Field19", "Field20", "Field28", "Field21", "Field22", "Field23", "Field206", "Field203", "Field204", "Field205", "Field207", "Field300" }, null, null, null, null)
+          }));
+    }
+    #endregion
+
+  }
+  #region Messages
+  public sealed partial class GoogleMessage1 : pb::IMessage<GoogleMessage1> {
+    private static readonly pb::MessageParser<GoogleMessage1> _parser = new pb::MessageParser<GoogleMessage1>(() => new GoogleMessage1());
+    private pb::UnknownFieldSet _unknownFields;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public static pb::MessageParser<GoogleMessage1> Parser { get { return _parser; } }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public static pbr::MessageDescriptor Descriptor {
+      get { return global::Benchmarks.Proto3.BenchmarkMessage1Proto3Reflection.Descriptor.MessageTypes[0]; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    pbr::MessageDescriptor pb::IMessage.Descriptor {
+      get { return Descriptor; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public GoogleMessage1() {
+      OnConstruction();
+    }
+
+    partial void OnConstruction();
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public GoogleMessage1(GoogleMessage1 other) : this() {
+      field1_ = other.field1_;
+      field9_ = other.field9_;
+      field18_ = other.field18_;
+      field80_ = other.field80_;
+      field81_ = other.field81_;
+      field2_ = other.field2_;
+      field3_ = other.field3_;
+      field280_ = other.field280_;
+      field6_ = other.field6_;
+      field22_ = other.field22_;
+      field4_ = other.field4_;
+      field5_ = other.field5_.Clone();
+      field59_ = other.field59_;
+      field7_ = other.field7_;
+      field16_ = other.field16_;
+      field130_ = other.field130_;
+      field12_ = other.field12_;
+      field17_ = other.field17_;
+      field13_ = other.field13_;
+      field14_ = other.field14_;
+      field104_ = other.field104_;
+      field100_ = other.field100_;
+      field101_ = other.field101_;
+      field102_ = other.field102_;
+      field103_ = other.field103_;
+      field29_ = other.field29_;
+      field30_ = other.field30_;
+      field60_ = other.field60_;
+      field271_ = other.field271_;
+      field272_ = other.field272_;
+      field150_ = other.field150_;
+      field23_ = other.field23_;
+      field24_ = other.field24_;
+      field25_ = other.field25_;
+      field15_ = other.field15_ != null ? other.field15_.Clone() : null;
+      field78_ = other.field78_;
+      field67_ = other.field67_;
+      field68_ = other.field68_;
+      field128_ = other.field128_;
+      field129_ = other.field129_;
+      field131_ = other.field131_;
+      _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public GoogleMessage1 Clone() {
+      return new GoogleMessage1(this);
+    }
+
+    /// <summary>Field number for the "field1" field.</summary>
+    public const int Field1FieldNumber = 1;
+    private string field1_ = "";
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string Field1 {
+      get { return field1_; }
+      set {
+        field1_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    /// <summary>Field number for the "field9" field.</summary>
+    public const int Field9FieldNumber = 9;
+    private string field9_ = "";
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string Field9 {
+      get { return field9_; }
+      set {
+        field9_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    /// <summary>Field number for the "field18" field.</summary>
+    public const int Field18FieldNumber = 18;
+    private string field18_ = "";
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string Field18 {
+      get { return field18_; }
+      set {
+        field18_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    /// <summary>Field number for the "field80" field.</summary>
+    public const int Field80FieldNumber = 80;
+    private bool field80_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field80 {
+      get { return field80_; }
+      set {
+        field80_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field81" field.</summary>
+    public const int Field81FieldNumber = 81;
+    private bool field81_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field81 {
+      get { return field81_; }
+      set {
+        field81_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field2" field.</summary>
+    public const int Field2FieldNumber = 2;
+    private int field2_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field2 {
+      get { return field2_; }
+      set {
+        field2_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field3" field.</summary>
+    public const int Field3FieldNumber = 3;
+    private int field3_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field3 {
+      get { return field3_; }
+      set {
+        field3_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field280" field.</summary>
+    public const int Field280FieldNumber = 280;
+    private int field280_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field280 {
+      get { return field280_; }
+      set {
+        field280_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field6" field.</summary>
+    public const int Field6FieldNumber = 6;
+    private int field6_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field6 {
+      get { return field6_; }
+      set {
+        field6_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field22" field.</summary>
+    public const int Field22FieldNumber = 22;
+    private long field22_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public long Field22 {
+      get { return field22_; }
+      set {
+        field22_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field4" field.</summary>
+    public const int Field4FieldNumber = 4;
+    private string field4_ = "";
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string Field4 {
+      get { return field4_; }
+      set {
+        field4_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    /// <summary>Field number for the "field5" field.</summary>
+    public const int Field5FieldNumber = 5;
+    private static readonly pb::FieldCodec<ulong> _repeated_field5_codec
+        = pb::FieldCodec.ForFixed64(42);
+    private readonly pbc::RepeatedField<ulong> field5_ = new pbc::RepeatedField<ulong>();
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public pbc::RepeatedField<ulong> Field5 {
+      get { return field5_; }
+    }
+
+    /// <summary>Field number for the "field59" field.</summary>
+    public const int Field59FieldNumber = 59;
+    private bool field59_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field59 {
+      get { return field59_; }
+      set {
+        field59_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field7" field.</summary>
+    public const int Field7FieldNumber = 7;
+    private string field7_ = "";
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string Field7 {
+      get { return field7_; }
+      set {
+        field7_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    /// <summary>Field number for the "field16" field.</summary>
+    public const int Field16FieldNumber = 16;
+    private int field16_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field16 {
+      get { return field16_; }
+      set {
+        field16_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field130" field.</summary>
+    public const int Field130FieldNumber = 130;
+    private int field130_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field130 {
+      get { return field130_; }
+      set {
+        field130_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field12" field.</summary>
+    public const int Field12FieldNumber = 12;
+    private bool field12_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field12 {
+      get { return field12_; }
+      set {
+        field12_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field17" field.</summary>
+    public const int Field17FieldNumber = 17;
+    private bool field17_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field17 {
+      get { return field17_; }
+      set {
+        field17_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field13" field.</summary>
+    public const int Field13FieldNumber = 13;
+    private bool field13_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field13 {
+      get { return field13_; }
+      set {
+        field13_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field14" field.</summary>
+    public const int Field14FieldNumber = 14;
+    private bool field14_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field14 {
+      get { return field14_; }
+      set {
+        field14_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field104" field.</summary>
+    public const int Field104FieldNumber = 104;
+    private int field104_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field104 {
+      get { return field104_; }
+      set {
+        field104_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field100" field.</summary>
+    public const int Field100FieldNumber = 100;
+    private int field100_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field100 {
+      get { return field100_; }
+      set {
+        field100_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field101" field.</summary>
+    public const int Field101FieldNumber = 101;
+    private int field101_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field101 {
+      get { return field101_; }
+      set {
+        field101_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field102" field.</summary>
+    public const int Field102FieldNumber = 102;
+    private string field102_ = "";
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string Field102 {
+      get { return field102_; }
+      set {
+        field102_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    /// <summary>Field number for the "field103" field.</summary>
+    public const int Field103FieldNumber = 103;
+    private string field103_ = "";
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string Field103 {
+      get { return field103_; }
+      set {
+        field103_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    /// <summary>Field number for the "field29" field.</summary>
+    public const int Field29FieldNumber = 29;
+    private int field29_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field29 {
+      get { return field29_; }
+      set {
+        field29_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field30" field.</summary>
+    public const int Field30FieldNumber = 30;
+    private bool field30_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field30 {
+      get { return field30_; }
+      set {
+        field30_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field60" field.</summary>
+    public const int Field60FieldNumber = 60;
+    private int field60_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field60 {
+      get { return field60_; }
+      set {
+        field60_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field271" field.</summary>
+    public const int Field271FieldNumber = 271;
+    private int field271_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field271 {
+      get { return field271_; }
+      set {
+        field271_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field272" field.</summary>
+    public const int Field272FieldNumber = 272;
+    private int field272_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field272 {
+      get { return field272_; }
+      set {
+        field272_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field150" field.</summary>
+    public const int Field150FieldNumber = 150;
+    private int field150_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field150 {
+      get { return field150_; }
+      set {
+        field150_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field23" field.</summary>
+    public const int Field23FieldNumber = 23;
+    private int field23_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field23 {
+      get { return field23_; }
+      set {
+        field23_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field24" field.</summary>
+    public const int Field24FieldNumber = 24;
+    private bool field24_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field24 {
+      get { return field24_; }
+      set {
+        field24_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field25" field.</summary>
+    public const int Field25FieldNumber = 25;
+    private int field25_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field25 {
+      get { return field25_; }
+      set {
+        field25_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field15" field.</summary>
+    public const int Field15FieldNumber = 15;
+    private global::Benchmarks.Proto3.GoogleMessage1SubMessage field15_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public global::Benchmarks.Proto3.GoogleMessage1SubMessage Field15 {
+      get { return field15_; }
+      set {
+        field15_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field78" field.</summary>
+    public const int Field78FieldNumber = 78;
+    private bool field78_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field78 {
+      get { return field78_; }
+      set {
+        field78_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field67" field.</summary>
+    public const int Field67FieldNumber = 67;
+    private int field67_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field67 {
+      get { return field67_; }
+      set {
+        field67_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field68" field.</summary>
+    public const int Field68FieldNumber = 68;
+    private int field68_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field68 {
+      get { return field68_; }
+      set {
+        field68_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field128" field.</summary>
+    public const int Field128FieldNumber = 128;
+    private int field128_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field128 {
+      get { return field128_; }
+      set {
+        field128_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field129" field.</summary>
+    public const int Field129FieldNumber = 129;
+    private string field129_ = "";
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string Field129 {
+      get { return field129_; }
+      set {
+        field129_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    /// <summary>Field number for the "field131" field.</summary>
+    public const int Field131FieldNumber = 131;
+    private int field131_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field131 {
+      get { return field131_; }
+      set {
+        field131_ = value;
+      }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override bool Equals(object other) {
+      return Equals(other as GoogleMessage1);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Equals(GoogleMessage1 other) {
+      if (ReferenceEquals(other, null)) {
+        return false;
+      }
+      if (ReferenceEquals(other, this)) {
+        return true;
+      }
+      if (Field1 != other.Field1) return false;
+      if (Field9 != other.Field9) return false;
+      if (Field18 != other.Field18) return false;
+      if (Field80 != other.Field80) return false;
+      if (Field81 != other.Field81) return false;
+      if (Field2 != other.Field2) return false;
+      if (Field3 != other.Field3) return false;
+      if (Field280 != other.Field280) return false;
+      if (Field6 != other.Field6) return false;
+      if (Field22 != other.Field22) return false;
+      if (Field4 != other.Field4) return false;
+      if(!field5_.Equals(other.field5_)) return false;
+      if (Field59 != other.Field59) return false;
+      if (Field7 != other.Field7) return false;
+      if (Field16 != other.Field16) return false;
+      if (Field130 != other.Field130) return false;
+      if (Field12 != other.Field12) return false;
+      if (Field17 != other.Field17) return false;
+      if (Field13 != other.Field13) return false;
+      if (Field14 != other.Field14) return false;
+      if (Field104 != other.Field104) return false;
+      if (Field100 != other.Field100) return false;
+      if (Field101 != other.Field101) return false;
+      if (Field102 != other.Field102) return false;
+      if (Field103 != other.Field103) return false;
+      if (Field29 != other.Field29) return false;
+      if (Field30 != other.Field30) return false;
+      if (Field60 != other.Field60) return false;
+      if (Field271 != other.Field271) return false;
+      if (Field272 != other.Field272) return false;
+      if (Field150 != other.Field150) return false;
+      if (Field23 != other.Field23) return false;
+      if (Field24 != other.Field24) return false;
+      if (Field25 != other.Field25) return false;
+      if (!object.Equals(Field15, other.Field15)) return false;
+      if (Field78 != other.Field78) return false;
+      if (Field67 != other.Field67) return false;
+      if (Field68 != other.Field68) return false;
+      if (Field128 != other.Field128) return false;
+      if (Field129 != other.Field129) return false;
+      if (Field131 != other.Field131) return false;
+      return Equals(_unknownFields, other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override int GetHashCode() {
+      int hash = 1;
+      if (Field1.Length != 0) hash ^= Field1.GetHashCode();
+      if (Field9.Length != 0) hash ^= Field9.GetHashCode();
+      if (Field18.Length != 0) hash ^= Field18.GetHashCode();
+      if (Field80 != false) hash ^= Field80.GetHashCode();
+      if (Field81 != false) hash ^= Field81.GetHashCode();
+      if (Field2 != 0) hash ^= Field2.GetHashCode();
+      if (Field3 != 0) hash ^= Field3.GetHashCode();
+      if (Field280 != 0) hash ^= Field280.GetHashCode();
+      if (Field6 != 0) hash ^= Field6.GetHashCode();
+      if (Field22 != 0L) hash ^= Field22.GetHashCode();
+      if (Field4.Length != 0) hash ^= Field4.GetHashCode();
+      hash ^= field5_.GetHashCode();
+      if (Field59 != false) hash ^= Field59.GetHashCode();
+      if (Field7.Length != 0) hash ^= Field7.GetHashCode();
+      if (Field16 != 0) hash ^= Field16.GetHashCode();
+      if (Field130 != 0) hash ^= Field130.GetHashCode();
+      if (Field12 != false) hash ^= Field12.GetHashCode();
+      if (Field17 != false) hash ^= Field17.GetHashCode();
+      if (Field13 != false) hash ^= Field13.GetHashCode();
+      if (Field14 != false) hash ^= Field14.GetHashCode();
+      if (Field104 != 0) hash ^= Field104.GetHashCode();
+      if (Field100 != 0) hash ^= Field100.GetHashCode();
+      if (Field101 != 0) hash ^= Field101.GetHashCode();
+      if (Field102.Length != 0) hash ^= Field102.GetHashCode();
+      if (Field103.Length != 0) hash ^= Field103.GetHashCode();
+      if (Field29 != 0) hash ^= Field29.GetHashCode();
+      if (Field30 != false) hash ^= Field30.GetHashCode();
+      if (Field60 != 0) hash ^= Field60.GetHashCode();
+      if (Field271 != 0) hash ^= Field271.GetHashCode();
+      if (Field272 != 0) hash ^= Field272.GetHashCode();
+      if (Field150 != 0) hash ^= Field150.GetHashCode();
+      if (Field23 != 0) hash ^= Field23.GetHashCode();
+      if (Field24 != false) hash ^= Field24.GetHashCode();
+      if (Field25 != 0) hash ^= Field25.GetHashCode();
+      if (field15_ != null) hash ^= Field15.GetHashCode();
+      if (Field78 != false) hash ^= Field78.GetHashCode();
+      if (Field67 != 0) hash ^= Field67.GetHashCode();
+      if (Field68 != 0) hash ^= Field68.GetHashCode();
+      if (Field128 != 0) hash ^= Field128.GetHashCode();
+      if (Field129.Length != 0) hash ^= Field129.GetHashCode();
+      if (Field131 != 0) hash ^= Field131.GetHashCode();
+      if (_unknownFields != null) {
+        hash ^= _unknownFields.GetHashCode();
+      }
+      return hash;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override string ToString() {
+      return pb::JsonFormatter.ToDiagnosticString(this);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void WriteTo(pb::CodedOutputStream output) {
+      if (Field1.Length != 0) {
+        output.WriteRawTag(10);
+        output.WriteString(Field1);
+      }
+      if (Field2 != 0) {
+        output.WriteRawTag(16);
+        output.WriteInt32(Field2);
+      }
+      if (Field3 != 0) {
+        output.WriteRawTag(24);
+        output.WriteInt32(Field3);
+      }
+      if (Field4.Length != 0) {
+        output.WriteRawTag(34);
+        output.WriteString(Field4);
+      }
+      field5_.WriteTo(output, _repeated_field5_codec);
+      if (Field6 != 0) {
+        output.WriteRawTag(48);
+        output.WriteInt32(Field6);
+      }
+      if (Field7.Length != 0) {
+        output.WriteRawTag(58);
+        output.WriteString(Field7);
+      }
+      if (Field9.Length != 0) {
+        output.WriteRawTag(74);
+        output.WriteString(Field9);
+      }
+      if (Field12 != false) {
+        output.WriteRawTag(96);
+        output.WriteBool(Field12);
+      }
+      if (Field13 != false) {
+        output.WriteRawTag(104);
+        output.WriteBool(Field13);
+      }
+      if (Field14 != false) {
+        output.WriteRawTag(112);
+        output.WriteBool(Field14);
+      }
+      if (field15_ != null) {
+        output.WriteRawTag(122);
+        output.WriteMessage(Field15);
+      }
+      if (Field16 != 0) {
+        output.WriteRawTag(128, 1);
+        output.WriteInt32(Field16);
+      }
+      if (Field17 != false) {
+        output.WriteRawTag(136, 1);
+        output.WriteBool(Field17);
+      }
+      if (Field18.Length != 0) {
+        output.WriteRawTag(146, 1);
+        output.WriteString(Field18);
+      }
+      if (Field22 != 0L) {
+        output.WriteRawTag(176, 1);
+        output.WriteInt64(Field22);
+      }
+      if (Field23 != 0) {
+        output.WriteRawTag(184, 1);
+        output.WriteInt32(Field23);
+      }
+      if (Field24 != false) {
+        output.WriteRawTag(192, 1);
+        output.WriteBool(Field24);
+      }
+      if (Field25 != 0) {
+        output.WriteRawTag(200, 1);
+        output.WriteInt32(Field25);
+      }
+      if (Field29 != 0) {
+        output.WriteRawTag(232, 1);
+        output.WriteInt32(Field29);
+      }
+      if (Field30 != false) {
+        output.WriteRawTag(240, 1);
+        output.WriteBool(Field30);
+      }
+      if (Field59 != false) {
+        output.WriteRawTag(216, 3);
+        output.WriteBool(Field59);
+      }
+      if (Field60 != 0) {
+        output.WriteRawTag(224, 3);
+        output.WriteInt32(Field60);
+      }
+      if (Field67 != 0) {
+        output.WriteRawTag(152, 4);
+        output.WriteInt32(Field67);
+      }
+      if (Field68 != 0) {
+        output.WriteRawTag(160, 4);
+        output.WriteInt32(Field68);
+      }
+      if (Field78 != false) {
+        output.WriteRawTag(240, 4);
+        output.WriteBool(Field78);
+      }
+      if (Field80 != false) {
+        output.WriteRawTag(128, 5);
+        output.WriteBool(Field80);
+      }
+      if (Field81 != false) {
+        output.WriteRawTag(136, 5);
+        output.WriteBool(Field81);
+      }
+      if (Field100 != 0) {
+        output.WriteRawTag(160, 6);
+        output.WriteInt32(Field100);
+      }
+      if (Field101 != 0) {
+        output.WriteRawTag(168, 6);
+        output.WriteInt32(Field101);
+      }
+      if (Field102.Length != 0) {
+        output.WriteRawTag(178, 6);
+        output.WriteString(Field102);
+      }
+      if (Field103.Length != 0) {
+        output.WriteRawTag(186, 6);
+        output.WriteString(Field103);
+      }
+      if (Field104 != 0) {
+        output.WriteRawTag(192, 6);
+        output.WriteInt32(Field104);
+      }
+      if (Field128 != 0) {
+        output.WriteRawTag(128, 8);
+        output.WriteInt32(Field128);
+      }
+      if (Field129.Length != 0) {
+        output.WriteRawTag(138, 8);
+        output.WriteString(Field129);
+      }
+      if (Field130 != 0) {
+        output.WriteRawTag(144, 8);
+        output.WriteInt32(Field130);
+      }
+      if (Field131 != 0) {
+        output.WriteRawTag(152, 8);
+        output.WriteInt32(Field131);
+      }
+      if (Field150 != 0) {
+        output.WriteRawTag(176, 9);
+        output.WriteInt32(Field150);
+      }
+      if (Field271 != 0) {
+        output.WriteRawTag(248, 16);
+        output.WriteInt32(Field271);
+      }
+      if (Field272 != 0) {
+        output.WriteRawTag(128, 17);
+        output.WriteInt32(Field272);
+      }
+      if (Field280 != 0) {
+        output.WriteRawTag(192, 17);
+        output.WriteInt32(Field280);
+      }
+      if (_unknownFields != null) {
+        _unknownFields.WriteTo(output);
+      }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int CalculateSize() {
+      int size = 0;
+      if (Field1.Length != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeStringSize(Field1);
+      }
+      if (Field9.Length != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeStringSize(Field9);
+      }
+      if (Field18.Length != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeStringSize(Field18);
+      }
+      if (Field80 != false) {
+        size += 2 + 1;
+      }
+      if (Field81 != false) {
+        size += 2 + 1;
+      }
+      if (Field2 != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Field2);
+      }
+      if (Field3 != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Field3);
+      }
+      if (Field280 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field280);
+      }
+      if (Field6 != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Field6);
+      }
+      if (Field22 != 0L) {
+        size += 2 + pb::CodedOutputStream.ComputeInt64Size(Field22);
+      }
+      if (Field4.Length != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeStringSize(Field4);
+      }
+      size += field5_.CalculateSize(_repeated_field5_codec);
+      if (Field59 != false) {
+        size += 2 + 1;
+      }
+      if (Field7.Length != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeStringSize(Field7);
+      }
+      if (Field16 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field16);
+      }
+      if (Field130 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field130);
+      }
+      if (Field12 != false) {
+        size += 1 + 1;
+      }
+      if (Field17 != false) {
+        size += 2 + 1;
+      }
+      if (Field13 != false) {
+        size += 1 + 1;
+      }
+      if (Field14 != false) {
+        size += 1 + 1;
+      }
+      if (Field104 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field104);
+      }
+      if (Field100 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field100);
+      }
+      if (Field101 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field101);
+      }
+      if (Field102.Length != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeStringSize(Field102);
+      }
+      if (Field103.Length != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeStringSize(Field103);
+      }
+      if (Field29 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field29);
+      }
+      if (Field30 != false) {
+        size += 2 + 1;
+      }
+      if (Field60 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field60);
+      }
+      if (Field271 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field271);
+      }
+      if (Field272 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field272);
+      }
+      if (Field150 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field150);
+      }
+      if (Field23 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field23);
+      }
+      if (Field24 != false) {
+        size += 2 + 1;
+      }
+      if (Field25 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field25);
+      }
+      if (field15_ != null) {
+        size += 1 + pb::CodedOutputStream.ComputeMessageSize(Field15);
+      }
+      if (Field78 != false) {
+        size += 2 + 1;
+      }
+      if (Field67 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field67);
+      }
+      if (Field68 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field68);
+      }
+      if (Field128 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field128);
+      }
+      if (Field129.Length != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeStringSize(Field129);
+      }
+      if (Field131 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field131);
+      }
+      if (_unknownFields != null) {
+        size += _unknownFields.CalculateSize();
+      }
+      return size;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void MergeFrom(GoogleMessage1 other) {
+      if (other == null) {
+        return;
+      }
+      if (other.Field1.Length != 0) {
+        Field1 = other.Field1;
+      }
+      if (other.Field9.Length != 0) {
+        Field9 = other.Field9;
+      }
+      if (other.Field18.Length != 0) {
+        Field18 = other.Field18;
+      }
+      if (other.Field80 != false) {
+        Field80 = other.Field80;
+      }
+      if (other.Field81 != false) {
+        Field81 = other.Field81;
+      }
+      if (other.Field2 != 0) {
+        Field2 = other.Field2;
+      }
+      if (other.Field3 != 0) {
+        Field3 = other.Field3;
+      }
+      if (other.Field280 != 0) {
+        Field280 = other.Field280;
+      }
+      if (other.Field6 != 0) {
+        Field6 = other.Field6;
+      }
+      if (other.Field22 != 0L) {
+        Field22 = other.Field22;
+      }
+      if (other.Field4.Length != 0) {
+        Field4 = other.Field4;
+      }
+      field5_.Add(other.field5_);
+      if (other.Field59 != false) {
+        Field59 = other.Field59;
+      }
+      if (other.Field7.Length != 0) {
+        Field7 = other.Field7;
+      }
+      if (other.Field16 != 0) {
+        Field16 = other.Field16;
+      }
+      if (other.Field130 != 0) {
+        Field130 = other.Field130;
+      }
+      if (other.Field12 != false) {
+        Field12 = other.Field12;
+      }
+      if (other.Field17 != false) {
+        Field17 = other.Field17;
+      }
+      if (other.Field13 != false) {
+        Field13 = other.Field13;
+      }
+      if (other.Field14 != false) {
+        Field14 = other.Field14;
+      }
+      if (other.Field104 != 0) {
+        Field104 = other.Field104;
+      }
+      if (other.Field100 != 0) {
+        Field100 = other.Field100;
+      }
+      if (other.Field101 != 0) {
+        Field101 = other.Field101;
+      }
+      if (other.Field102.Length != 0) {
+        Field102 = other.Field102;
+      }
+      if (other.Field103.Length != 0) {
+        Field103 = other.Field103;
+      }
+      if (other.Field29 != 0) {
+        Field29 = other.Field29;
+      }
+      if (other.Field30 != false) {
+        Field30 = other.Field30;
+      }
+      if (other.Field60 != 0) {
+        Field60 = other.Field60;
+      }
+      if (other.Field271 != 0) {
+        Field271 = other.Field271;
+      }
+      if (other.Field272 != 0) {
+        Field272 = other.Field272;
+      }
+      if (other.Field150 != 0) {
+        Field150 = other.Field150;
+      }
+      if (other.Field23 != 0) {
+        Field23 = other.Field23;
+      }
+      if (other.Field24 != false) {
+        Field24 = other.Field24;
+      }
+      if (other.Field25 != 0) {
+        Field25 = other.Field25;
+      }
+      if (other.field15_ != null) {
+        if (field15_ == null) {
+          Field15 = new global::Benchmarks.Proto3.GoogleMessage1SubMessage();
+        }
+        Field15.MergeFrom(other.Field15);
+      }
+      if (other.Field78 != false) {
+        Field78 = other.Field78;
+      }
+      if (other.Field67 != 0) {
+        Field67 = other.Field67;
+      }
+      if (other.Field68 != 0) {
+        Field68 = other.Field68;
+      }
+      if (other.Field128 != 0) {
+        Field128 = other.Field128;
+      }
+      if (other.Field129.Length != 0) {
+        Field129 = other.Field129;
+      }
+      if (other.Field131 != 0) {
+        Field131 = other.Field131;
+      }
+      _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void MergeFrom(pb::CodedInputStream input) {
+      uint tag;
+      while ((tag = input.ReadTag()) != 0) {
+        switch(tag) {
+          default:
+            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+            break;
+          case 10: {
+            Field1 = input.ReadString();
+            break;
+          }
+          case 16: {
+            Field2 = input.ReadInt32();
+            break;
+          }
+          case 24: {
+            Field3 = input.ReadInt32();
+            break;
+          }
+          case 34: {
+            Field4 = input.ReadString();
+            break;
+          }
+          case 42:
+          case 41: {
+            field5_.AddEntriesFrom(input, _repeated_field5_codec);
+            break;
+          }
+          case 48: {
+            Field6 = input.ReadInt32();
+            break;
+          }
+          case 58: {
+            Field7 = input.ReadString();
+            break;
+          }
+          case 74: {
+            Field9 = input.ReadString();
+            break;
+          }
+          case 96: {
+            Field12 = input.ReadBool();
+            break;
+          }
+          case 104: {
+            Field13 = input.ReadBool();
+            break;
+          }
+          case 112: {
+            Field14 = input.ReadBool();
+            break;
+          }
+          case 122: {
+            if (field15_ == null) {
+              Field15 = new global::Benchmarks.Proto3.GoogleMessage1SubMessage();
+            }
+            input.ReadMessage(Field15);
+            break;
+          }
+          case 128: {
+            Field16 = input.ReadInt32();
+            break;
+          }
+          case 136: {
+            Field17 = input.ReadBool();
+            break;
+          }
+          case 146: {
+            Field18 = input.ReadString();
+            break;
+          }
+          case 176: {
+            Field22 = input.ReadInt64();
+            break;
+          }
+          case 184: {
+            Field23 = input.ReadInt32();
+            break;
+          }
+          case 192: {
+            Field24 = input.ReadBool();
+            break;
+          }
+          case 200: {
+            Field25 = input.ReadInt32();
+            break;
+          }
+          case 232: {
+            Field29 = input.ReadInt32();
+            break;
+          }
+          case 240: {
+            Field30 = input.ReadBool();
+            break;
+          }
+          case 472: {
+            Field59 = input.ReadBool();
+            break;
+          }
+          case 480: {
+            Field60 = input.ReadInt32();
+            break;
+          }
+          case 536: {
+            Field67 = input.ReadInt32();
+            break;
+          }
+          case 544: {
+            Field68 = input.ReadInt32();
+            break;
+          }
+          case 624: {
+            Field78 = input.ReadBool();
+            break;
+          }
+          case 640: {
+            Field80 = input.ReadBool();
+            break;
+          }
+          case 648: {
+            Field81 = input.ReadBool();
+            break;
+          }
+          case 800: {
+            Field100 = input.ReadInt32();
+            break;
+          }
+          case 808: {
+            Field101 = input.ReadInt32();
+            break;
+          }
+          case 818: {
+            Field102 = input.ReadString();
+            break;
+          }
+          case 826: {
+            Field103 = input.ReadString();
+            break;
+          }
+          case 832: {
+            Field104 = input.ReadInt32();
+            break;
+          }
+          case 1024: {
+            Field128 = input.ReadInt32();
+            break;
+          }
+          case 1034: {
+            Field129 = input.ReadString();
+            break;
+          }
+          case 1040: {
+            Field130 = input.ReadInt32();
+            break;
+          }
+          case 1048: {
+            Field131 = input.ReadInt32();
+            break;
+          }
+          case 1200: {
+            Field150 = input.ReadInt32();
+            break;
+          }
+          case 2168: {
+            Field271 = input.ReadInt32();
+            break;
+          }
+          case 2176: {
+            Field272 = input.ReadInt32();
+            break;
+          }
+          case 2240: {
+            Field280 = input.ReadInt32();
+            break;
+          }
+        }
+      }
+    }
+
+  }
+
+  public sealed partial class GoogleMessage1SubMessage : pb::IMessage<GoogleMessage1SubMessage> {
+    private static readonly pb::MessageParser<GoogleMessage1SubMessage> _parser = new pb::MessageParser<GoogleMessage1SubMessage>(() => new GoogleMessage1SubMessage());
+    private pb::UnknownFieldSet _unknownFields;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public static pb::MessageParser<GoogleMessage1SubMessage> Parser { get { return _parser; } }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public static pbr::MessageDescriptor Descriptor {
+      get { return global::Benchmarks.Proto3.BenchmarkMessage1Proto3Reflection.Descriptor.MessageTypes[1]; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    pbr::MessageDescriptor pb::IMessage.Descriptor {
+      get { return Descriptor; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public GoogleMessage1SubMessage() {
+      OnConstruction();
+    }
+
+    partial void OnConstruction();
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public GoogleMessage1SubMessage(GoogleMessage1SubMessage other) : this() {
+      field1_ = other.field1_;
+      field2_ = other.field2_;
+      field3_ = other.field3_;
+      field15_ = other.field15_;
+      field12_ = other.field12_;
+      field13_ = other.field13_;
+      field14_ = other.field14_;
+      field16_ = other.field16_;
+      field19_ = other.field19_;
+      field20_ = other.field20_;
+      field28_ = other.field28_;
+      field21_ = other.field21_;
+      field22_ = other.field22_;
+      field23_ = other.field23_;
+      field206_ = other.field206_;
+      field203_ = other.field203_;
+      field204_ = other.field204_;
+      field205_ = other.field205_;
+      field207_ = other.field207_;
+      field300_ = other.field300_;
+      _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public GoogleMessage1SubMessage Clone() {
+      return new GoogleMessage1SubMessage(this);
+    }
+
+    /// <summary>Field number for the "field1" field.</summary>
+    public const int Field1FieldNumber = 1;
+    private int field1_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field1 {
+      get { return field1_; }
+      set {
+        field1_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field2" field.</summary>
+    public const int Field2FieldNumber = 2;
+    private int field2_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field2 {
+      get { return field2_; }
+      set {
+        field2_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field3" field.</summary>
+    public const int Field3FieldNumber = 3;
+    private int field3_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field3 {
+      get { return field3_; }
+      set {
+        field3_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field15" field.</summary>
+    public const int Field15FieldNumber = 15;
+    private string field15_ = "";
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string Field15 {
+      get { return field15_; }
+      set {
+        field15_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    /// <summary>Field number for the "field12" field.</summary>
+    public const int Field12FieldNumber = 12;
+    private bool field12_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field12 {
+      get { return field12_; }
+      set {
+        field12_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field13" field.</summary>
+    public const int Field13FieldNumber = 13;
+    private long field13_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public long Field13 {
+      get { return field13_; }
+      set {
+        field13_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field14" field.</summary>
+    public const int Field14FieldNumber = 14;
+    private long field14_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public long Field14 {
+      get { return field14_; }
+      set {
+        field14_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field16" field.</summary>
+    public const int Field16FieldNumber = 16;
+    private int field16_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field16 {
+      get { return field16_; }
+      set {
+        field16_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field19" field.</summary>
+    public const int Field19FieldNumber = 19;
+    private int field19_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field19 {
+      get { return field19_; }
+      set {
+        field19_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field20" field.</summary>
+    public const int Field20FieldNumber = 20;
+    private bool field20_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field20 {
+      get { return field20_; }
+      set {
+        field20_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field28" field.</summary>
+    public const int Field28FieldNumber = 28;
+    private bool field28_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field28 {
+      get { return field28_; }
+      set {
+        field28_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field21" field.</summary>
+    public const int Field21FieldNumber = 21;
+    private ulong field21_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public ulong Field21 {
+      get { return field21_; }
+      set {
+        field21_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field22" field.</summary>
+    public const int Field22FieldNumber = 22;
+    private int field22_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field22 {
+      get { return field22_; }
+      set {
+        field22_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field23" field.</summary>
+    public const int Field23FieldNumber = 23;
+    private bool field23_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field23 {
+      get { return field23_; }
+      set {
+        field23_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field206" field.</summary>
+    public const int Field206FieldNumber = 206;
+    private bool field206_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Field206 {
+      get { return field206_; }
+      set {
+        field206_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field203" field.</summary>
+    public const int Field203FieldNumber = 203;
+    private uint field203_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public uint Field203 {
+      get { return field203_; }
+      set {
+        field203_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field204" field.</summary>
+    public const int Field204FieldNumber = 204;
+    private int field204_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int Field204 {
+      get { return field204_; }
+      set {
+        field204_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field205" field.</summary>
+    public const int Field205FieldNumber = 205;
+    private string field205_ = "";
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string Field205 {
+      get { return field205_; }
+      set {
+        field205_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    /// <summary>Field number for the "field207" field.</summary>
+    public const int Field207FieldNumber = 207;
+    private ulong field207_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public ulong Field207 {
+      get { return field207_; }
+      set {
+        field207_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "field300" field.</summary>
+    public const int Field300FieldNumber = 300;
+    private ulong field300_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public ulong Field300 {
+      get { return field300_; }
+      set {
+        field300_ = value;
+      }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override bool Equals(object other) {
+      return Equals(other as GoogleMessage1SubMessage);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Equals(GoogleMessage1SubMessage other) {
+      if (ReferenceEquals(other, null)) {
+        return false;
+      }
+      if (ReferenceEquals(other, this)) {
+        return true;
+      }
+      if (Field1 != other.Field1) return false;
+      if (Field2 != other.Field2) return false;
+      if (Field3 != other.Field3) return false;
+      if (Field15 != other.Field15) return false;
+      if (Field12 != other.Field12) return false;
+      if (Field13 != other.Field13) return false;
+      if (Field14 != other.Field14) return false;
+      if (Field16 != other.Field16) return false;
+      if (Field19 != other.Field19) return false;
+      if (Field20 != other.Field20) return false;
+      if (Field28 != other.Field28) return false;
+      if (Field21 != other.Field21) return false;
+      if (Field22 != other.Field22) return false;
+      if (Field23 != other.Field23) return false;
+      if (Field206 != other.Field206) return false;
+      if (Field203 != other.Field203) return false;
+      if (Field204 != other.Field204) return false;
+      if (Field205 != other.Field205) return false;
+      if (Field207 != other.Field207) return false;
+      if (Field300 != other.Field300) return false;
+      return Equals(_unknownFields, other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override int GetHashCode() {
+      int hash = 1;
+      if (Field1 != 0) hash ^= Field1.GetHashCode();
+      if (Field2 != 0) hash ^= Field2.GetHashCode();
+      if (Field3 != 0) hash ^= Field3.GetHashCode();
+      if (Field15.Length != 0) hash ^= Field15.GetHashCode();
+      if (Field12 != false) hash ^= Field12.GetHashCode();
+      if (Field13 != 0L) hash ^= Field13.GetHashCode();
+      if (Field14 != 0L) hash ^= Field14.GetHashCode();
+      if (Field16 != 0) hash ^= Field16.GetHashCode();
+      if (Field19 != 0) hash ^= Field19.GetHashCode();
+      if (Field20 != false) hash ^= Field20.GetHashCode();
+      if (Field28 != false) hash ^= Field28.GetHashCode();
+      if (Field21 != 0UL) hash ^= Field21.GetHashCode();
+      if (Field22 != 0) hash ^= Field22.GetHashCode();
+      if (Field23 != false) hash ^= Field23.GetHashCode();
+      if (Field206 != false) hash ^= Field206.GetHashCode();
+      if (Field203 != 0) hash ^= Field203.GetHashCode();
+      if (Field204 != 0) hash ^= Field204.GetHashCode();
+      if (Field205.Length != 0) hash ^= Field205.GetHashCode();
+      if (Field207 != 0UL) hash ^= Field207.GetHashCode();
+      if (Field300 != 0UL) hash ^= Field300.GetHashCode();
+      if (_unknownFields != null) {
+        hash ^= _unknownFields.GetHashCode();
+      }
+      return hash;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override string ToString() {
+      return pb::JsonFormatter.ToDiagnosticString(this);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void WriteTo(pb::CodedOutputStream output) {
+      if (Field1 != 0) {
+        output.WriteRawTag(8);
+        output.WriteInt32(Field1);
+      }
+      if (Field2 != 0) {
+        output.WriteRawTag(16);
+        output.WriteInt32(Field2);
+      }
+      if (Field3 != 0) {
+        output.WriteRawTag(24);
+        output.WriteInt32(Field3);
+      }
+      if (Field12 != false) {
+        output.WriteRawTag(96);
+        output.WriteBool(Field12);
+      }
+      if (Field13 != 0L) {
+        output.WriteRawTag(104);
+        output.WriteInt64(Field13);
+      }
+      if (Field14 != 0L) {
+        output.WriteRawTag(112);
+        output.WriteInt64(Field14);
+      }
+      if (Field15.Length != 0) {
+        output.WriteRawTag(122);
+        output.WriteString(Field15);
+      }
+      if (Field16 != 0) {
+        output.WriteRawTag(128, 1);
+        output.WriteInt32(Field16);
+      }
+      if (Field19 != 0) {
+        output.WriteRawTag(152, 1);
+        output.WriteInt32(Field19);
+      }
+      if (Field20 != false) {
+        output.WriteRawTag(160, 1);
+        output.WriteBool(Field20);
+      }
+      if (Field21 != 0UL) {
+        output.WriteRawTag(169, 1);
+        output.WriteFixed64(Field21);
+      }
+      if (Field22 != 0) {
+        output.WriteRawTag(176, 1);
+        output.WriteInt32(Field22);
+      }
+      if (Field23 != false) {
+        output.WriteRawTag(184, 1);
+        output.WriteBool(Field23);
+      }
+      if (Field28 != false) {
+        output.WriteRawTag(224, 1);
+        output.WriteBool(Field28);
+      }
+      if (Field203 != 0) {
+        output.WriteRawTag(221, 12);
+        output.WriteFixed32(Field203);
+      }
+      if (Field204 != 0) {
+        output.WriteRawTag(224, 12);
+        output.WriteInt32(Field204);
+      }
+      if (Field205.Length != 0) {
+        output.WriteRawTag(234, 12);
+        output.WriteString(Field205);
+      }
+      if (Field206 != false) {
+        output.WriteRawTag(240, 12);
+        output.WriteBool(Field206);
+      }
+      if (Field207 != 0UL) {
+        output.WriteRawTag(248, 12);
+        output.WriteUInt64(Field207);
+      }
+      if (Field300 != 0UL) {
+        output.WriteRawTag(224, 18);
+        output.WriteUInt64(Field300);
+      }
+      if (_unknownFields != null) {
+        _unknownFields.WriteTo(output);
+      }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int CalculateSize() {
+      int size = 0;
+      if (Field1 != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Field1);
+      }
+      if (Field2 != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Field2);
+      }
+      if (Field3 != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeInt32Size(Field3);
+      }
+      if (Field15.Length != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeStringSize(Field15);
+      }
+      if (Field12 != false) {
+        size += 1 + 1;
+      }
+      if (Field13 != 0L) {
+        size += 1 + pb::CodedOutputStream.ComputeInt64Size(Field13);
+      }
+      if (Field14 != 0L) {
+        size += 1 + pb::CodedOutputStream.ComputeInt64Size(Field14);
+      }
+      if (Field16 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field16);
+      }
+      if (Field19 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field19);
+      }
+      if (Field20 != false) {
+        size += 2 + 1;
+      }
+      if (Field28 != false) {
+        size += 2 + 1;
+      }
+      if (Field21 != 0UL) {
+        size += 2 + 8;
+      }
+      if (Field22 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field22);
+      }
+      if (Field23 != false) {
+        size += 2 + 1;
+      }
+      if (Field206 != false) {
+        size += 2 + 1;
+      }
+      if (Field203 != 0) {
+        size += 2 + 4;
+      }
+      if (Field204 != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(Field204);
+      }
+      if (Field205.Length != 0) {
+        size += 2 + pb::CodedOutputStream.ComputeStringSize(Field205);
+      }
+      if (Field207 != 0UL) {
+        size += 2 + pb::CodedOutputStream.ComputeUInt64Size(Field207);
+      }
+      if (Field300 != 0UL) {
+        size += 2 + pb::CodedOutputStream.ComputeUInt64Size(Field300);
+      }
+      if (_unknownFields != null) {
+        size += _unknownFields.CalculateSize();
+      }
+      return size;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void MergeFrom(GoogleMessage1SubMessage other) {
+      if (other == null) {
+        return;
+      }
+      if (other.Field1 != 0) {
+        Field1 = other.Field1;
+      }
+      if (other.Field2 != 0) {
+        Field2 = other.Field2;
+      }
+      if (other.Field3 != 0) {
+        Field3 = other.Field3;
+      }
+      if (other.Field15.Length != 0) {
+        Field15 = other.Field15;
+      }
+      if (other.Field12 != false) {
+        Field12 = other.Field12;
+      }
+      if (other.Field13 != 0L) {
+        Field13 = other.Field13;
+      }
+      if (other.Field14 != 0L) {
+        Field14 = other.Field14;
+      }
+      if (other.Field16 != 0) {
+        Field16 = other.Field16;
+      }
+      if (other.Field19 != 0) {
+        Field19 = other.Field19;
+      }
+      if (other.Field20 != false) {
+        Field20 = other.Field20;
+      }
+      if (other.Field28 != false) {
+        Field28 = other.Field28;
+      }
+      if (other.Field21 != 0UL) {
+        Field21 = other.Field21;
+      }
+      if (other.Field22 != 0) {
+        Field22 = other.Field22;
+      }
+      if (other.Field23 != false) {
+        Field23 = other.Field23;
+      }
+      if (other.Field206 != false) {
+        Field206 = other.Field206;
+      }
+      if (other.Field203 != 0) {
+        Field203 = other.Field203;
+      }
+      if (other.Field204 != 0) {
+        Field204 = other.Field204;
+      }
+      if (other.Field205.Length != 0) {
+        Field205 = other.Field205;
+      }
+      if (other.Field207 != 0UL) {
+        Field207 = other.Field207;
+      }
+      if (other.Field300 != 0UL) {
+        Field300 = other.Field300;
+      }
+      _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void MergeFrom(pb::CodedInputStream input) {
+      uint tag;
+      while ((tag = input.ReadTag()) != 0) {
+        switch(tag) {
+          default:
+            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+            break;
+          case 8: {
+            Field1 = input.ReadInt32();
+            break;
+          }
+          case 16: {
+            Field2 = input.ReadInt32();
+            break;
+          }
+          case 24: {
+            Field3 = input.ReadInt32();
+            break;
+          }
+          case 96: {
+            Field12 = input.ReadBool();
+            break;
+          }
+          case 104: {
+            Field13 = input.ReadInt64();
+            break;
+          }
+          case 112: {
+            Field14 = input.ReadInt64();
+            break;
+          }
+          case 122: {
+            Field15 = input.ReadString();
+            break;
+          }
+          case 128: {
+            Field16 = input.ReadInt32();
+            break;
+          }
+          case 152: {
+            Field19 = input.ReadInt32();
+            break;
+          }
+          case 160: {
+            Field20 = input.ReadBool();
+            break;
+          }
+          case 169: {
+            Field21 = input.ReadFixed64();
+            break;
+          }
+          case 176: {
+            Field22 = input.ReadInt32();
+            break;
+          }
+          case 184: {
+            Field23 = input.ReadBool();
+            break;
+          }
+          case 224: {
+            Field28 = input.ReadBool();
+            break;
+          }
+          case 1629: {
+            Field203 = input.ReadFixed32();
+            break;
+          }
+          case 1632: {
+            Field204 = input.ReadInt32();
+            break;
+          }
+          case 1642: {
+            Field205 = input.ReadString();
+            break;
+          }
+          case 1648: {
+            Field206 = input.ReadBool();
+            break;
+          }
+          case 1656: {
+            Field207 = input.ReadUInt64();
+            break;
+          }
+          case 2400: {
+            Field300 = input.ReadUInt64();
+            break;
+          }
+        }
+      }
+    }
+
+  }
+
+  #endregion
+
+}
+
+#endregion Designer generated code

+ 250 - 0
csharp/src/Google.Protobuf.Benchmarks/Benchmarks.cs

@@ -0,0 +1,250 @@
+// <auto-generated>
+//     Generated by the protocol buffer compiler.  DO NOT EDIT!
+//     source: benchmarks.proto
+// </auto-generated>
+#pragma warning disable 1591, 0612, 3021
+#region Designer generated code
+
+using pb = global::Google.Protobuf;
+using pbc = global::Google.Protobuf.Collections;
+using pbr = global::Google.Protobuf.Reflection;
+using scg = global::System.Collections.Generic;
+namespace Benchmarks {
+
+  /// <summary>Holder for reflection information generated from benchmarks.proto</summary>
+  public static partial class BenchmarksReflection {
+
+    #region Descriptor
+    /// <summary>File descriptor for benchmarks.proto</summary>
+    public static pbr::FileDescriptor Descriptor {
+      get { return descriptor; }
+    }
+    private static pbr::FileDescriptor descriptor;
+
+    static BenchmarksReflection() {
+      byte[] descriptorData = global::System.Convert.FromBase64String(
+          string.Concat(
+            "ChBiZW5jaG1hcmtzLnByb3RvEgpiZW5jaG1hcmtzIkcKEEJlbmNobWFya0Rh",
+            "dGFzZXQSDAoEbmFtZRgBIAEoCRIUCgxtZXNzYWdlX25hbWUYAiABKAkSDwoH",
+            "cGF5bG9hZBgDIAMoDEIgCh5jb20uZ29vZ2xlLnByb3RvYnVmLmJlbmNobWFy",
+            "a3NiBnByb3RvMw=="));
+      descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
+          new pbr::FileDescriptor[] { },
+          new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] {
+            new pbr::GeneratedClrTypeInfo(typeof(global::Benchmarks.BenchmarkDataset), global::Benchmarks.BenchmarkDataset.Parser, new[]{ "Name", "MessageName", "Payload" }, null, null, null, null)
+          }));
+    }
+    #endregion
+
+  }
+  #region Messages
+  public sealed partial class BenchmarkDataset : pb::IMessage<BenchmarkDataset> {
+    private static readonly pb::MessageParser<BenchmarkDataset> _parser = new pb::MessageParser<BenchmarkDataset>(() => new BenchmarkDataset());
+    private pb::UnknownFieldSet _unknownFields;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public static pb::MessageParser<BenchmarkDataset> Parser { get { return _parser; } }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public static pbr::MessageDescriptor Descriptor {
+      get { return global::Benchmarks.BenchmarksReflection.Descriptor.MessageTypes[0]; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    pbr::MessageDescriptor pb::IMessage.Descriptor {
+      get { return Descriptor; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public BenchmarkDataset() {
+      OnConstruction();
+    }
+
+    partial void OnConstruction();
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public BenchmarkDataset(BenchmarkDataset other) : this() {
+      name_ = other.name_;
+      messageName_ = other.messageName_;
+      payload_ = other.payload_.Clone();
+      _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public BenchmarkDataset Clone() {
+      return new BenchmarkDataset(this);
+    }
+
+    /// <summary>Field number for the "name" field.</summary>
+    public const int NameFieldNumber = 1;
+    private string name_ = "";
+    /// <summary>
+    /// Name of the benchmark dataset.  This should be unique across all datasets.
+    /// Should only contain word characters: [a-zA-Z0-9_]
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string Name {
+      get { return name_; }
+      set {
+        name_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    /// <summary>Field number for the "message_name" field.</summary>
+    public const int MessageNameFieldNumber = 2;
+    private string messageName_ = "";
+    /// <summary>
+    /// Fully-qualified name of the protobuf message for this dataset.
+    /// It will be one of the messages defined benchmark_messages_proto2.proto
+    /// or benchmark_messages_proto3.proto.
+    ///
+    /// Implementations that do not support reflection can implement this with
+    /// an explicit "if/else" chain that lists every known message defined
+    /// in those files.
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string MessageName {
+      get { return messageName_; }
+      set {
+        messageName_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+
+    /// <summary>Field number for the "payload" field.</summary>
+    public const int PayloadFieldNumber = 3;
+    private static readonly pb::FieldCodec<pb::ByteString> _repeated_payload_codec
+        = pb::FieldCodec.ForBytes(26);
+    private readonly pbc::RepeatedField<pb::ByteString> payload_ = new pbc::RepeatedField<pb::ByteString>();
+    /// <summary>
+    /// The payload(s) for this dataset.  They should be parsed or serialized
+    /// in sequence, in a loop, ie.
+    ///
+    ///  while (!benchmarkDone) {  // Benchmark runner decides when to exit.
+    ///    for (i = 0; i &lt; benchmark.payload.length; i++) {
+    ///      parse(benchmark.payload[i])
+    ///    }
+    ///  }
+    ///
+    /// This is intended to let datasets include a variety of data to provide
+    /// potentially more realistic results than just parsing the same message
+    /// over and over.  A single message parsed repeatedly could yield unusually
+    /// good branch prediction performance.
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public pbc::RepeatedField<pb::ByteString> Payload {
+      get { return payload_; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override bool Equals(object other) {
+      return Equals(other as BenchmarkDataset);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Equals(BenchmarkDataset other) {
+      if (ReferenceEquals(other, null)) {
+        return false;
+      }
+      if (ReferenceEquals(other, this)) {
+        return true;
+      }
+      if (Name != other.Name) return false;
+      if (MessageName != other.MessageName) return false;
+      if(!payload_.Equals(other.payload_)) return false;
+      return Equals(_unknownFields, other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override int GetHashCode() {
+      int hash = 1;
+      if (Name.Length != 0) hash ^= Name.GetHashCode();
+      if (MessageName.Length != 0) hash ^= MessageName.GetHashCode();
+      hash ^= payload_.GetHashCode();
+      if (_unknownFields != null) {
+        hash ^= _unknownFields.GetHashCode();
+      }
+      return hash;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override string ToString() {
+      return pb::JsonFormatter.ToDiagnosticString(this);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void WriteTo(pb::CodedOutputStream output) {
+      if (Name.Length != 0) {
+        output.WriteRawTag(10);
+        output.WriteString(Name);
+      }
+      if (MessageName.Length != 0) {
+        output.WriteRawTag(18);
+        output.WriteString(MessageName);
+      }
+      payload_.WriteTo(output, _repeated_payload_codec);
+      if (_unknownFields != null) {
+        _unknownFields.WriteTo(output);
+      }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int CalculateSize() {
+      int size = 0;
+      if (Name.Length != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeStringSize(Name);
+      }
+      if (MessageName.Length != 0) {
+        size += 1 + pb::CodedOutputStream.ComputeStringSize(MessageName);
+      }
+      size += payload_.CalculateSize(_repeated_payload_codec);
+      if (_unknownFields != null) {
+        size += _unknownFields.CalculateSize();
+      }
+      return size;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void MergeFrom(BenchmarkDataset other) {
+      if (other == null) {
+        return;
+      }
+      if (other.Name.Length != 0) {
+        Name = other.Name;
+      }
+      if (other.MessageName.Length != 0) {
+        MessageName = other.MessageName;
+      }
+      payload_.Add(other.payload_);
+      _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void MergeFrom(pb::CodedInputStream input) {
+      uint tag;
+      while ((tag = input.ReadTag()) != 0) {
+        switch(tag) {
+          default:
+            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+            break;
+          case 10: {
+            Name = input.ReadString();
+            break;
+          }
+          case 18: {
+            MessageName = input.ReadString();
+            break;
+          }
+          case 26: {
+            payload_.AddEntriesFrom(input, _repeated_payload_codec);
+            break;
+          }
+        }
+      }
+    }
+
+  }
+
+  #endregion
+
+}
+
+#endregion Designer generated code

+ 18 - 0
csharp/src/Google.Protobuf.Benchmarks/Google.Protobuf.Benchmarks.csproj

@@ -0,0 +1,18 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <OutputType>Exe</OutputType>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
+    <IsPackable>False</IsPackable>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <PackageReference Include="BenchmarkDotNet" Version="0.11.4" />
+    <ProjectReference Include="..\Google.Protobuf\Google.Protobuf.csproj" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <EmbeddedResource Include="..\..\..\benchmarks\datasets\google_message1\proto3\dataset.google_message1_proto3.pb" />
+  </ItemGroup>
+
+</Project>

+ 46 - 0
csharp/src/Google.Protobuf.Benchmarks/Program.cs

@@ -0,0 +1,46 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2019 Google Inc.  All rights reserved.
+// https://github.com/protocolbuffers/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using BenchmarkDotNet.Running;
+
+namespace Google.Protobuf.Benchmarks
+{
+    /// <summary>
+    /// Entry point, that currently runs the sole benchmark we have.
+    /// Eventually we might want to be able to specify a particular dataset
+    /// from the command line.
+    /// </summary>
+    class Program
+    {
+        static void Main() => BenchmarkRunner.Run<SerializationBenchmark>();
+    }
+}

+ 120 - 0
csharp/src/Google.Protobuf.Benchmarks/SerializationBenchmark.cs

@@ -0,0 +1,120 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2019 Google Inc.  All rights reserved.
+// https://github.com/protocolbuffers/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using BenchmarkDotNet.Attributes;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+
+namespace Google.Protobuf.Benchmarks
+{
+    /// <summary>
+    /// Benchmark for serializing (to a MemoryStream) and deserializing (from a ByteString).
+    /// Over time we may wish to test the various different approaches to serialization and deserialization separately.
+    /// </summary>
+    [MemoryDiagnoser]
+    public class SerializationBenchmark
+    {
+        /// <summary>
+        /// All the configurations to be tested. Add more datasets to the array as they're available.
+        /// (When C# supports proto2, this will increase significantly.)
+        /// </summary>
+        public static SerializationConfig[] Configurations => new[]
+        {
+            new SerializationConfig("dataset.google_message1_proto3.pb")
+        };
+
+        [ParamsSource(nameof(Configurations))]
+        public SerializationConfig Configuration { get; set; }
+
+        private MessageParser parser;
+        /// <summary>
+        /// Each data set can contain multiple messages in a single file.
+        /// Each "write" operation should write each message in turn, and each "parse"
+        /// operation should parse each message in turn.
+        /// </summary>
+        private List<SubTest> subTests;
+
+        [GlobalSetup]
+        public void GlobalSetup()
+        {
+            parser = Configuration.Parser;
+            subTests = Configuration.Payloads.Select(p => new SubTest(p, parser.ParseFrom(p))).ToList();
+        }
+
+        [Benchmark]
+        public void WriteToStream() => subTests.ForEach(item => item.WriteToStream());
+
+        [Benchmark]
+        public void ToByteArray() => subTests.ForEach(item => item.ToByteArray());
+
+        [Benchmark]
+        public void ParseFromByteString() => subTests.ForEach(item => item.ParseFromByteString(parser));
+
+        [Benchmark]
+        public void ParseFromStream() => subTests.ForEach(item => item.ParseFromStream(parser));
+
+        private class SubTest
+        {
+            private readonly Stream destinationStream;
+            private readonly Stream sourceStream;
+            private readonly ByteString data;
+            private readonly IMessage message;
+
+            public SubTest(ByteString data, IMessage message)
+            {
+                destinationStream = new MemoryStream(data.Length);
+                sourceStream = new MemoryStream(data.ToByteArray());
+                this.data = data;
+                this.message = message;
+            }
+
+            public void Reset() => destinationStream.Position = 0;
+
+            public void WriteToStream()
+            {
+                destinationStream.Position = 0;
+                message.WriteTo(destinationStream);
+            }
+
+            public void ToByteArray() => message.ToByteArray();
+
+            public void ParseFromByteString(MessageParser parser) => parser.ParseFrom(data);
+
+            public void ParseFromStream(MessageParser parser)
+            {
+                sourceStream.Position = 0;
+                parser.ParseFrom(sourceStream);
+            }
+        }
+    }
+}

+ 89 - 0
csharp/src/Google.Protobuf.Benchmarks/SerializationConfig.cs

@@ -0,0 +1,89 @@
+#region Copyright notice and license
+// Protocol Buffers - Google's data interchange format
+// Copyright 2019 Google Inc.  All rights reserved.
+// https://github.com/protocolbuffers/protobuf
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#endregion
+
+using Benchmarks;
+using Google.Protobuf.Reflection;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+
+namespace Google.Protobuf.Benchmarks
+{
+    /// <summary>
+    /// The configuration for a single serialization test, loaded from a dataset.
+    /// </summary>
+    public class SerializationConfig
+    {
+        private static readonly Dictionary<string, MessageParser> parsersByMessageName = 
+            typeof(SerializationBenchmark).Assembly.GetTypes()
+                .Where(t => typeof(IMessage).IsAssignableFrom(t))
+                .ToDictionary(
+                    t => ((MessageDescriptor) t.GetProperty("Descriptor", BindingFlags.Static | BindingFlags.Public).GetValue(null)).FullName,
+                    t => ((MessageParser) t.GetProperty("Parser", BindingFlags.Static | BindingFlags.Public).GetValue(null)));
+
+        public MessageParser Parser { get; }
+        public IEnumerable<ByteString> Payloads { get; }
+        public string Name { get; }
+
+        public SerializationConfig(string resource)
+        {
+            var data = LoadData(resource);
+            var dataset = BenchmarkDataset.Parser.ParseFrom(data);
+
+            if (!parsersByMessageName.TryGetValue(dataset.MessageName, out var parser))
+            {
+                throw new ArgumentException($"No parser for message {dataset.MessageName} in this assembly");
+            }
+            Parser = parser;
+            Payloads = dataset.Payload;
+            Name = dataset.Name;
+        }
+
+        private static byte[] LoadData(string resource)
+        {
+            using (var stream = typeof(SerializationBenchmark).Assembly.GetManifestResourceStream($"Google.Protobuf.Benchmarks.{resource}"))
+            {
+                if (stream == null)
+                {
+                    throw new ArgumentException($"Unable to load embedded resource {resource}");
+                }
+                var copy = new MemoryStream();
+                stream.CopyTo(copy);
+                return copy.ToArray();
+            }
+        }
+
+        public override string ToString() => Name;
+    }
+}

+ 519 - 30
csharp/src/Google.Protobuf.Conformance/Conformance.cs

@@ -24,26 +24,35 @@ namespace Conformance {
     static ConformanceReflection() {
       byte[] descriptorData = global::System.Convert.FromBase64String(
           string.Concat(
-            "ChFjb25mb3JtYW5jZS5wcm90bxILY29uZm9ybWFuY2Ui1QEKEkNvbmZvcm1h",
-            "bmNlUmVxdWVzdBIaChBwcm90b2J1Zl9wYXlsb2FkGAEgASgMSAASFgoManNv",
-            "bl9wYXlsb2FkGAIgASgJSAASOAoXcmVxdWVzdGVkX291dHB1dF9mb3JtYXQY",
-            "AyABKA4yFy5jb25mb3JtYW5jZS5XaXJlRm9ybWF0EhQKDG1lc3NhZ2VfdHlw",
-            "ZRgEIAEoCRIwCg10ZXN0X2NhdGVnb3J5GAUgASgOMhkuY29uZm9ybWFuY2Uu",
-            "VGVzdENhdGVnb3J5QgkKB3BheWxvYWQisQEKE0NvbmZvcm1hbmNlUmVzcG9u",
-            "c2USFQoLcGFyc2VfZXJyb3IYASABKAlIABIZCg9zZXJpYWxpemVfZXJyb3IY",
-            "BiABKAlIABIXCg1ydW50aW1lX2Vycm9yGAIgASgJSAASGgoQcHJvdG9idWZf",
-            "cGF5bG9hZBgDIAEoDEgAEhYKDGpzb25fcGF5bG9hZBgEIAEoCUgAEhEKB3Nr",
-            "aXBwZWQYBSABKAlIAEIICgZyZXN1bHQqNQoKV2lyZUZvcm1hdBIPCgtVTlNQ",
-            "RUNJRklFRBAAEgwKCFBST1RPQlVGEAESCAoESlNPThACKmoKDFRlc3RDYXRl",
-            "Z29yeRIUChBVTlNQRUNJRklFRF9URVNUEAASDwoLQklOQVJZX1RFU1QQARIN",
-            "CglKU09OX1RFU1QQAhIkCiBKU09OX0lHTk9SRV9VTktOT1dOX1BBUlNJTkdf",
-            "VEVTVBADQiEKH2NvbS5nb29nbGUucHJvdG9idWYuY29uZm9ybWFuY2ViBnBy",
-            "b3RvMw=="));
+            "ChFjb25mb3JtYW5jZS5wcm90bxILY29uZm9ybWFuY2UiHQoKRmFpbHVyZVNl",
+            "dBIPCgdmYWlsdXJlGAEgAygJIuMCChJDb25mb3JtYW5jZVJlcXVlc3QSGgoQ",
+            "cHJvdG9idWZfcGF5bG9hZBgBIAEoDEgAEhYKDGpzb25fcGF5bG9hZBgCIAEo",
+            "CUgAEhYKDGpzcGJfcGF5bG9hZBgHIAEoCUgAEhYKDHRleHRfcGF5bG9hZBgI",
+            "IAEoCUgAEjgKF3JlcXVlc3RlZF9vdXRwdXRfZm9ybWF0GAMgASgOMhcuY29u",
+            "Zm9ybWFuY2UuV2lyZUZvcm1hdBIUCgxtZXNzYWdlX3R5cGUYBCABKAkSMAoN",
+            "dGVzdF9jYXRlZ29yeRgFIAEoDjIZLmNvbmZvcm1hbmNlLlRlc3RDYXRlZ29y",
+            "eRI+ChVqc3BiX2VuY29kaW5nX29wdGlvbnMYBiABKAsyHy5jb25mb3JtYW5j",
+            "ZS5Kc3BiRW5jb2RpbmdDb25maWcSHAoUcHJpbnRfdW5rbm93bl9maWVsZHMY",
+            "CSABKAhCCQoHcGF5bG9hZCLhAQoTQ29uZm9ybWFuY2VSZXNwb25zZRIVCgtw",
+            "YXJzZV9lcnJvchgBIAEoCUgAEhkKD3NlcmlhbGl6ZV9lcnJvchgGIAEoCUgA",
+            "EhcKDXJ1bnRpbWVfZXJyb3IYAiABKAlIABIaChBwcm90b2J1Zl9wYXlsb2Fk",
+            "GAMgASgMSAASFgoManNvbl9wYXlsb2FkGAQgASgJSAASEQoHc2tpcHBlZBgF",
+            "IAEoCUgAEhYKDGpzcGJfcGF5bG9hZBgHIAEoCUgAEhYKDHRleHRfcGF5bG9h",
+            "ZBgIIAEoCUgAQggKBnJlc3VsdCI3ChJKc3BiRW5jb2RpbmdDb25maWcSIQoZ",
+            "dXNlX2pzcGJfYXJyYXlfYW55X2Zvcm1hdBgBIAEoCCpQCgpXaXJlRm9ybWF0",
+            "Eg8KC1VOU1BFQ0lGSUVEEAASDAoIUFJPVE9CVUYQARIICgRKU09OEAISCAoE",
+            "SlNQQhADEg8KC1RFWFRfRk9STUFUEAQqjwEKDFRlc3RDYXRlZ29yeRIUChBV",
+            "TlNQRUNJRklFRF9URVNUEAASDwoLQklOQVJZX1RFU1QQARINCglKU09OX1RF",
+            "U1QQAhIkCiBKU09OX0lHTk9SRV9VTktOT1dOX1BBUlNJTkdfVEVTVBADEg0K",
+            "CUpTUEJfVEVTVBAEEhQKEFRFWFRfRk9STUFUX1RFU1QQBUIhCh9jb20uZ29v",
+            "Z2xlLnByb3RvYnVmLmNvbmZvcm1hbmNlYgZwcm90bzM="));
       descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
           new pbr::FileDescriptor[] { },
-          new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Conformance.WireFormat), typeof(global::Conformance.TestCategory), }, new pbr::GeneratedClrTypeInfo[] {
-            new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceRequest), global::Conformance.ConformanceRequest.Parser, new[]{ "ProtobufPayload", "JsonPayload", "RequestedOutputFormat", "MessageType", "TestCategory" }, new[]{ "Payload" }, null, null),
-            new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceResponse), global::Conformance.ConformanceResponse.Parser, new[]{ "ParseError", "SerializeError", "RuntimeError", "ProtobufPayload", "JsonPayload", "Skipped" }, new[]{ "Result" }, null, null)
+          new pbr::GeneratedClrTypeInfo(new[] {typeof(global::Conformance.WireFormat), typeof(global::Conformance.TestCategory), }, null, new pbr::GeneratedClrTypeInfo[] {
+            new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.FailureSet), global::Conformance.FailureSet.Parser, new[]{ "Failure" }, null, null, null, null),
+            new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceRequest), global::Conformance.ConformanceRequest.Parser, new[]{ "ProtobufPayload", "JsonPayload", "JspbPayload", "TextPayload", "RequestedOutputFormat", "MessageType", "TestCategory", "JspbEncodingOptions", "PrintUnknownFields" }, new[]{ "Payload" }, null, null, null),
+            new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.ConformanceResponse), global::Conformance.ConformanceResponse.Parser, new[]{ "ParseError", "SerializeError", "RuntimeError", "ProtobufPayload", "JsonPayload", "Skipped", "JspbPayload", "TextPayload" }, new[]{ "Result" }, null, null, null),
+            new pbr::GeneratedClrTypeInfo(typeof(global::Conformance.JspbEncodingConfig), global::Conformance.JspbEncodingConfig.Parser, new[]{ "UseJspbArrayAnyFormat" }, null, null, null, null)
           }));
     }
     #endregion
@@ -54,6 +63,11 @@ namespace Conformance {
     [pbr::OriginalName("UNSPECIFIED")] Unspecified = 0,
     [pbr::OriginalName("PROTOBUF")] Protobuf = 1,
     [pbr::OriginalName("JSON")] Json = 2,
+    /// <summary>
+    /// Google internal only. Opensource testees just skip it.
+    /// </summary>
+    [pbr::OriginalName("JSPB")] Jspb = 3,
+    [pbr::OriginalName("TEXT_FORMAT")] TextFormat = 4,
   }
 
   public enum TestCategory {
@@ -74,11 +88,146 @@ namespace Conformance {
     /// for more detail.
     /// </summary>
     [pbr::OriginalName("JSON_IGNORE_UNKNOWN_PARSING_TEST")] JsonIgnoreUnknownParsingTest = 3,
+    /// <summary>
+    /// Test jspb wire format. Google internal only. Opensource testees just skip it.
+    /// </summary>
+    [pbr::OriginalName("JSPB_TEST")] JspbTest = 4,
+    /// <summary>
+    /// Test text format. For cpp, java and python, testees can already deal with
+    /// this type. Testees of other languages can simply skip it.
+    /// </summary>
+    [pbr::OriginalName("TEXT_FORMAT_TEST")] TextFormatTest = 5,
   }
 
   #endregion
 
   #region Messages
+  /// <summary>
+  /// The conformance runner will request a list of failures as the first request.
+  /// This will be known by message_type == "conformance.FailureSet", a conformance
+  /// test should return a serialized FailureSet in protobuf_payload.
+  /// </summary>
+  public sealed partial class FailureSet : pb::IMessage<FailureSet> {
+    private static readonly pb::MessageParser<FailureSet> _parser = new pb::MessageParser<FailureSet>(() => new FailureSet());
+    private pb::UnknownFieldSet _unknownFields;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public static pb::MessageParser<FailureSet> Parser { get { return _parser; } }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public static pbr::MessageDescriptor Descriptor {
+      get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[0]; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    pbr::MessageDescriptor pb::IMessage.Descriptor {
+      get { return Descriptor; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public FailureSet() {
+      OnConstruction();
+    }
+
+    partial void OnConstruction();
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public FailureSet(FailureSet other) : this() {
+      failure_ = other.failure_.Clone();
+      _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public FailureSet Clone() {
+      return new FailureSet(this);
+    }
+
+    /// <summary>Field number for the "failure" field.</summary>
+    public const int FailureFieldNumber = 1;
+    private static readonly pb::FieldCodec<string> _repeated_failure_codec
+        = pb::FieldCodec.ForString(10);
+    private readonly pbc::RepeatedField<string> failure_ = new pbc::RepeatedField<string>();
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public pbc::RepeatedField<string> Failure {
+      get { return failure_; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override bool Equals(object other) {
+      return Equals(other as FailureSet);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Equals(FailureSet other) {
+      if (ReferenceEquals(other, null)) {
+        return false;
+      }
+      if (ReferenceEquals(other, this)) {
+        return true;
+      }
+      if(!failure_.Equals(other.failure_)) return false;
+      return Equals(_unknownFields, other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override int GetHashCode() {
+      int hash = 1;
+      hash ^= failure_.GetHashCode();
+      if (_unknownFields != null) {
+        hash ^= _unknownFields.GetHashCode();
+      }
+      return hash;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override string ToString() {
+      return pb::JsonFormatter.ToDiagnosticString(this);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void WriteTo(pb::CodedOutputStream output) {
+      failure_.WriteTo(output, _repeated_failure_codec);
+      if (_unknownFields != null) {
+        _unknownFields.WriteTo(output);
+      }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int CalculateSize() {
+      int size = 0;
+      size += failure_.CalculateSize(_repeated_failure_codec);
+      if (_unknownFields != null) {
+        size += _unknownFields.CalculateSize();
+      }
+      return size;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void MergeFrom(FailureSet other) {
+      if (other == null) {
+        return;
+      }
+      failure_.Add(other.failure_);
+      _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void MergeFrom(pb::CodedInputStream input) {
+      uint tag;
+      while ((tag = input.ReadTag()) != 0) {
+        switch(tag) {
+          default:
+            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+            break;
+          case 10: {
+            failure_.AddEntriesFrom(input, _repeated_failure_codec);
+            break;
+          }
+        }
+      }
+    }
+
+  }
+
   /// <summary>
   /// Represents a single test case's input.  The testee should:
   ///
@@ -94,7 +243,7 @@ namespace Conformance {
 
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     public static pbr::MessageDescriptor Descriptor {
-      get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[0]; }
+      get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[1]; }
     }
 
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -114,6 +263,8 @@ namespace Conformance {
       requestedOutputFormat_ = other.requestedOutputFormat_;
       messageType_ = other.messageType_;
       testCategory_ = other.testCategory_;
+      jspbEncodingOptions_ = other.jspbEncodingOptions_ != null ? other.jspbEncodingOptions_.Clone() : null;
+      printUnknownFields_ = other.printUnknownFields_;
       switch (other.PayloadCase) {
         case PayloadOneofCase.ProtobufPayload:
           ProtobufPayload = other.ProtobufPayload;
@@ -121,6 +272,12 @@ namespace Conformance {
         case PayloadOneofCase.JsonPayload:
           JsonPayload = other.JsonPayload;
           break;
+        case PayloadOneofCase.JspbPayload:
+          JspbPayload = other.JspbPayload;
+          break;
+        case PayloadOneofCase.TextPayload:
+          TextPayload = other.TextPayload;
+          break;
       }
 
       _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
@@ -153,9 +310,34 @@ namespace Conformance {
       }
     }
 
+    /// <summary>Field number for the "jspb_payload" field.</summary>
+    public const int JspbPayloadFieldNumber = 7;
+    /// <summary>
+    /// Google internal only.  Opensource testees just skip it.
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string JspbPayload {
+      get { return payloadCase_ == PayloadOneofCase.JspbPayload ? (string) payload_ : ""; }
+      set {
+        payload_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+        payloadCase_ = PayloadOneofCase.JspbPayload;
+      }
+    }
+
+    /// <summary>Field number for the "text_payload" field.</summary>
+    public const int TextPayloadFieldNumber = 8;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string TextPayload {
+      get { return payloadCase_ == PayloadOneofCase.TextPayload ? (string) payload_ : ""; }
+      set {
+        payload_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+        payloadCase_ = PayloadOneofCase.TextPayload;
+      }
+    }
+
     /// <summary>Field number for the "requested_output_format" field.</summary>
     public const int RequestedOutputFormatFieldNumber = 3;
-    private global::Conformance.WireFormat requestedOutputFormat_ = 0;
+    private global::Conformance.WireFormat requestedOutputFormat_ = global::Conformance.WireFormat.Unspecified;
     /// <summary>
     /// Which format should the testee serialize its message to?
     /// </summary>
@@ -185,7 +367,7 @@ namespace Conformance {
 
     /// <summary>Field number for the "test_category" field.</summary>
     public const int TestCategoryFieldNumber = 5;
-    private global::Conformance.TestCategory testCategory_ = 0;
+    private global::Conformance.TestCategory testCategory_ = global::Conformance.TestCategory.UnspecifiedTest;
     /// <summary>
     /// Each test is given a specific test category. Some category may need
     /// spedific support in testee programs. Refer to the defintion of TestCategory
@@ -199,12 +381,43 @@ namespace Conformance {
       }
     }
 
+    /// <summary>Field number for the "jspb_encoding_options" field.</summary>
+    public const int JspbEncodingOptionsFieldNumber = 6;
+    private global::Conformance.JspbEncodingConfig jspbEncodingOptions_;
+    /// <summary>
+    /// Specify details for how to encode jspb.
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public global::Conformance.JspbEncodingConfig JspbEncodingOptions {
+      get { return jspbEncodingOptions_; }
+      set {
+        jspbEncodingOptions_ = value;
+      }
+    }
+
+    /// <summary>Field number for the "print_unknown_fields" field.</summary>
+    public const int PrintUnknownFieldsFieldNumber = 9;
+    private bool printUnknownFields_;
+    /// <summary>
+    /// This can be used in json and text format. If true, testee should print
+    /// unknown fields instead of ignore. This feature is optional.
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool PrintUnknownFields {
+      get { return printUnknownFields_; }
+      set {
+        printUnknownFields_ = value;
+      }
+    }
+
     private object payload_;
     /// <summary>Enum of possible cases for the "payload" oneof.</summary>
     public enum PayloadOneofCase {
       None = 0,
       ProtobufPayload = 1,
       JsonPayload = 2,
+      JspbPayload = 7,
+      TextPayload = 8,
     }
     private PayloadOneofCase payloadCase_ = PayloadOneofCase.None;
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -233,9 +446,13 @@ namespace Conformance {
       }
       if (ProtobufPayload != other.ProtobufPayload) return false;
       if (JsonPayload != other.JsonPayload) return false;
+      if (JspbPayload != other.JspbPayload) return false;
+      if (TextPayload != other.TextPayload) return false;
       if (RequestedOutputFormat != other.RequestedOutputFormat) return false;
       if (MessageType != other.MessageType) return false;
       if (TestCategory != other.TestCategory) return false;
+      if (!object.Equals(JspbEncodingOptions, other.JspbEncodingOptions)) return false;
+      if (PrintUnknownFields != other.PrintUnknownFields) return false;
       if (PayloadCase != other.PayloadCase) return false;
       return Equals(_unknownFields, other._unknownFields);
     }
@@ -245,9 +462,13 @@ namespace Conformance {
       int hash = 1;
       if (payloadCase_ == PayloadOneofCase.ProtobufPayload) hash ^= ProtobufPayload.GetHashCode();
       if (payloadCase_ == PayloadOneofCase.JsonPayload) hash ^= JsonPayload.GetHashCode();
-      if (RequestedOutputFormat != 0) hash ^= RequestedOutputFormat.GetHashCode();
+      if (payloadCase_ == PayloadOneofCase.JspbPayload) hash ^= JspbPayload.GetHashCode();
+      if (payloadCase_ == PayloadOneofCase.TextPayload) hash ^= TextPayload.GetHashCode();
+      if (RequestedOutputFormat != global::Conformance.WireFormat.Unspecified) hash ^= RequestedOutputFormat.GetHashCode();
       if (MessageType.Length != 0) hash ^= MessageType.GetHashCode();
-      if (TestCategory != 0) hash ^= TestCategory.GetHashCode();
+      if (TestCategory != global::Conformance.TestCategory.UnspecifiedTest) hash ^= TestCategory.GetHashCode();
+      if (jspbEncodingOptions_ != null) hash ^= JspbEncodingOptions.GetHashCode();
+      if (PrintUnknownFields != false) hash ^= PrintUnknownFields.GetHashCode();
       hash ^= (int) payloadCase_;
       if (_unknownFields != null) {
         hash ^= _unknownFields.GetHashCode();
@@ -270,7 +491,7 @@ namespace Conformance {
         output.WriteRawTag(18);
         output.WriteString(JsonPayload);
       }
-      if (RequestedOutputFormat != 0) {
+      if (RequestedOutputFormat != global::Conformance.WireFormat.Unspecified) {
         output.WriteRawTag(24);
         output.WriteEnum((int) RequestedOutputFormat);
       }
@@ -278,10 +499,26 @@ namespace Conformance {
         output.WriteRawTag(34);
         output.WriteString(MessageType);
       }
-      if (TestCategory != 0) {
+      if (TestCategory != global::Conformance.TestCategory.UnspecifiedTest) {
         output.WriteRawTag(40);
         output.WriteEnum((int) TestCategory);
       }
+      if (jspbEncodingOptions_ != null) {
+        output.WriteRawTag(50);
+        output.WriteMessage(JspbEncodingOptions);
+      }
+      if (payloadCase_ == PayloadOneofCase.JspbPayload) {
+        output.WriteRawTag(58);
+        output.WriteString(JspbPayload);
+      }
+      if (payloadCase_ == PayloadOneofCase.TextPayload) {
+        output.WriteRawTag(66);
+        output.WriteString(TextPayload);
+      }
+      if (PrintUnknownFields != false) {
+        output.WriteRawTag(72);
+        output.WriteBool(PrintUnknownFields);
+      }
       if (_unknownFields != null) {
         _unknownFields.WriteTo(output);
       }
@@ -296,15 +533,27 @@ namespace Conformance {
       if (payloadCase_ == PayloadOneofCase.JsonPayload) {
         size += 1 + pb::CodedOutputStream.ComputeStringSize(JsonPayload);
       }
-      if (RequestedOutputFormat != 0) {
+      if (payloadCase_ == PayloadOneofCase.JspbPayload) {
+        size += 1 + pb::CodedOutputStream.ComputeStringSize(JspbPayload);
+      }
+      if (payloadCase_ == PayloadOneofCase.TextPayload) {
+        size += 1 + pb::CodedOutputStream.ComputeStringSize(TextPayload);
+      }
+      if (RequestedOutputFormat != global::Conformance.WireFormat.Unspecified) {
         size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) RequestedOutputFormat);
       }
       if (MessageType.Length != 0) {
         size += 1 + pb::CodedOutputStream.ComputeStringSize(MessageType);
       }
-      if (TestCategory != 0) {
+      if (TestCategory != global::Conformance.TestCategory.UnspecifiedTest) {
         size += 1 + pb::CodedOutputStream.ComputeEnumSize((int) TestCategory);
       }
+      if (jspbEncodingOptions_ != null) {
+        size += 1 + pb::CodedOutputStream.ComputeMessageSize(JspbEncodingOptions);
+      }
+      if (PrintUnknownFields != false) {
+        size += 1 + 1;
+      }
       if (_unknownFields != null) {
         size += _unknownFields.CalculateSize();
       }
@@ -316,15 +565,24 @@ namespace Conformance {
       if (other == null) {
         return;
       }
-      if (other.RequestedOutputFormat != 0) {
+      if (other.RequestedOutputFormat != global::Conformance.WireFormat.Unspecified) {
         RequestedOutputFormat = other.RequestedOutputFormat;
       }
       if (other.MessageType.Length != 0) {
         MessageType = other.MessageType;
       }
-      if (other.TestCategory != 0) {
+      if (other.TestCategory != global::Conformance.TestCategory.UnspecifiedTest) {
         TestCategory = other.TestCategory;
       }
+      if (other.jspbEncodingOptions_ != null) {
+        if (jspbEncodingOptions_ == null) {
+          JspbEncodingOptions = new global::Conformance.JspbEncodingConfig();
+        }
+        JspbEncodingOptions.MergeFrom(other.JspbEncodingOptions);
+      }
+      if (other.PrintUnknownFields != false) {
+        PrintUnknownFields = other.PrintUnknownFields;
+      }
       switch (other.PayloadCase) {
         case PayloadOneofCase.ProtobufPayload:
           ProtobufPayload = other.ProtobufPayload;
@@ -332,6 +590,12 @@ namespace Conformance {
         case PayloadOneofCase.JsonPayload:
           JsonPayload = other.JsonPayload;
           break;
+        case PayloadOneofCase.JspbPayload:
+          JspbPayload = other.JspbPayload;
+          break;
+        case PayloadOneofCase.TextPayload:
+          TextPayload = other.TextPayload;
+          break;
       }
 
       _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
@@ -365,6 +629,25 @@ namespace Conformance {
             TestCategory = (global::Conformance.TestCategory) input.ReadEnum();
             break;
           }
+          case 50: {
+            if (jspbEncodingOptions_ == null) {
+              JspbEncodingOptions = new global::Conformance.JspbEncodingConfig();
+            }
+            input.ReadMessage(JspbEncodingOptions);
+            break;
+          }
+          case 58: {
+            JspbPayload = input.ReadString();
+            break;
+          }
+          case 66: {
+            TextPayload = input.ReadString();
+            break;
+          }
+          case 72: {
+            PrintUnknownFields = input.ReadBool();
+            break;
+          }
         }
       }
     }
@@ -382,7 +665,7 @@ namespace Conformance {
 
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     public static pbr::MessageDescriptor Descriptor {
-      get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[1]; }
+      get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[2]; }
     }
 
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -418,6 +701,12 @@ namespace Conformance {
         case ResultOneofCase.Skipped:
           Skipped = other.Skipped;
           break;
+        case ResultOneofCase.JspbPayload:
+          JspbPayload = other.JspbPayload;
+          break;
+        case ResultOneofCase.TextPayload:
+          TextPayload = other.TextPayload;
+          break;
       }
 
       _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
@@ -523,6 +812,37 @@ namespace Conformance {
       }
     }
 
+    /// <summary>Field number for the "jspb_payload" field.</summary>
+    public const int JspbPayloadFieldNumber = 7;
+    /// <summary>
+    /// If the input was successfully parsed and the requested output was JSPB,
+    /// serialize to JSPB and set it in this field. JSPB is google internal only
+    /// format. Opensource testees can just skip it.
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string JspbPayload {
+      get { return resultCase_ == ResultOneofCase.JspbPayload ? (string) result_ : ""; }
+      set {
+        result_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+        resultCase_ = ResultOneofCase.JspbPayload;
+      }
+    }
+
+    /// <summary>Field number for the "text_payload" field.</summary>
+    public const int TextPayloadFieldNumber = 8;
+    /// <summary>
+    /// If the input was successfully parsed and the requested output was
+    /// TEXT_FORMAT, serialize to TEXT_FORMAT and set it in this field.
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public string TextPayload {
+      get { return resultCase_ == ResultOneofCase.TextPayload ? (string) result_ : ""; }
+      set {
+        result_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+        resultCase_ = ResultOneofCase.TextPayload;
+      }
+    }
+
     private object result_;
     /// <summary>Enum of possible cases for the "result" oneof.</summary>
     public enum ResultOneofCase {
@@ -533,6 +853,8 @@ namespace Conformance {
       ProtobufPayload = 3,
       JsonPayload = 4,
       Skipped = 5,
+      JspbPayload = 7,
+      TextPayload = 8,
     }
     private ResultOneofCase resultCase_ = ResultOneofCase.None;
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
@@ -565,6 +887,8 @@ namespace Conformance {
       if (ProtobufPayload != other.ProtobufPayload) return false;
       if (JsonPayload != other.JsonPayload) return false;
       if (Skipped != other.Skipped) return false;
+      if (JspbPayload != other.JspbPayload) return false;
+      if (TextPayload != other.TextPayload) return false;
       if (ResultCase != other.ResultCase) return false;
       return Equals(_unknownFields, other._unknownFields);
     }
@@ -578,6 +902,8 @@ namespace Conformance {
       if (resultCase_ == ResultOneofCase.ProtobufPayload) hash ^= ProtobufPayload.GetHashCode();
       if (resultCase_ == ResultOneofCase.JsonPayload) hash ^= JsonPayload.GetHashCode();
       if (resultCase_ == ResultOneofCase.Skipped) hash ^= Skipped.GetHashCode();
+      if (resultCase_ == ResultOneofCase.JspbPayload) hash ^= JspbPayload.GetHashCode();
+      if (resultCase_ == ResultOneofCase.TextPayload) hash ^= TextPayload.GetHashCode();
       hash ^= (int) resultCase_;
       if (_unknownFields != null) {
         hash ^= _unknownFields.GetHashCode();
@@ -616,6 +942,14 @@ namespace Conformance {
         output.WriteRawTag(50);
         output.WriteString(SerializeError);
       }
+      if (resultCase_ == ResultOneofCase.JspbPayload) {
+        output.WriteRawTag(58);
+        output.WriteString(JspbPayload);
+      }
+      if (resultCase_ == ResultOneofCase.TextPayload) {
+        output.WriteRawTag(66);
+        output.WriteString(TextPayload);
+      }
       if (_unknownFields != null) {
         _unknownFields.WriteTo(output);
       }
@@ -642,6 +976,12 @@ namespace Conformance {
       if (resultCase_ == ResultOneofCase.Skipped) {
         size += 1 + pb::CodedOutputStream.ComputeStringSize(Skipped);
       }
+      if (resultCase_ == ResultOneofCase.JspbPayload) {
+        size += 1 + pb::CodedOutputStream.ComputeStringSize(JspbPayload);
+      }
+      if (resultCase_ == ResultOneofCase.TextPayload) {
+        size += 1 + pb::CodedOutputStream.ComputeStringSize(TextPayload);
+      }
       if (_unknownFields != null) {
         size += _unknownFields.CalculateSize();
       }
@@ -672,6 +1012,12 @@ namespace Conformance {
         case ResultOneofCase.Skipped:
           Skipped = other.Skipped;
           break;
+        case ResultOneofCase.JspbPayload:
+          JspbPayload = other.JspbPayload;
+          break;
+        case ResultOneofCase.TextPayload:
+          TextPayload = other.TextPayload;
+          break;
       }
 
       _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
@@ -709,6 +1055,149 @@ namespace Conformance {
             SerializeError = input.ReadString();
             break;
           }
+          case 58: {
+            JspbPayload = input.ReadString();
+            break;
+          }
+          case 66: {
+            TextPayload = input.ReadString();
+            break;
+          }
+        }
+      }
+    }
+
+  }
+
+  /// <summary>
+  /// Encoding options for jspb format.
+  /// </summary>
+  public sealed partial class JspbEncodingConfig : pb::IMessage<JspbEncodingConfig> {
+    private static readonly pb::MessageParser<JspbEncodingConfig> _parser = new pb::MessageParser<JspbEncodingConfig>(() => new JspbEncodingConfig());
+    private pb::UnknownFieldSet _unknownFields;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public static pb::MessageParser<JspbEncodingConfig> Parser { get { return _parser; } }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public static pbr::MessageDescriptor Descriptor {
+      get { return global::Conformance.ConformanceReflection.Descriptor.MessageTypes[3]; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    pbr::MessageDescriptor pb::IMessage.Descriptor {
+      get { return Descriptor; }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public JspbEncodingConfig() {
+      OnConstruction();
+    }
+
+    partial void OnConstruction();
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public JspbEncodingConfig(JspbEncodingConfig other) : this() {
+      useJspbArrayAnyFormat_ = other.useJspbArrayAnyFormat_;
+      _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public JspbEncodingConfig Clone() {
+      return new JspbEncodingConfig(this);
+    }
+
+    /// <summary>Field number for the "use_jspb_array_any_format" field.</summary>
+    public const int UseJspbArrayAnyFormatFieldNumber = 1;
+    private bool useJspbArrayAnyFormat_;
+    /// <summary>
+    /// Encode the value field of Any as jspb array if ture, otherwise binary.
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool UseJspbArrayAnyFormat {
+      get { return useJspbArrayAnyFormat_; }
+      set {
+        useJspbArrayAnyFormat_ = value;
+      }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override bool Equals(object other) {
+      return Equals(other as JspbEncodingConfig);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public bool Equals(JspbEncodingConfig other) {
+      if (ReferenceEquals(other, null)) {
+        return false;
+      }
+      if (ReferenceEquals(other, this)) {
+        return true;
+      }
+      if (UseJspbArrayAnyFormat != other.UseJspbArrayAnyFormat) return false;
+      return Equals(_unknownFields, other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override int GetHashCode() {
+      int hash = 1;
+      if (UseJspbArrayAnyFormat != false) hash ^= UseJspbArrayAnyFormat.GetHashCode();
+      if (_unknownFields != null) {
+        hash ^= _unknownFields.GetHashCode();
+      }
+      return hash;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public override string ToString() {
+      return pb::JsonFormatter.ToDiagnosticString(this);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void WriteTo(pb::CodedOutputStream output) {
+      if (UseJspbArrayAnyFormat != false) {
+        output.WriteRawTag(8);
+        output.WriteBool(UseJspbArrayAnyFormat);
+      }
+      if (_unknownFields != null) {
+        _unknownFields.WriteTo(output);
+      }
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public int CalculateSize() {
+      int size = 0;
+      if (UseJspbArrayAnyFormat != false) {
+        size += 1 + 1;
+      }
+      if (_unknownFields != null) {
+        size += _unknownFields.CalculateSize();
+      }
+      return size;
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void MergeFrom(JspbEncodingConfig other) {
+      if (other == null) {
+        return;
+      }
+      if (other.UseJspbArrayAnyFormat != false) {
+        UseJspbArrayAnyFormat = other.UseJspbArrayAnyFormat;
+      }
+      _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields);
+    }
+
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    public void MergeFrom(pb::CodedInputStream input) {
+      uint tag;
+      while ((tag = input.ReadTag()) != 0) {
+        switch(tag) {
+          default:
+            _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input);
+            break;
+          case 8: {
+            UseJspbArrayAnyFormat = input.ReadBool();
+            break;
+          }
         }
       }
     }

+ 1 - 1
csharp/src/Google.Protobuf.Conformance/Google.Protobuf.Conformance.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp1.0</TargetFramework>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
     <OutputType>Exe</OutputType>
     <IsPackable>False</IsPackable>
   </PropertyGroup>

+ 8 - 4
csharp/src/Google.Protobuf.Conformance/Program.cs

@@ -93,22 +93,26 @@ namespace Google.Protobuf.Conformance
                         var parser = new JsonParser(new JsonParser.Settings(20, typeRegistry));
                         message = parser.Parse<ProtobufTestMessages.Proto3.TestAllTypesProto3>(request.JsonPayload);
                         break;
-                    case ConformanceRequest.PayloadOneofCase.ProtobufPayload: 
+                    case ConformanceRequest.PayloadOneofCase.ProtobufPayload:
                     {
                         if (request.MessageType.Equals("protobuf_test_messages.proto3.TestAllTypesProto3"))
                         {
                             message = ProtobufTestMessages.Proto3.TestAllTypesProto3.Parser.ParseFrom(request.ProtobufPayload);
-                        }							
-                        else if (request.MessageType.Equals("protobuf_test_messages.proto2.TestAllTypesProto2")) 
+                        }
+                        else if (request.MessageType.Equals("protobuf_test_messages.proto2.TestAllTypesProto2"))
                         {
                             return new ConformanceResponse { Skipped = "CSharp doesn't support proto2" };
                         }
-                        else 
+                        else
                         {
                             throw new Exception(" Protobuf request doesn't have specific payload type");
                         }
                         break;
                     }
+					case ConformanceRequest.PayloadOneofCase.TextPayload:
+					{
+						return new ConformanceResponse { Skipped = "CSharp doesn't support text format" };
+					}
                     default:
                         throw new Exception("Unsupported request payload: " + request.PayloadCase);
                 }

+ 1 - 1
csharp/src/Google.Protobuf.JsonDump/Google.Protobuf.JsonDump.csproj

@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
 
   <PropertyGroup>
-    <TargetFramework>netcoreapp1.0</TargetFramework>
+    <TargetFramework>netcoreapp2.1</TargetFramework>
     <OutputType>Exe</OutputType>
     <IsPackable>False</IsPackable>
   </PropertyGroup>

+ 41 - 5
csharp/src/Google.Protobuf.Test/CodedInputStreamTest.cs

@@ -327,14 +327,14 @@ namespace Google.Protobuf
         [Test]
         public void MaliciousRecursion()
         {
-            ByteString data64 = MakeRecursiveMessage(64).ToByteString();
-            ByteString data65 = MakeRecursiveMessage(65).ToByteString();
+            ByteString atRecursiveLimit = MakeRecursiveMessage(CodedInputStream.DefaultRecursionLimit).ToByteString();
+            ByteString beyondRecursiveLimit = MakeRecursiveMessage(CodedInputStream.DefaultRecursionLimit + 1).ToByteString();
 
-            AssertMessageDepth(TestRecursiveMessage.Parser.ParseFrom(data64), 64);
+            AssertMessageDepth(TestRecursiveMessage.Parser.ParseFrom(atRecursiveLimit), CodedInputStream.DefaultRecursionLimit);
 
-            Assert.Throws<InvalidProtocolBufferException>(() => TestRecursiveMessage.Parser.ParseFrom(data65));
+            Assert.Throws<InvalidProtocolBufferException>(() => TestRecursiveMessage.Parser.ParseFrom(beyondRecursiveLimit));
 
-            CodedInputStream input = CodedInputStream.CreateWithLimits(new MemoryStream(data64.ToByteArray()), 1000000, 63);
+            CodedInputStream input = CodedInputStream.CreateWithLimits(new MemoryStream(atRecursiveLimit.ToByteArray()), 1000000, CodedInputStream.DefaultRecursionLimit - 1);
             Assert.Throws<InvalidProtocolBufferException>(() => TestRecursiveMessage.Parser.ParseFrom(input));
         }
 
@@ -373,6 +373,42 @@ namespace Google.Protobuf
             Assert.AreEqual('\ufffd', text[0]);
         }
 
+        [Test]
+        public void ReadNegativeSizedStringThrowsInvalidProtocolBufferException()
+        {
+            MemoryStream ms = new MemoryStream();
+            CodedOutputStream output = new CodedOutputStream(ms);
+
+            uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited);
+            output.WriteRawVarint32(tag);
+            output.WriteLength(-1);
+            output.Flush();
+            ms.Position = 0;
+
+            CodedInputStream input = new CodedInputStream(ms);
+
+            Assert.AreEqual(tag, input.ReadTag());
+            Assert.Throws<InvalidProtocolBufferException>(() => input.ReadString());
+        }
+
+        [Test]
+        public void ReadNegativeSizedBytesThrowsInvalidProtocolBufferException()
+        {
+            MemoryStream ms = new MemoryStream();
+            CodedOutputStream output = new CodedOutputStream(ms);
+
+            uint tag = WireFormat.MakeTag(1, WireFormat.WireType.LengthDelimited);
+            output.WriteRawVarint32(tag);
+            output.WriteLength(-1);
+            output.Flush();
+            ms.Position = 0;
+
+            CodedInputStream input = new CodedInputStream(ms);
+
+            Assert.AreEqual(tag, input.ReadTag());
+            Assert.Throws<InvalidProtocolBufferException>(() => input.ReadBytes());
+        }
+
         /// <summary>
         /// A stream which limits the number of bytes it reads at a time.
         /// We use this to make sure that CodedInputStream doesn't screw up when

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません