Merge version v3.19.4

Change-Id: I6ce3ee30ce179adf010a755a654d86c84a77b42d
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 8386086..c5d4e28 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -9,8 +9,10 @@
 
 <!--
 
-NOTE: this form is for bug reports only. For questions or troubleshooting, please see the protobuf mailing list: https://groups.google.com/forum/#!forum/protobuf
-
+NOTE: this form is for bug reports only.
+For questions or troubleshooting, please post on the protobuf mailing list:
+https://groups.google.com/forum/#!forum/protobuf 
+Stack Overflow is also a useful if unofficial resource https://stackoverflow.com/questions/tagged/protocol-buffers
 -->
 
 **What version of protobuf and what language are you using?**
diff --git a/.gitignore b/.gitignore
index 4e52414..b9d795c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -202,8 +202,8 @@
 cmake/cmake-build-debug/
 
 # Common build subdirectories.
-./.build/
-./_build/
+.build/
+_build/
 
 # Visual Studio 2017
 .vs
diff --git a/BUILD b/BUILD
index 7de87f8..1690d42 100644
--- a/BUILD
+++ b/BUILD
@@ -26,7 +26,6 @@
 ################################################################################
 
 MSVC_COPTS = [
-    "/DHAVE_PTHREAD",
     "/wd4018",  # -Wno-sign-compare
     "/wd4065",  # switch statement contains 'default' but no 'case' labels
     "/wd4146",  # unary minus operator applied to unsigned type, result still unsigned
@@ -46,7 +45,6 @@
 COPTS = select({
     ":msvc": MSVC_COPTS,
     "//conditions:default": [
-        "-DHAVE_PTHREAD",
         "-DHAVE_ZLIB",
         "-Wmissing-field-initializers",
         "-Woverloaded-virtual",
@@ -65,6 +63,13 @@
     ],
 )
 
+# Android NDK builds can specify different crosstool_top flags to choose which
+# STL they use for C++. We need these multiple variants to catch all of those
+# versions of crosstool_top and reliably detect Android.
+#
+# For more info on the various crosstool_tops used by NDK Bazel builds, see:
+# https://docs.bazel.build/versions/master/android-ndk.html#configuring-the-stl
+
 config_setting(
     name = "android",
     values = {
@@ -77,6 +82,17 @@
 )
 
 config_setting(
+    name = "android-stlport",
+    values = {
+        "crosstool_top": "@androidndk//:toolchain-stlport",
+    },
+    visibility = [
+        # Public, but Protobuf only visibility.
+        "//:__subpackages__",
+    ],
+)
+
+config_setting(
     name = "android-libcpp",
     values = {
         "crosstool_top": "@androidndk//:toolchain-libcpp",
@@ -98,11 +114,24 @@
     ],
 )
 
+config_setting(
+    name = "android-default",
+    values = {
+        "crosstool_top": "@androidndk//:default_crosstool",
+    },
+    visibility = [
+        # Public, but Protobuf only visibility.
+        "//:__subpackages__",
+    ],
+)
+
 # Android and MSVC builds do not need to link in a separate pthread library.
 LINK_OPTS = select({
     ":android": [],
+    ":android-stlport": [],
     ":android-libcpp": [],
     ":android-gnu-libstdcpp": [],
+    ":android-default": [],
     ":msvc": [
         # Suppress linker warnings about files with no symbols defined.
         "-ignore:4221",
@@ -133,6 +162,7 @@
         "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_tctable_lite.cc",
         "src/google/protobuf/generated_message_util.cc",
         "src/google/protobuf/implicit_weak_message.cc",
         "src/google/protobuf/inlined_string_field.cc",
@@ -146,6 +176,7 @@
         "src/google/protobuf/message_lite.cc",
         "src/google/protobuf/parse_context.cc",
         "src/google/protobuf/repeated_field.cc",
+        "src/google/protobuf/repeated_ptr_field.cc",
         "src/google/protobuf/stubs/bytestream.cc",
         "src/google/protobuf/stubs/common.cc",
         "src/google/protobuf/stubs/int128.cc",
@@ -193,6 +224,7 @@
         "src/google/protobuf/generated_message_bases.cc",
         "src/google/protobuf/generated_message_reflection.cc",
         "src/google/protobuf/generated_message_table_driven.cc",
+        "src/google/protobuf/generated_message_tctable_full.cc",
         "src/google/protobuf/io/gzip_stream.cc",
         "src/google/protobuf/io/printer.cc",
         "src/google/protobuf/io/tokenizer.cc",
@@ -222,7 +254,6 @@
         "src/google/protobuf/util/internal/protostream_objectsource.cc",
         "src/google/protobuf/util/internal/protostream_objectwriter.cc",
         "src/google/protobuf/util/internal/type_info.cc",
-        "src/google/protobuf/util/internal/type_info_test_helper.cc",
         "src/google/protobuf/util/internal/utility.cc",
         "src/google/protobuf/util/json_util.cc",
         "src/google/protobuf/util/message_differencer.cc",
@@ -621,6 +652,8 @@
 COMMON_TEST_SRCS = [
     # AUTOGEN(common_test_srcs)
     "src/google/protobuf/arena_test_util.cc",
+    "src/google/protobuf/map_lite_test_util.cc",
+    "src/google/protobuf/test_util_lite.cc",
     "src/google/protobuf/map_test_util.inc",
     "src/google/protobuf/reflection_tester.cc",
     "src/google/protobuf/test_util.cc",
@@ -950,7 +983,6 @@
     protoc = ":protoc",
     py_libs = [
         ":python_srcs",
-        "@six//:six",
     ],
     srcs_version = "PY2AND3",
     visibility = ["//visibility:public"],
@@ -1203,22 +1235,24 @@
     ],
 )
 
-sh_test(
-    name = "build_files_updated_unittest",
-    srcs = [
-        "build_files_updated_unittest.sh",
-    ],
-    data = [
-        "BUILD",
-        "cmake/extract_includes.bat.in",
-        "cmake/libprotobuf.cmake",
-        "cmake/libprotobuf-lite.cmake",
-        "cmake/libprotoc.cmake",
-        "cmake/tests.cmake",
-        "src/Makefile.am",
-        "update_file_lists.sh",
-    ],
-)
+# TODO: re-enable this test if appropriate, or replace with something that
+# uses the new setup.
+# sh_test(
+#     name = "build_files_updated_unittest",
+#     srcs = [
+#         "build_files_updated_unittest.sh",
+#     ],
+#     data = [
+#         "BUILD",
+#         "cmake/extract_includes.bat.in",
+#         "cmake/libprotobuf.cmake",
+#         "cmake/libprotobuf-lite.cmake",
+#         "cmake/libprotoc.cmake",
+#         "cmake/tests.cmake",
+#         "src/Makefile.am",
+#         "update_file_lists.sh",
+#     ],
+# )
 
 java_proto_library(
     name = "test_messages_proto2_java_proto",
diff --git a/CHANGES.txt b/CHANGES.txt
index 69207d6..b3c4361 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,3 +1,84 @@
+2022-01-28 version 3.19.4 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+  Python
+  * Make libprotobuf symbols local on OSX to fix issue #9395 (#9435)
+
+  Ruby
+  * Fixed a data loss bug that could occur when the number of `optional`
+    fields in a message is an exact multiple of 32. (#9440).
+
+  PHP
+  * Fixed a data loss bug that could occur when the number of `optional`
+    fields in a message is an exact multiple of 32. (#9440).
+    
+2022-01-10 version 3.19.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+  Python
+  * Fix missing Windows wheel for Python 3.10 on PyPI
+
+2022-01-05 version 3.19.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+  Java
+  * Improve performance characteristics of UnknownFieldSet parsing (#9371)
+
+2021-10-28 version 3.19.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+  Bazel
+  * Ensure that release archives contain everything needed for Bazel (#9131)
+  * Align dependency handling with Bazel best practices (#9165)
+
+  JavaScript
+  * Fix `ReferenceError: window is not defined` when getting the global object (#9156)
+
+  Ruby
+  * Fix memory leak in MessageClass.encode (#9150)
+
+2021-10-15 version 3.19.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+
+  C++
+  * Make proto2::Message::DiscardUnknownFields() non-virtual
+  * Separate RepeatedPtrField into its own header file
+  * For default floating point values of 0, consider all bits significant
+  * cmake: support `MSVC_RUNTIME_LIBRARY` property (#8851)
+  * Fix shadowing warnings (#8926)
+  * Fix for issue #8484, constant initialization doesn't compile in msvc clang-cl environment (#8993)
+  * Fix build on AIX and SunOS (#8373) (#9065)
+  * Add Android stlport and default toolchains to BUILD. (#8290)
+
+  Java
+  * For default floating point values of 0, consider all bits significant
+  * Annotate `//java/com/google/protobuf/util/...` with nullness annotations
+  * Use ArrayList copy constructor (#7853)
+
+  Kotlin
+  * Switch Kotlin proto DSLs to be implemented with inline value classes
+  * Fix inlining and deprecation for repeated string fields in kotlin (#9120)
+
+  Python
+  * Proto2 DecodeError now includes message name in error message
+  * Make MessageToDict convert map keys to strings (#8122)
+  * Add python-requires in setup.py (#8989)
+  * Add python 3.10 (#9034)
+
+  JavaScript
+  * Skip exports if not available by CommonJS (#8856)
+  * JS: Comply with CSP no-unsafe-eval. (#8864)
+
+  PHP
+  * Added "object" as a reserved name for PHP (#8962)
+
+  Ruby
+  * Override Map.clone to use Map's dup method (#7938)
+  * Ruby: build extensions for arm64-darwin (#8232)
+  * Add class method Timestamp.from_time to ruby well known types (#8562)
+  * Adopt pure ruby DSL implementation for JRuby (#9047)
+  * Add size to Map class (#8068)
+  * Fix for descriptor_pb.rb: google/protobuf should be required first (#9121)
+
+  C#
+  * Correctly set ExtensionRegistry when parsing with MessageParser, but using an already existing CodedInputStream (#7246)
+  * [C#] Make FieldDescriptor propertyName public (#7642)
+
 2021-10-04 version 3.18.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
 
   Python
@@ -9,6 +90,46 @@
 
 2021-09-13 version 3.18.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
 
+  Python
+  * Removed Python 2.x support.
+  * Pure python descriptor_pool.AddSerializedFile() will always build the
+    file and return FileDescriptor which is same with python c++ extension
+  * type errors thrown by MergeFrom now report fully qualified class names
+  * Protobuf python generated code are simplified. Some platforms that uses
+    "is"("is not") to compare the enum or descriptor's label/type may fail,
+    should use "=="("!=") instead.
+
+  C++
+  * Generated code now uses the c++11 standard integer types int{32,64}_t and
+    uint{32,64}_t
+  * Reduce memory usage of the DescriptorPool type.
+  * Moved the zero-argument New() method on messages to the base class (internal
+    optimization).
+  * Unused return values marked with `PROTOBUF_MUST_USE_RESULT` are now
+    correctly attributed.
+  * Demotes PrintPath log for maps in MessageDifferencer down from WARNING to
+    INFO.
+  * Make sure FullMessageName() is always private.
+  * Fix race condition in EnumDescriptor.
+  * Remove MessageLite::GetMaybeArenaPointer.
+
+  Java
+  * Add @deprecated javadoc for set/get/has methods
+  * correctly decode \? escape sequence in text protos
+  * Avoid depending on Objects.requireNonNull() until we can verify that no
+    users are depending on older Android versions.
+  * disallow null string map values in put and putAll
+  * Add `@CheckReturnValue` to `ByteString` API.
+  * Make the `hasPresence` method public in `FieldDescriptor`.
+  * Report more detailed messages in Duration and Timestamp proto parsing
+    errors.
+  * New Timestamps.fromDate utility method that converts a java.util.Date to a
+    Timestamp proto object.
+
+  Kotlin
+  * Generated Kotlin code is Explicit API mode compatible
+
+2021-09-13 version 3.18.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
   C++
   * Fix warnings raised by clang 11 (#8664)
   * Make StringPiece constructible from std::string_view (#8707)
@@ -40,6 +161,7 @@
   * Fix repeated enum extension size in field listener
   * Enable Any Text Expansion for Descriptors::DebugString()
   * Switch from int{8,16,32,64} to int{8,16,32,64}_t
+  * Reduce memory usage of the DescriptorPool type.
 
   Java
   * Fix errorprone conflict (#8723)
@@ -72,7 +194,14 @@
   * field_presence.md: fix Go example (#8788)
 
 
+  Kotlin
+  * Suppress NOTHING_TO_INLINE in Kotlin generated inline functions.
+
 2021-06-04 version 3.17.3 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+  Python
+  * Note: This is the last release to support Python 2.7. Future releases will
+    require Python >= 3.5.
+
   C++
   * Introduce FieldAccessListener.
   * Stop emitting boilerplate {Copy/Merge}From in each ProtoBuf class
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index db1ff31..8ef5dd2 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1,9 +1,31 @@
 # Contributing to Protocol Buffers
 
-We welcome your contributions to protocol buffers. This doc describes the
+We welcome some types of contributions to protocol buffers. This doc describes the
 process to contribute patches to protobuf and the general guidelines we
 expect contributors to follow.
 
+## What We Accept
+
+* Bug fixes with unit tests demonstrating the problem are very welcome.
+  We also appreciate bug reports, even when they don't come with a patch.
+  Bug fixes without tests are usually not accepted.
+* New APIs and features with adequate test coverage and documentation
+  may be accepted if they do not compromise backwards 
+  compatibility. However there's a fairly high bar of usefulness a new public
+  method must clear before it will be accepted. Features that are fine in 
+  isolation are often rejected because they don't have enough impact to justify the 
+  conceptual burden and ongoing maintenance cost. It's best to file an issue 
+  and get agreement from maintainers on the value of a new feature before
+  working on a PR.
+* Performance optimizations may be accepted if they have convincing benchmarks that demonstrate 
+  an improvement and they do not significantly increase complexity.  
+* Changes to existing APIs are almost never accepted. Stability and
+  backwards compatibility are paramount. In the unlikely event a breaking change 
+  is required, it must usually be implemented in google3 first. 
+* Changes to the wire and text formats are never accepted. Any breaking change
+  to these formats would have to be implemented as a completely new format.
+  We cannot begin generating protos that cannot be parsed by existing code.
+
 ## Before You Start
 
 We accept patches in the form of github pull requests. If you are new to
@@ -58,7 +80,7 @@
 * Create small PRs that are narrowly focused on addressing a single concern.
   We often receive PRs that are trying to fix several things at a time, but if
   only one fix is considered acceptable, nothing gets merged and both author's
-  & review's time is wasted. Create more PRs to address different concerns and
+  & reviewer's time is wasted. Create more PRs to address different concerns and
   everyone will be happy.
 * For speculative changes, consider opening an issue and discussing it first.
   If you are suggesting a behavioral or API change, make sure you get explicit
diff --git a/Makefile.am b/Makefile.am
index cd209f3..41d4061 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -297,6 +297,8 @@
   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/CanIgnoreReturnValue.java            \
+  java/core/src/main/java/com/google/protobuf/CheckReturnValue.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               \
@@ -491,6 +493,7 @@
   java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java                \
   java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java            \
   java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java             \
+  java/core/src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.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                       \
@@ -1040,6 +1043,7 @@
   python/google/protobuf/internal/packed_field_test.proto                    \
   python/google/protobuf/internal/proto_builder_test.py                      \
   python/google/protobuf/internal/python_message.py                          \
+  python/google/protobuf/internal/python_protobuf.cc                         \
   python/google/protobuf/internal/reflection_test.py                         \
   python/google/protobuf/internal/service_reflection_test.py                 \
   python/google/protobuf/internal/symbol_database_test.py                    \
@@ -1094,6 +1098,7 @@
   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/python_protobuf.h                                   \
   python/google/protobuf/reflection.py                                       \
   python/google/protobuf/service.py                                          \
   python/google/protobuf/service_reflection.py                               \
@@ -1146,19 +1151,14 @@
   ruby/lib/google/protobuf/well_known_types.rb                               \
   ruby/lib/google/protobuf.rb                                                \
   ruby/pom.xml                                                               \
-  ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java              \
   ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptor.java           \
   ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java       \
   ruby/src/main/java/com/google/protobuf/jruby/RubyEnum.java                 \
-  ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java   \
   ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java       \
   ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java      \
-  ruby/src/main/java/com/google/protobuf/jruby/RubyFileBuilderContext.java   \
   ruby/src/main/java/com/google/protobuf/jruby/RubyFileDescriptor.java       \
   ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java                  \
   ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java              \
-  ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java \
-  ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java  \
   ruby/src/main/java/com/google/protobuf/jruby/RubyOneofDescriptor.java      \
   ruby/src/main/java/com/google/protobuf/jruby/RubyProtobuf.java             \
   ruby/src/main/java/com/google/protobuf/jruby/RubyRepeatedField.java        \
@@ -1425,9 +1425,10 @@
   examples/list_people.py                \
   examples/list_people_test.go           \
   examples/pubspec.yaml                  \
+  maven_install.json                     \
   protobuf.bzl                           \
   protobuf_deps.bzl                      \
-  third_party/six.BUILD                  \
+  protobuf_version.bzl                   \
   third_party/zlib.BUILD                 \
   util/python/BUILD                      \
   internal.bzl
diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec
index f285e58..1c557a0 100644
--- a/Protobuf-C++.podspec
+++ b/Protobuf-C++.podspec
@@ -1,6 +1,6 @@
 Pod::Spec.new do |s|
   s.name     = 'Protobuf-C++'
-  s.version  = '3.18.1'
+  s.version  = '3.19.4'
   s.summary  = 'Protocol Buffers v3 runtime library for C++.'
   s.homepage = 'https://github.com/google/protobuf'
   s.license  = '3-Clause BSD License'
@@ -35,9 +35,6 @@
     # Do not let src/google/protobuf/stubs/time.h override system API
     'USE_HEADERMAP' => 'NO',
     'ALWAYS_SEARCH_USER_PATHS' => 'NO',
-
-    # Configure tool is not being used for Xcode. When building, assume pthread is supported.
-    'GCC_PREPROCESSOR_DEFINITIONS' => '"$(inherited)" "HAVE_PTHREAD=1"',
   }
 
 end
diff --git a/Protobuf.podspec b/Protobuf.podspec
index 4a5f7dd..c70b2ef 100644
--- a/Protobuf.podspec
+++ b/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.18.1'
+  s.version  = '3.19.4'
   s.summary  = 'Protocol Buffers v.3 runtime library for Objective-C.'
   s.homepage = 'https://github.com/protocolbuffers/protobuf'
   s.license  = '3-Clause BSD License'
diff --git a/WORKSPACE b/WORKSPACE
index 94aa8d8..e500967 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -27,7 +27,7 @@
 )
 
 # Load common dependencies.
-load("//:protobuf_deps.bzl", "protobuf_deps")
+load("//:protobuf_deps.bzl", "PROTOBUF_MAVEN_ARTIFACTS", "protobuf_deps")
 protobuf_deps()
 
 bind(
@@ -36,63 +36,23 @@
 )
 
 load("@rules_jvm_external//:defs.bzl", "maven_install")
+
 maven_install(
-    artifacts = [
-        "com.google.code.gson:gson:2.8.6",
-        "com.google.errorprone:error_prone_annotations:2.3.2",
-        "com.google.guava:guava:30.1.1-jre",
-        "com.google.truth:truth:1.1.2",
-        "junit:junit:4.12",
-        "org.easymock:easymock:3.2",
-        "org.easymock:easymockclassextension:3.2",
-    ],
+    artifacts = PROTOBUF_MAVEN_ARTIFACTS,
+    # For updating instructions, see:
+    # https://github.com/bazelbuild/rules_jvm_external#updating-maven_installjson
+    maven_install_json = "//:maven_install.json",
     repositories = [
         "https://repo1.maven.org/maven2",
         "https://repo.maven.apache.org/maven2",
     ],
-    # For updating instructions, see: 
-    # https://github.com/bazelbuild/rules_jvm_external#updating-maven_installjson
-    maven_install_json = "//:maven_install.json",
 )
 
 load("@maven//:defs.bzl", "pinned_maven_install")
+
 pinned_maven_install()
 
-bind(
-    name = "guava",
-    actual = "@maven//:com_google_guava_guava",
-)
-
-bind(
-    name = "gson",
-    actual = "@maven//:com_google_code_gson_gson",
-)
-
-bind(
-    name = "error_prone_annotations",
-    actual = "@maven//:com_google_errorprone_error_prone_annotations",
-)
-
-bind(
-    name = "junit",
-    actual = "@maven//:junit_junit",
-)
-
-bind(
-    name = "easymock",
-    actual = "@maven//:org_easymock_easymock",
-)
-
-bind(
-    name = "easymock_classextension",
-    actual = "@maven//:org_easymock_easymockclassextension",
-)
-
-bind(
-    name = "truth",
-    actual = "@maven//:com_google_truth_truth",
-)
-
 # For `cc_proto_blacklist_test` and `build_test`.
 load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
+
 bazel_skylib_workspace()
diff --git a/benchmarks/Makefile.am b/benchmarks/Makefile.am
index 2b2204d..3ab35e3 100644
--- a/benchmarks/Makefile.am
+++ b/benchmarks/Makefile.am
@@ -165,7 +165,7 @@
 		done                                                           \
 	done
 
-python_cpp_pkg_flags = `pkg-config --cflags --libs python`
+python_cpp_pkg_flags = `pkg-config --cflags --libs python3`
 
 lib_LTLIBRARIES = libbenchmark_messages.la
 libbenchmark_messages_la_SOURCES = python/python_benchmark_messages.cc
@@ -186,7 +186,7 @@
 	@echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-pure-python-benchmark
 	@echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'python\' >> python-pure-python-benchmark
 	@echo cp $(srcdir)/python/py_benchmark.py tmp >> python-pure-python-benchmark
-	@echo python tmp/py_benchmark.py '$$@' >> python-pure-python-benchmark
+	@echo python3 tmp/py_benchmark.py '$$@' >> python-pure-python-benchmark
 	@chmod +x python-pure-python-benchmark
 
 python-cpp-reflection-benchmark: python_add_init
@@ -196,7 +196,7 @@
 	@echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-cpp-reflection-benchmark
 	@echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'cpp\' >> python-cpp-reflection-benchmark
 	@echo cp $(srcdir)/python/py_benchmark.py tmp >> python-cpp-reflection-benchmark
-	@echo python tmp/py_benchmark.py '$$@' >> python-cpp-reflection-benchmark
+	@echo python3 tmp/py_benchmark.py '$$@' >> python-cpp-reflection-benchmark
 	@chmod +x python-cpp-reflection-benchmark
 
 python-cpp-generated-code-benchmark: python_add_init libbenchmark_messages.la
@@ -206,7 +206,7 @@
 	@echo export DYLD_LIBRARY_PATH=$(top_srcdir)/src/.libs >> python-cpp-generated-code-benchmark
 	@echo export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=\'cpp\' >> python-cpp-generated-code-benchmark
 	@echo cp $(srcdir)/python/py_benchmark.py tmp >> python-cpp-generated-code-benchmark
-	@echo python tmp/py_benchmark.py --cpp_generated '$$@' >> python-cpp-generated-code-benchmark
+	@echo python3 tmp/py_benchmark.py --cpp_generated '$$@' >> python-cpp-generated-code-benchmark
 	@chmod +x python-cpp-generated-code-benchmark
 
 python-pure-python: python-pure-python-benchmark
diff --git a/benchmarks/python/python_benchmark_messages.cc b/benchmarks/python/python_benchmark_messages.cc
index ded16fe..ef7e8a2 100644
--- a/benchmarks/python/python_benchmark_messages.cc
+++ b/benchmarks/python/python_benchmark_messages.cc
@@ -7,13 +7,19 @@
 #include "datasets/google_message3/benchmark_message3.pb.h"
 #include "datasets/google_message4/benchmark_message4.pb.h"
 
-static PyMethodDef python_benchmark_methods[] = {
-    {NULL, NULL, 0, NULL}        /* Sentinel */
-};
+static struct PyModuleDef _module = {PyModuleDef_HEAD_INIT,
+                                     "libbenchmark_messages",
+                                     "Benchmark messages Python module",
+                                     -1,
+                                     NULL,
+                                     NULL,
+                                     NULL,
+                                     NULL,
+                                     NULL};
 
-
+extern "C" {
 PyMODINIT_FUNC
-initlibbenchmark_messages() {
+PyInit_libbenchmark_messages() {
   benchmarks::BenchmarkDataset().descriptor();
   benchmarks::proto3::GoogleMessage1().descriptor();
   benchmarks::proto2::GoogleMessage1().descriptor();
@@ -21,9 +27,6 @@
   benchmarks::google_message3::GoogleMessage3().descriptor();
   benchmarks::google_message4::GoogleMessage4().descriptor();
 
-  PyObject *m;
-
-  m = Py_InitModule("libbenchmark_messages", python_benchmark_methods);
-  if (m == NULL)
-      return;
+  return PyModule_Create(&_module);
+}
 }
diff --git a/benchmarks/util/result_parser.py b/benchmarks/util/result_parser.py
index 896f47a..d3251a8 100644
--- a/benchmarks/util/result_parser.py
+++ b/benchmarks/util/result_parser.py
@@ -61,7 +61,7 @@
     return
   if filename[0] != '/':
     filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename
-  with open(filename, "rb") as f:
+  with open(filename, encoding="utf-8") as f:
     results = json.loads(f.read())
     for benchmark in results["benchmarks"]:
       data_filename = "".join(
@@ -96,7 +96,7 @@
     return
   if filename[0] != "/":
     filename = os.path.dirname(os.path.abspath(__file__)) + "/" + filename
-  with open(filename, "rb") as f:
+  with open(filename, encoding="utf-8") as f:
     results = json.loads(f.read())
     for benchmark in results["benchmarks"]:
       __results.append({
@@ -126,7 +126,7 @@
     return
   if filename[0] != '/':
     filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename
-  with open(filename, "rb") as f:
+  with open(filename, encoding="utf-8") as f:
     results_list = json.loads(f.read())
     for results in results_list:
       for result in results:
@@ -176,7 +176,7 @@
     return
   if filename[0] != '/':
     filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename
-  with open(filename, "rb") as f:
+  with open(filename, encoding="utf-8") as f:
     results = json.loads(f.read())
     for result in results:
       total_weight = 0
@@ -212,7 +212,7 @@
     return
   if filename[0] != '/':
     filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename
-  with open(filename, "rb") as f:
+  with open(filename, encoding="utf-8") as f:
     for line in f:
       result_list = re.split(r"[\ \t]+", line)
       if result_list[0][:9] != "Benchmark":
@@ -252,7 +252,7 @@
     return
   if filename[0] != '/':
     filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename
-  with open(filename, "rb") as f:
+  with open(filename, encoding="utf-8") as f:
     results = json.loads(f.read())
     for result in results:
       _, avg_size = __get_data_size(result["filename"])
@@ -300,29 +300,44 @@
 
   return __results
 
+
 if __name__ == "__main__":
   parser = argparse.ArgumentParser()
-  parser.add_argument("-cpp", "--cpp_input_file",
-                      help="The CPP benchmark result file's name",
-                      default="")
-  parser.add_argument("-java", "--java_input_file",
-                      help="The Java benchmark result file's name",
-                      default="")
-  parser.add_argument("-python", "--python_input_file",
-                      help="The Python benchmark result file's name",
-                      default="")
-  parser.add_argument("-go", "--go_input_file",
-                      help="The golang benchmark result file's name",
-                      default="")
-  parser.add_argument("-node", "--node_input_file",
-                      help="The node.js benchmark result file's name",
-                      default="")
-  parser.add_argument("-php", "--php_input_file",
-                      help="The pure php benchmark result file's name",
-                      default="")
-  parser.add_argument("-php_c", "--php_c_input_file",
-                      help="The php with c ext benchmark result file's name",
-                      default="")
+  parser.add_argument(
+      "-cpp",
+      "--cpp_input_file",
+      help="The CPP benchmark result file's name",
+      default="")
+  parser.add_argument(
+      "-java",
+      "--java_input_file",
+      help="The Java benchmark result file's name",
+      default="")
+  parser.add_argument(
+      "-python",
+      "--python_input_file",
+      help="The Python benchmark result file's name",
+      default="")
+  parser.add_argument(
+      "-go",
+      "--go_input_file",
+      help="The golang benchmark result file's name",
+      default="")
+  parser.add_argument(
+      "-node",
+      "--node_input_file",
+      help="The node.js benchmark result file's name",
+      default="")
+  parser.add_argument(
+      "-php",
+      "--php_input_file",
+      help="The pure php benchmark result file's name",
+      default="")
+  parser.add_argument(
+      "-php_c",
+      "--php_c_input_file",
+      help="The php with c ext benchmark result file's name",
+      default="")
   args = parser.parse_args()
 
   results = get_result_from_file(
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index 61a5c3d..51e8478 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -15,6 +15,10 @@
 if(POLICY CMP0048)
   cmake_policy(SET CMP0048 NEW)
 endif()
+# MSVC runtime library flags are selected by an abstraction.
+if(POLICY CMP0091)
+  cmake_policy(SET CMP0091 NEW)
+endif()
 
 # Project
 project(protobuf C CXX)
@@ -123,9 +127,6 @@
 endif()
 
 find_package(Threads REQUIRED)
-if (CMAKE_USE_PTHREADS_INIT)
-  add_definitions(-DHAVE_PTHREAD)
-endif (CMAKE_USE_PTHREADS_INIT)
 
 set(_protobuf_FIND_ZLIB)
 if (protobuf_WITH_ZLIB)
@@ -176,20 +177,28 @@
   set(protobuf_SHARED_OR_STATIC "SHARED")
 else (protobuf_BUILD_SHARED_LIBS)
   set(protobuf_SHARED_OR_STATIC "STATIC")
-  # In case we are building static libraries, link also the runtime library statically
-  # so that MSVCR*.DLL is not required at runtime.
-  # https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
-  # This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd
-  # http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F
-  if (MSVC AND protobuf_MSVC_STATIC_RUNTIME)
-    foreach(flag_var
-        CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
-        CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
-      if(${flag_var} MATCHES "/MD")
-        string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
-      endif(${flag_var} MATCHES "/MD")
-    endforeach(flag_var)
-  endif (MSVC AND protobuf_MSVC_STATIC_RUNTIME)
+  # The CMAKE_<LANG>_FLAGS(_<BUILD_TYPE>)? is meant to be user controlled.
+  # Prior to CMake 3.15, the MSVC runtime library was pushed into the same flags
+  # making programmatic control difficult.  Prefer the functionality in newer
+  # CMake versions when available.
+  if(CMAKE_VERSION VERSION_GREATER 3.15 OR CMAKE_VERSION VERSION_EQUAL 3.15)
+    set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$<CONFIG:Debug>:Debug>)
+  else()
+    # In case we are building static libraries, link also the runtime library statically
+    # so that MSVCR*.DLL is not required at runtime.
+    # https://msdn.microsoft.com/en-us/library/2kzt1wy3.aspx
+    # This is achieved by replacing msvc option /MD with /MT and /MDd with /MTd
+    # http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_build_my_MSVC_application_with_a_static_runtime.3F
+    if (MSVC AND protobuf_MSVC_STATIC_RUNTIME)
+      foreach(flag_var
+          CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+          CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+        if(${flag_var} MATCHES "/MD")
+          string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
+        endif(${flag_var} MATCHES "/MD")
+      endforeach(flag_var)
+    endif (MSVC AND protobuf_MSVC_STATIC_RUNTIME)
+  endif()
 endif (protobuf_BUILD_SHARED_LIBS)
 
 if (MSVC)
@@ -197,6 +206,8 @@
     # Build with multiple processes
     add_definitions(/MP)
   endif()
+  # Set source file and execution character sets to UTF-8
+  add_definitions(/utf-8)
   # MSVC warning suppressions
   add_definitions(
     /wd4018 # 'expression' : signed/unsigned mismatch
diff --git a/cmake/extract_includes.bat.in b/cmake/extract_includes.bat.in
index 97c6b71..605c5f9 100644
--- a/cmake/extract_includes.bat.in
+++ b/cmake/extract_includes.bat.in
@@ -21,15 +21,19 @@
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\arenastring.h" include\google\protobuf\arenastring.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\code_generator.h" include\google\protobuf\compiler\code_generator.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\command_line_interface.h" include\google\protobuf\compiler\command_line_interface.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_file.h" include\google\protobuf\compiler\cpp\cpp_file.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_generator.h" include\google\protobuf\compiler\cpp\cpp_generator.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_helpers.h" include\google\protobuf\compiler\cpp\cpp_helpers.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\cpp\cpp_names.h" include\google\protobuf\compiler\cpp\cpp_names.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_doc_comment.h" include\google\protobuf\compiler\csharp\csharp_doc_comment.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_generator.h" include\google\protobuf\compiler\csharp\csharp_generator.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_names.h" include\google\protobuf\compiler\csharp\csharp_names.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\csharp\csharp_options.h" include\google\protobuf\compiler\csharp\csharp_options.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\importer.h" include\google\protobuf\compiler\importer.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_generator.h" include\google\protobuf\compiler\java\java_generator.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_kotlin_generator.h" include\google\protobuf\compiler\java\java_kotlin_generator.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\java\java_names.h" include\google\protobuf\compiler\java\java_names.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\js_generator.h" include\google\protobuf\compiler\js\js_generator.h
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\js\well_known_types_embed.h" include\google\protobuf\compiler\js\well_known_types_embed.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_generator.h" include\google\protobuf\compiler\objectivec\objectivec_generator.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\objectivec\objectivec_helpers.h" include\google\protobuf\compiler\objectivec\objectivec_helpers.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\compiler\parser.h" include\google\protobuf\compiler\parser.h
@@ -44,6 +48,7 @@
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\duration.pb.h" include\google\protobuf\duration.pb.h
 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\explicitly_constructed.h" include\google\protobuf\explicitly_constructed.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_access_listener.h" include\google\protobuf\field_access_listener.h
@@ -53,6 +58,7 @@
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_bases.h" include\google\protobuf\generated_message_bases.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_reflection.h" include\google\protobuf\generated_message_reflection.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven.h" include\google\protobuf\generated_message_table_driven.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_table_driven_lite.h" include\google\protobuf\generated_message_table_driven_lite.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_decl.h" include\google\protobuf\generated_message_tctable_decl.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_impl.h" include\google\protobuf\generated_message_tctable_impl.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\generated_message_tctable_impl.inc" include\google\protobuf\generated_message_tctable_impl.inc
@@ -87,9 +93,9 @@
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection.h" include\google\protobuf\reflection.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\reflection_ops.h" include\google\protobuf\reflection_ops.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_field.h" include\google\protobuf\repeated_field.h
+copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\repeated_ptr_field.h" include\google\protobuf\repeated_ptr_field.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\service.h" include\google\protobuf\service.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\source_context.pb.h" include\google\protobuf\source_context.pb.h
-copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\string_member_robber.h" include\google\protobuf\string_member_robber.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\struct.pb.h" include\google\protobuf\struct.pb.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\bytestream.h" include\google\protobuf\stubs\bytestream.h
 copy "${PROTOBUF_SOURCE_WIN32_PATH}\..\src\google\protobuf\stubs\callback.h" include\google\protobuf\stubs\callback.h
diff --git a/cmake/install.cmake b/cmake/install.cmake
index ef5bb13..4e1c5de 100644
--- a/cmake/install.cmake
+++ b/cmake/install.cmake
@@ -30,9 +30,8 @@
 
 if (protobuf_BUILD_PROTOC_BINARIES)
   install(TARGETS protoc EXPORT protobuf-targets
-    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-    BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
-    COMPONENT protoc)
+    RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc
+    BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT protoc)
   if (UNIX AND NOT APPLE)
     set_property(TARGET protoc
       PROPERTY INSTALL_RPATH "$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
diff --git a/cmake/libprotobuf-lite.cmake b/cmake/libprotobuf-lite.cmake
index b9caa83..f36a7ac 100644
--- a/cmake/libprotobuf-lite.cmake
+++ b/cmake/libprotobuf-lite.cmake
@@ -5,6 +5,7 @@
   ${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_tctable_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/inlined_string_field.cc
@@ -18,6 +19,7 @@
   ${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/repeated_ptr_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
@@ -32,29 +34,56 @@
 )
 
 set(libprotobuf_lite_includes
+  ${protobuf_source_dir}/src/google/protobuf/any.h
   ${protobuf_source_dir}/src/google/protobuf/arena.h
+  ${protobuf_source_dir}/src/google/protobuf/arena_impl.h
   ${protobuf_source_dir}/src/google/protobuf/arenastring.h
+  ${protobuf_source_dir}/src/google/protobuf/explicitly_constructed.h
   ${protobuf_source_dir}/src/google/protobuf/extension_set.h
+  ${protobuf_source_dir}/src/google/protobuf/extension_set_inl.h
+  ${protobuf_source_dir}/src/google/protobuf/generated_enum_util.h
+  ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.h
+  ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven_lite.h
+  ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_decl.h
+  ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.h
+  ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_impl.inc
   ${protobuf_source_dir}/src/google/protobuf/generated_message_util.h
+  ${protobuf_source_dir}/src/google/protobuf/has_bits.h
   ${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.h
+  ${protobuf_source_dir}/src/google/protobuf/inlined_string_field.h
   ${protobuf_source_dir}/src/google/protobuf/io/coded_stream.h
+  ${protobuf_source_dir}/src/google/protobuf/io/io_win32.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/map.h
+  ${protobuf_source_dir}/src/google/protobuf/map_entry_lite.h
+  ${protobuf_source_dir}/src/google/protobuf/map_field_lite.h
+  ${protobuf_source_dir}/src/google/protobuf/map_type_handler.h
   ${protobuf_source_dir}/src/google/protobuf/message_lite.h
+  ${protobuf_source_dir}/src/google/protobuf/metadata_lite.h
   ${protobuf_source_dir}/src/google/protobuf/parse_context.h
+  ${protobuf_source_dir}/src/google/protobuf/port.h
   ${protobuf_source_dir}/src/google/protobuf/repeated_field.h
+  ${protobuf_source_dir}/src/google/protobuf/repeated_ptr_field.h
   ${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.h
+  ${protobuf_source_dir}/src/google/protobuf/stubs/callback.h
+  ${protobuf_source_dir}/src/google/protobuf/stubs/casts.h
   ${protobuf_source_dir}/src/google/protobuf/stubs/common.h
-  ${protobuf_source_dir}/src/google/protobuf/stubs/int128.h
+  ${protobuf_source_dir}/src/google/protobuf/stubs/hash.h
+  ${protobuf_source_dir}/src/google/protobuf/stubs/logging.h
+  ${protobuf_source_dir}/src/google/protobuf/stubs/macros.h
+  ${protobuf_source_dir}/src/google/protobuf/stubs/map_util.h
+  ${protobuf_source_dir}/src/google/protobuf/stubs/mutex.h
   ${protobuf_source_dir}/src/google/protobuf/stubs/once.h
+  ${protobuf_source_dir}/src/google/protobuf/stubs/platform_macros.h
+  ${protobuf_source_dir}/src/google/protobuf/stubs/port.h
   ${protobuf_source_dir}/src/google/protobuf/stubs/status.h
-  ${protobuf_source_dir}/src/google/protobuf/stubs/statusor.h
+  ${protobuf_source_dir}/src/google/protobuf/stubs/stl_util.h
   ${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.h
-  ${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.h
   ${protobuf_source_dir}/src/google/protobuf/stubs/strutil.h
-  ${protobuf_source_dir}/src/google/protobuf/stubs/time.h
+  ${protobuf_source_dir}/src/google/protobuf/stubs/template_util.h
   ${protobuf_source_dir}/src/google/protobuf/wire_format_lite.h
 )
 
diff --git a/cmake/libprotobuf.cmake b/cmake/libprotobuf.cmake
index d394467..668b8c2 100644
--- a/cmake/libprotobuf.cmake
+++ b/cmake/libprotobuf.cmake
@@ -15,6 +15,7 @@
   ${protobuf_source_dir}/src/google/protobuf/generated_message_bases.cc
   ${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.cc
   ${protobuf_source_dir}/src/google/protobuf/generated_message_table_driven.cc
+  ${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_full.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/tokenizer.cc
@@ -44,7 +45,6 @@
   ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.cc
   ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.cc
   ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.cc
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.cc
   ${protobuf_source_dir}/src/google/protobuf/util/internal/utility.cc
   ${protobuf_source_dir}/src/google/protobuf/util/json_util.cc
   ${protobuf_source_dir}/src/google/protobuf/util/message_differencer.cc
@@ -55,7 +55,6 @@
 )
 
 set(libprotobuf_includes
-  ${protobuf_source_dir}/src/google/protobuf/any.h
   ${protobuf_source_dir}/src/google/protobuf/any.pb.h
   ${protobuf_source_dir}/src/google/protobuf/api.pb.h
   ${protobuf_source_dir}/src/google/protobuf/compiler/importer.h
@@ -68,18 +67,22 @@
   ${protobuf_source_dir}/src/google/protobuf/empty.pb.h
   ${protobuf_source_dir}/src/google/protobuf/field_access_listener.h
   ${protobuf_source_dir}/src/google/protobuf/field_mask.pb.h
+  ${protobuf_source_dir}/src/google/protobuf/generated_enum_reflection.h
   ${protobuf_source_dir}/src/google/protobuf/generated_message_bases.h
   ${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/tokenizer.h
+  ${protobuf_source_dir}/src/google/protobuf/map_entry.h
   ${protobuf_source_dir}/src/google/protobuf/map_field.h
+  ${protobuf_source_dir}/src/google/protobuf/map_field_inl.h
   ${protobuf_source_dir}/src/google/protobuf/message.h
+  ${protobuf_source_dir}/src/google/protobuf/metadata.h
+  ${protobuf_source_dir}/src/google/protobuf/reflection.h
   ${protobuf_source_dir}/src/google/protobuf/reflection_ops.h
   ${protobuf_source_dir}/src/google/protobuf/service.h
   ${protobuf_source_dir}/src/google/protobuf/source_context.pb.h
   ${protobuf_source_dir}/src/google/protobuf/struct.pb.h
-  ${protobuf_source_dir}/src/google/protobuf/stubs/substitute.h
   ${protobuf_source_dir}/src/google/protobuf/text_format.h
   ${protobuf_source_dir}/src/google/protobuf/timestamp.pb.h
   ${protobuf_source_dir}/src/google/protobuf/type.pb.h
@@ -87,23 +90,10 @@
   ${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util.h
   ${protobuf_source_dir}/src/google/protobuf/util/field_comparator.h
   ${protobuf_source_dir}/src/google/protobuf/util/field_mask_util.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/datapiece.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/default_value_objectwriter.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/error_listener.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/field_mask_utility.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/json_escaping.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/json_objectwriter.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/json_stream_parser.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/object_writer.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/proto_writer.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectsource.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/protostream_objectwriter.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/type_info_test_helper.h
-  ${protobuf_source_dir}/src/google/protobuf/util/internal/utility.h
   ${protobuf_source_dir}/src/google/protobuf/util/json_util.h
   ${protobuf_source_dir}/src/google/protobuf/util/message_differencer.h
   ${protobuf_source_dir}/src/google/protobuf/util/time_util.h
+  ${protobuf_source_dir}/src/google/protobuf/util/type_resolver.h
   ${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.h
   ${protobuf_source_dir}/src/google/protobuf/wire_format.h
   ${protobuf_source_dir}/src/google/protobuf/wrappers.pb.h
diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake
index a6f7919..6f04331 100644
--- a/cmake/libprotoc.cmake
+++ b/cmake/libprotoc.cmake
@@ -85,82 +85,29 @@
 )
 
 set(libprotoc_headers
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_enum_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_extension.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_field.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.h
   ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_file.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_generator.h
   ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_helpers.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_map_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_message_layout_helper.h
   ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_names.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_options.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_padding_optimizer.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_service.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/cpp/cpp_string_field.h
   ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_names.h
   ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_options.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_context.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_doc_comment.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator_factory.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_helpers.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_map_field_lite.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_builder_lite.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_field_lite.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_message_lite.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_name_resolver.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_options.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_primitive_field_lite.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_service.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_shared_code_generator.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_string_field_lite.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_enum_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_extension.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_field.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_file.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/importer.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_kotlin_generator.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_names.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/js/js_generator.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_generator.h
   ${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
-  ${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
-  ${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.h
-  ${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/parser.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/python/python_generator.h
+  ${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.h
 )
 
 if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
@@ -183,4 +130,3 @@
     OUTPUT_NAME ${LIB_PREFIX}protoc
     DEBUG_POSTFIX "${protobuf_DEBUG_POSTFIX}")
 add_library(protobuf::libprotoc ALIAS libprotoc)
-
diff --git a/cmake/protobuf-module.cmake.in b/cmake/protobuf-module.cmake.in
index 810256e..09b9d29 100644
--- a/cmake/protobuf-module.cmake.in
+++ b/cmake/protobuf-module.cmake.in
@@ -110,16 +110,6 @@
   endif()
 endfunction()
 
-# Internal function: find threads library
-function(_protobuf_find_threads)
-    set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
-    find_package(Threads)
-    if(Threads_FOUND)
-        list(APPEND PROTOBUF_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
-        set(PROTOBUF_LIBRARIES "${PROTOBUF_LIBRARIES}" PARENT_SCOPE)
-    endif()
-endfunction()
-
 #
 # Main.
 #
@@ -139,10 +129,6 @@
 # The Protobuf Protoc Library
 _protobuf_find_libraries(Protobuf_PROTOC protoc)
 
-if(UNIX)
-  _protobuf_find_threads()
-endif()
-
 # Set the include directory
 get_target_property(Protobuf_INCLUDE_DIRS protobuf::libprotobuf
   INTERFACE_INCLUDE_DIRECTORIES)
diff --git a/cmake/tests.cmake b/cmake/tests.cmake
index 801c994..5296858 100644
--- a/cmake/tests.cmake
+++ b/cmake/tests.cmake
@@ -111,8 +111,14 @@
       ${protobuf_source_dir}/src/${pb_file})
 endforeach(proto_file)
 
-set(common_test_files
+set(common_lite_test_files
   ${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc
+  ${protobuf_source_dir}/src/google/protobuf/map_lite_test_util.cc
+  ${protobuf_source_dir}/src/google/protobuf/test_util_lite.cc
+)
+
+set(common_test_files
+  ${common_lite_test_files}
   ${protobuf_source_dir}/src/google/protobuf/map_test_util.inc
   ${protobuf_source_dir}/src/google/protobuf/reflection_tester.cc
   ${protobuf_source_dir}/src/google/protobuf/test_util.cc
@@ -121,12 +127,6 @@
   ${protobuf_source_dir}/src/google/protobuf/testing/googletest.cc
 )
 
-set(common_lite_test_files
-  ${protobuf_source_dir}/src/google/protobuf/arena_test_util.cc
-  ${protobuf_source_dir}/src/google/protobuf/map_lite_test_util.cc
-  ${protobuf_source_dir}/src/google/protobuf/test_util_lite.cc
-)
-
 set(tests_files
   ${protobuf_source_dir}/src/google/protobuf/any_test.cc
   ${protobuf_source_dir}/src/google/protobuf/arena_unittest.cc
diff --git a/configure.ac b/configure.ac
index b7466c2..4c774b0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@
 # 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.18.1],[protobuf@googlegroups.com],[protobuf])
+AC_INIT([Protocol Buffers],[3.19.4],[protobuf@googlegroups.com],[protobuf])
 
 AM_MAINTAINER_MODE([enable])
 
diff --git a/conformance/Makefile.am b/conformance/Makefile.am
index b281f9c..ac6f9e1 100644
--- a/conformance/Makefile.am
+++ b/conformance/Makefile.am
@@ -359,24 +359,10 @@
 # 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
-	VERSION="$(shell python --version 2>&1)"; \
-	if [[ "$$VERSION"  == "Python 2.7"* ]]; then \
-	  echo "Using Python 2.7 failure list."; \
-	  ./conformance-test-runner --enforce_recommended --failure_list failure_list_python.txt --text_format_failure_list text_format_failure_list_python_2.7.txt ./conformance_python.py; \
-	else \
-	  echo "Using Python >2.7 failure list."; \
-	  ./conformance-test-runner --enforce_recommended --failure_list failure_list_python.txt --text_format_failure_list text_format_failure_list_python.txt ./conformance_python.py; \
-	fi
+	./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
-	VERSION="$(shell python --version 2>&1)"; \
-	if [[ "$$VERSION"  == "Python 2.7"* ]]; then \
-	  echo "Using Python 2.7 failure list."; \
-	  ./conformance-test-runner --enforce_recommended --failure_list failure_list_python_cpp.txt --text_format_failure_list text_format_failure_list_python_cpp_2.7.txt ./conformance_python.py; \
-	else \
-	  echo "Using Python >2.7 failure list."; \
-	  ./conformance-test-runner --enforce_recommended --failure_list failure_list_python_cpp.txt --text_format_failure_list text_format_failure_list_python_cpp.txt ./conformance_python.py; \
-	fi
+	./conformance-test-runner --enforce_recommended --failure_list failure_list_python_cpp.txt --text_format_failure_list text_format_failure_list_python_cpp.txt ./conformance_python.py
 
 test_nodejs: protoc_middleman conformance-test-runner $(other_language_protoc_outputs)
 	NODE_PATH=../js:. ./conformance-test-runner --enforce_recommended --failure_list failure_list_js.txt ./conformance_nodejs.js
diff --git a/conformance/binary_json_conformance_suite.cc b/conformance/binary_json_conformance_suite.cc
index 0275e2e..b12978f 100644
--- a/conformance/binary_json_conformance_suite.cc
+++ b/conformance/binary_json_conformance_suite.cc
@@ -219,21 +219,21 @@
 #define UNKNOWN_FIELD 666
 
 enum class Packed {
-  UNSPECIFIED = 0,
-  TRUE = 1,
-  FALSE = 2,
+  kUnspecified = 0,
+  kTrue = 1,
+  kFalse = 2,
 };
 
 const FieldDescriptor* GetFieldForType(FieldDescriptor::Type type,
                                        bool repeated, bool is_proto3,
-                                       Packed packed = Packed::UNSPECIFIED) {
+                                       Packed packed = Packed::kUnspecified) {
   const Descriptor* d = is_proto3 ?
       TestAllTypesProto3().GetDescriptor() : TestAllTypesProto2().GetDescriptor();
   for (int i = 0; i < d->field_count(); i++) {
     const FieldDescriptor* f = d->field(i);
     if (f->type() == type && f->is_repeated() == repeated) {
-      if ((packed == Packed::TRUE && !f->is_packed()) ||
-          (packed == Packed::FALSE && f->is_packed())) {
+      if ((packed == Packed::kTrue && !f->is_packed()) ||
+          (packed == Packed::kFalse && f->is_packed())) {
         continue;
       }
       return f;
@@ -243,10 +243,10 @@
   string packed_string = "";
   const string repeated_string = repeated ? "Repeated " : "Singular ";
   const string proto_string = is_proto3 ? "Proto3" : "Proto2";
-  if (packed == Packed::TRUE) {
+  if (packed == Packed::kTrue) {
     packed_string = "Packed ";
   }
-  if (packed == Packed::FALSE) {
+  if (packed == Packed::kFalse) {
     packed_string = "Unpacked ";
   }
   GOOGLE_LOG(FATAL) << "Couldn't find field with type: " << repeated_string.c_str()
@@ -796,9 +796,9 @@
     // Test repeated fields.
     if (FieldDescriptor::IsTypePackable(type)) {
       const FieldDescriptor* packed_field =
-          GetFieldForType(type, true, is_proto3, Packed::TRUE);
+          GetFieldForType(type, true, is_proto3, Packed::kTrue);
       const FieldDescriptor* unpacked_field =
-          GetFieldForType(type, true, is_proto3, Packed::FALSE);
+          GetFieldForType(type, true, is_proto3, Packed::kFalse);
 
       string default_proto_packed;
       string default_proto_unpacked;
diff --git a/conformance/conformance.proto b/conformance/conformance.proto
index 49608b3..7248e98 100644
--- a/conformance/conformance.proto
+++ b/conformance/conformance.proto
@@ -95,7 +95,7 @@
   //
   // TODO(haberman): if/when we expand the conformance tests to support proto2,
   // we will want to include a field that lets the payload/response be a
-  // protobuf_test_messages.proto2.TestAllTypes message instead.
+  // protobuf_test_messages.google.protobuf.TestAllTypes message instead.
   oneof payload {
     bytes protobuf_payload = 1;
     string json_payload = 2;
@@ -109,7 +109,7 @@
 
   // The full name for the test message to use; for the moment, either:
   // protobuf_test_messages.proto3.TestAllTypesProto3 or
-  // protobuf_test_messages.proto2.TestAllTypesProto2.
+  // protobuf_test_messages.google.protobuf.TestAllTypesProto2.
   string message_type = 4;
 
   // Each test is given a specific test category. Some category may need
diff --git a/conformance/conformance_nodejs.js b/conformance/conformance_nodejs.js
index 4d96a38..95da893 100755
--- a/conformance/conformance_nodejs.js
+++ b/conformance/conformance_nodejs.js
@@ -1,36 +1,33 @@
 #!/usr/bin/env node
-
-/*
- * 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.
- */
+// 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.
 
 var conformance = require('conformance_pb');
 var test_messages_proto3 = require('google/protobuf/test_messages_proto3_pb');
diff --git a/conformance/failure_list_jruby.txt b/conformance/failure_list_jruby.txt
index ceaaf92..516192e 100644
--- a/conformance/failure_list_jruby.txt
+++ b/conformance/failure_list_jruby.txt
@@ -2,6 +2,34 @@
 Recommended.FieldMaskPathsDontRoundTrip.JsonOutput
 Recommended.FieldMaskTooManyUnderscore.JsonOutput
 Recommended.Proto2.JsonInput.FieldNameExtension.Validator
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput
+Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.JsonInput.BoolFieldAllCapitalFalse
 Recommended.Proto3.JsonInput.BoolFieldAllCapitalTrue
 Recommended.Proto3.JsonInput.BoolFieldCamelCaseFalse
@@ -29,782 +57,39 @@
 Recommended.Proto3.JsonInput.StringFieldUnpairedLowSurrogate
 Recommended.Proto3.JsonInput.Uint32MapFieldKeyNotQuoted
 Recommended.Proto3.JsonInput.Uint64MapFieldKeyNotQuoted
-Recommended.Proto3.ProtobufInput.OneofZeroBool.JsonOutput
-Recommended.Proto3.ProtobufInput.OneofZeroBool.ProtobufOutput
-Recommended.Proto3.ProtobufInput.OneofZeroBytes.JsonOutput
-Recommended.Proto3.ProtobufInput.OneofZeroBytes.ProtobufOutput
-Recommended.Proto3.ProtobufInput.OneofZeroDouble.JsonOutput
-Recommended.Proto3.ProtobufInput.OneofZeroDouble.ProtobufOutput
-Recommended.Proto3.ProtobufInput.OneofZeroEnum.JsonOutput
-Recommended.Proto3.ProtobufInput.OneofZeroEnum.ProtobufOutput
-Recommended.Proto3.ProtobufInput.OneofZeroFloat.JsonOutput
-Recommended.Proto3.ProtobufInput.OneofZeroFloat.ProtobufOutput
-Recommended.Proto3.ProtobufInput.OneofZeroMessage.JsonOutput
-Recommended.Proto3.ProtobufInput.OneofZeroMessage.ProtobufOutput
-Recommended.Proto3.ProtobufInput.OneofZeroMessageSetTwice.JsonOutput
-Recommended.Proto3.ProtobufInput.OneofZeroMessageSetTwice.ProtobufOutput
-Recommended.Proto3.ProtobufInput.OneofZeroString.JsonOutput
-Recommended.Proto3.ProtobufInput.OneofZeroString.ProtobufOutput
-Recommended.Proto3.ProtobufInput.OneofZeroUint32.JsonOutput
-Recommended.Proto3.ProtobufInput.OneofZeroUint32.ProtobufOutput
-Recommended.Proto3.ProtobufInput.OneofZeroUint64.JsonOutput
-Recommended.Proto3.ProtobufInput.OneofZeroUint64.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BOOL.DefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BOOL.MultipleValuesForDifferentField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BOOL.MultipleValuesForSameField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BOOL.NonDefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BYTES.DefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BYTES.MultipleValuesForDifferentField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BYTES.MultipleValuesForSameField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.BYTES.NonDefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.DOUBLE.DefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.DOUBLE.MultipleValuesForDifferentField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.DOUBLE.MultipleValuesForSameField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.DOUBLE.NonDefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.ENUM.DefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.ENUM.MultipleValuesForDifferentField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.ENUM.MultipleValuesForSameField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.ENUM.NonDefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.FLOAT.DefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.FLOAT.MultipleValuesForDifferentField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.FLOAT.MultipleValuesForSameField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.FLOAT.NonDefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.DefaultValue.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.Merge.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.MultipleValuesForDifferentField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.MultipleValuesForSameField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.NonDefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.STRING.DefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.STRING.MultipleValuesForDifferentField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.STRING.MultipleValuesForSameField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.STRING.NonDefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT32.DefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT32.MultipleValuesForDifferentField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT32.MultipleValuesForSameField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT32.NonDefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT64.DefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT64.MultipleValuesForDifferentField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT64.MultipleValuesForSameField.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.UINT64.NonDefaultValue.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.DefaultOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput
 Recommended.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.UnpackedOutput.ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BOOL[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BOOL[3].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BOOL[4].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BOOL[5].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BOOL[6].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.BYTES[3].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.DOUBLE[1].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.DOUBLE[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[0].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[1].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[3].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[4].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.ENUM[5].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FIXED32[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FIXED64[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FLOAT[1].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FLOAT[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FLOAT[3].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.FLOAT[4].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[1].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[3].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[4].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[5].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[6].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[7].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[8].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT32[9].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT64[1].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT64[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.INT64[3].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.MESSAGE[0].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.MESSAGE[1].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED32[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED32[3].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED64[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SFIXED64[3].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT32[1].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT32[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT32[3].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT32[4].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT64[1].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT64[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.SINT64[3].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.STRING[3].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.STRING[4].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.STRING[5].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.STRING[6].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[1].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[2].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[3].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[4].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[5].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[6].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[7].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[8].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT32[9].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT64[1].ProtobufOutput
-Recommended.Proto3.ProtobufInput.ValidDataScalarBinary.UINT64[2].ProtobufOutput
-Required.DurationProtoInputTooLarge.JsonOutput
-Required.DurationProtoInputTooSmall.JsonOutput
-Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator
-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.EnumFieldNotQuoted
-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
 Required.Proto3.JsonInput.Int32FieldLeadingZero
 Required.Proto3.JsonInput.Int32FieldNegativeWithLeadingZero
 Required.Proto3.JsonInput.Int32FieldPlusSign
 Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotBool
 Required.Proto3.JsonInput.RepeatedFieldWrongElementTypeExpectingStringsGotInt
 Required.Proto3.JsonInput.StringFieldNotAString
-Required.Proto3.ProtobufInput.DoubleFieldNormalizeQuietNan.JsonOutput
-Required.Proto3.ProtobufInput.DoubleFieldNormalizeSignalingNan.JsonOutput
-Required.Proto3.ProtobufInput.FloatFieldNormalizeQuietNan.JsonOutput
-Required.Proto3.ProtobufInput.FloatFieldNormalizeSignalingNan.JsonOutput
-Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.BOOL
-Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.INT32
-Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.INT64
-Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.SINT32
-Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.SINT64
-Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.UINT32
-Required.Proto3.ProtobufInput.PrematureEofInsideKnownNonRepeatedValue.UINT64
-Required.Proto3.ProtobufInput.RepeatedScalarMessageMerge.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarMessageMerge.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.BOOL.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.BOOL.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.BYTES.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.BYTES.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.ENUM.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.ENUM.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FIXED32.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FIXED32.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FIXED64.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FIXED64.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FLOAT.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.FLOAT.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.INT32.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.INT32.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.INT64.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.INT64.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SFIXED32.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SFIXED32.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SFIXED64.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SFIXED64.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SINT32.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SINT32.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SINT64.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.SINT64.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.STRING.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.STRING.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT32.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT32.ProtobufOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT64.JsonOutput
-Required.Proto3.ProtobufInput.RepeatedScalarSelectsLast.UINT64.ProtobufOutput
-Required.Proto3.ProtobufInput.UnknownVarint.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.BOOL.BOOL.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED32.FIXED32.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.FIXED64.FIXED64.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.DOUBLE.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.FLOAT.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT32.INT32.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.INT64.INT64.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED32.SFIXED32.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SFIXED64.SFIXED64.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT32.SINT32.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.SINT64.SINT64.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.BYTES.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.ENUM.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.MergeValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.MergeValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.MESSAGE.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.STRING.STRING.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT32.UINT32.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.Default.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.Default.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateKey.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateKey.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateKeyInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateKeyInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateValueInMapEntry.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.DuplicateValueInMapEntry.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.MissingDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.MissingDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.NonDefault.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.NonDefault.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.Unordered.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataMap.UINT64.UINT64.Unordered.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.DefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.DefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.MultipleValuesForDifferentField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.MultipleValuesForDifferentField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.MultipleValuesForSameField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.MultipleValuesForSameField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.NonDefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BOOL.NonDefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.DefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.DefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.MultipleValuesForDifferentField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.MultipleValuesForDifferentField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.MultipleValuesForSameField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.MultipleValuesForSameField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.NonDefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.BYTES.NonDefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.DefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.DefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.MultipleValuesForDifferentField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.MultipleValuesForDifferentField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.MultipleValuesForSameField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.MultipleValuesForSameField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.NonDefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.DOUBLE.NonDefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.DefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.DefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.MultipleValuesForDifferentField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.MultipleValuesForDifferentField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.MultipleValuesForSameField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.MultipleValuesForSameField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.NonDefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.ENUM.NonDefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.DefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.DefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.MultipleValuesForDifferentField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.MultipleValuesForDifferentField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.MultipleValuesForSameField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.MultipleValuesForSameField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.NonDefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.FLOAT.NonDefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.DefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.DefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.Merge.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.Merge.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.MultipleValuesForDifferentField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.MultipleValuesForDifferentField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.MultipleValuesForSameField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.MultipleValuesForSameField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.NonDefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.MESSAGE.NonDefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.STRING.DefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.STRING.DefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.STRING.MultipleValuesForDifferentField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.STRING.MultipleValuesForDifferentField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.STRING.MultipleValuesForSameField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.STRING.MultipleValuesForSameField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.STRING.NonDefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.STRING.NonDefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.DefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.DefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.MultipleValuesForDifferentField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.MultipleValuesForDifferentField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.MultipleValuesForSameField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.MultipleValuesForSameField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.NonDefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT32.NonDefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.DefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.DefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.MultipleValuesForDifferentField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.MultipleValuesForDifferentField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.MultipleValuesForSameField.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.MultipleValuesForSameField.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.NonDefaultValue.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataOneof.UINT64.NonDefaultValue.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.BYTES.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.BYTES.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.DOUBLE.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.ENUM.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.ENUM.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED32.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.FIXED64.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.FLOAT.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.INT32.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.INT64.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.MESSAGE.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.MESSAGE.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED32.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SFIXED64.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SINT32.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SINT32.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.SINT64.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.STRING.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.STRING.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.JsonOutput
-Required.Proto3.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[3].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[3].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[4].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[4].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[5].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[5].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[6].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.BOOL[6].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.BYTES[3].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.BYTES[3].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.DOUBLE[1].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.DOUBLE[1].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.DOUBLE[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.DOUBLE[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[0].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[0].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[1].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[1].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[3].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[3].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[4].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[4].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[5].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.ENUM[5].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.FIXED32[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.FIXED32[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.FIXED64[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.FIXED64[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[1].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[1].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[3].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[3].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[4].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.FLOAT[4].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[1].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[1].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[3].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[3].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[4].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[4].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[5].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[5].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[6].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[6].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[7].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[7].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[8].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[8].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[9].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT32[9].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT64[1].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT64[1].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT64[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT64[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT64[3].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.INT64[3].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.MESSAGE[0].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.MESSAGE[0].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.MESSAGE[1].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.MESSAGE[1].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED32[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED32[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED32[3].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED32[3].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED64[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED64[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED64[3].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SFIXED64[3].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[1].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[1].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[3].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[3].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[4].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT32[4].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[1].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[1].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[3].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.SINT64[3].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.STRING[3].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.STRING[3].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.STRING[4].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.STRING[4].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.STRING[5].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.STRING[5].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.STRING[6].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.STRING[6].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[1].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[1].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[2].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[3].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[3].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[4].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[4].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[5].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[5].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[6].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[6].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[7].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[7].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[8].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[8].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[9].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT32[9].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT64[1].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT64[1].ProtobufOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT64[2].JsonOutput
-Required.Proto3.ProtobufInput.ValidDataScalar.UINT64[2].ProtobufOutput
-Required.TimestampProtoInputTooLarge.JsonOutput
-Required.TimestampProtoInputTooSmall.JsonOutput
diff --git a/conformance/text_format_failure_list_java.txt b/conformance/text_format_failure_list_java.txt
index 71e3242..793aae1 100644
--- a/conformance/text_format_failure_list_java.txt
+++ b/conformance/text_format_failure_list_java.txt
@@ -7,7 +7,3 @@
 
 Required.Proto3.TextFormatInput.StringFieldBadUTF8Hex
 Required.Proto3.TextFormatInput.StringFieldBadUTF8Octal
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput
diff --git a/conformance/text_format_failure_list_python_2.7.txt b/conformance/text_format_failure_list_python_2.7.txt
deleted file mode 100644
index cada2bc..0000000
--- a/conformance/text_format_failure_list_python_2.7.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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
-
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairBytes
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairString
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortString
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongBytes
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongString
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput
-Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeBytes
-Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeString
diff --git a/conformance/text_format_failure_list_python_cpp_2.7.txt b/conformance/text_format_failure_list_python_cpp_2.7.txt
deleted file mode 100644
index ba2089b..0000000
--- a/conformance/text_format_failure_list_python_cpp_2.7.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateFirstOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairBytes
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogatePairString
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeSurrogateSecondOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesBytes.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapesString.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeBytes.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.ProtobufOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeString.TextFormatOutput
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateFirstOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairBytes
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogatePairString
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyBytes
-Recommended.Proto3.TextFormatInput.StringLiteralShortUnicodeEscapeSurrogateSecondOnlyString
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortBytes
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairLongShortString
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongBytes
-Recommended.Proto3.TextFormatInput.StringLiteralUnicodeEscapeSurrogatePairShortLongString
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.ProtobufOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesBytes.TextFormatOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.ProtobufOutput
-Required.Proto3.TextFormatInput.StringLiteralBasicEscapesString.TextFormatOutput
-Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeBytes
-Required.Proto3.TextFormatInput.StringLiteralLongUnicodeEscapeTooLargeString
diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec
index 8e5786f..098d79d 100644
--- a/csharp/Google.Protobuf.Tools.nuspec
+++ b/csharp/Google.Protobuf.Tools.nuspec
@@ -5,7 +5,7 @@
     <title>Google Protocol Buffers tools</title>
     <summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
     <description>See project site for more info.</description>
-    <version>3.18.1</version>
+    <version>3.19.4</version>
     <authors>Google Inc.</authors>
     <owners>protobuf-packages</owners>
     <licenseUrl>https://github.com/protocolbuffers/protobuf/blob/master/LICENSE</licenseUrl>
diff --git a/csharp/src/Google.Protobuf.Conformance/Conformance.cs b/csharp/src/Google.Protobuf.Conformance/Conformance.cs
index fb053b2..0a3d5c6 100644
--- a/csharp/src/Google.Protobuf.Conformance/Conformance.cs
+++ b/csharp/src/Google.Protobuf.Conformance/Conformance.cs
@@ -427,7 +427,7 @@
     /// <summary>
     /// The full name for the test message to use; for the moment, either:
     /// protobuf_test_messages.proto3.TestAllTypesProto3 or
-    /// protobuf_test_messages.proto2.TestAllTypesProto2.
+    /// protobuf_test_messages.google.protobuf.TestAllTypesProto2.
     /// </summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
diff --git a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs
index 8a52209..d2db53d 100644
--- a/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs
+++ b/csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.cs
@@ -25,7 +25,7 @@
       byte[] descriptorData = global::System.Convert.FromBase64String(
           string.Concat(
             "Cipnb29nbGUvcHJvdG9idWYvdGVzdF9tZXNzYWdlc19wcm90bzIucHJvdG8S",
-            "HXByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8yIv45ChJUZXN0QWxsVHlw",
+            "HXByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8yIqQ+ChJUZXN0QWxsVHlw",
             "ZXNQcm90bzISFgoOb3B0aW9uYWxfaW50MzIYASABKAUSFgoOb3B0aW9uYWxf",
             "aW50NjQYAiABKAMSFwoPb3B0aW9uYWxfdWludDMyGAMgASgNEhcKD29wdGlv",
             "bmFsX3VpbnQ2NBgEIAEoBBIXCg9vcHRpb25hbF9zaW50MzIYBSABKBESFwoP",
@@ -135,80 +135,92 @@
             "b25lb2ZfZG91YmxlGHYgASgBSAASUgoKb25lb2ZfZW51bRh3IAEoDjI8LnBy",
             "b3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8yLlRlc3RBbGxUeXBlc1Byb3Rv",
             "Mi5OZXN0ZWRFbnVtSAASRQoEZGF0YRjJASABKAoyNi5wcm90b2J1Zl90ZXN0",
-            "X21lc3NhZ2VzLnByb3RvMi5UZXN0QWxsVHlwZXNQcm90bzIuRGF0YRITCgpm",
-            "aWVsZG5hbWUxGJEDIAEoBRIUCgtmaWVsZF9uYW1lMhiSAyABKAUSFQoMX2Zp",
-            "ZWxkX25hbWUzGJMDIAEoBRIWCg1maWVsZF9fbmFtZTRfGJQDIAEoBRIUCgtm",
-            "aWVsZDBuYW1lNRiVAyABKAUSFgoNZmllbGRfMF9uYW1lNhiWAyABKAUSEwoK",
-            "ZmllbGROYW1lNxiXAyABKAUSEwoKRmllbGROYW1lOBiYAyABKAUSFAoLZmll",
-            "bGRfTmFtZTkYmQMgASgFEhUKDEZpZWxkX05hbWUxMBiaAyABKAUSFQoMRklF",
-            "TERfTkFNRTExGJsDIAEoBRIVCgxGSUVMRF9uYW1lMTIYnAMgASgFEhcKDl9f",
-            "ZmllbGRfbmFtZTEzGJ0DIAEoBRIXCg5fX0ZpZWxkX25hbWUxNBieAyABKAUS",
-            "FgoNZmllbGRfX25hbWUxNRifAyABKAUSFgoNZmllbGRfX05hbWUxNhigAyAB",
-            "KAUSFwoOZmllbGRfbmFtZTE3X18YoQMgASgFEhcKDkZpZWxkX25hbWUxOF9f",
-            "GKIDIAEoBRpiCg1OZXN0ZWRNZXNzYWdlEgkKAWEYASABKAUSRgoLY29yZWN1",
-            "cnNpdmUYAiABKAsyMS5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLnByb3RvMi5U",
-            "ZXN0QWxsVHlwZXNQcm90bzIaNAoSTWFwSW50MzJJbnQzMkVudHJ5EgsKA2tl",
-            "eRgBIAEoBRINCgV2YWx1ZRgCIAEoBToCOAEaNAoSTWFwSW50NjRJbnQ2NEVu",
-            "dHJ5EgsKA2tleRgBIAEoAxINCgV2YWx1ZRgCIAEoAzoCOAEaNgoUTWFwVWlu",
-            "dDMyVWludDMyRW50cnkSCwoDa2V5GAEgASgNEg0KBXZhbHVlGAIgASgNOgI4",
-            "ARo2ChRNYXBVaW50NjRVaW50NjRFbnRyeRILCgNrZXkYASABKAQSDQoFdmFs",
-            "dWUYAiABKAQ6AjgBGjYKFE1hcFNpbnQzMlNpbnQzMkVudHJ5EgsKA2tleRgB",
-            "IAEoERINCgV2YWx1ZRgCIAEoEToCOAEaNgoUTWFwU2ludDY0U2ludDY0RW50",
-            "cnkSCwoDa2V5GAEgASgSEg0KBXZhbHVlGAIgASgSOgI4ARo4ChZNYXBGaXhl",
-            "ZDMyRml4ZWQzMkVudHJ5EgsKA2tleRgBIAEoBxINCgV2YWx1ZRgCIAEoBzoC",
-            "OAEaOAoWTWFwRml4ZWQ2NEZpeGVkNjRFbnRyeRILCgNrZXkYASABKAYSDQoF",
-            "dmFsdWUYAiABKAY6AjgBGjoKGE1hcFNmaXhlZDMyU2ZpeGVkMzJFbnRyeRIL",
-            "CgNrZXkYASABKA8SDQoFdmFsdWUYAiABKA86AjgBGjoKGE1hcFNmaXhlZDY0",
-            "U2ZpeGVkNjRFbnRyeRILCgNrZXkYASABKBASDQoFdmFsdWUYAiABKBA6AjgB",
-            "GjQKEk1hcEludDMyRmxvYXRFbnRyeRILCgNrZXkYASABKAUSDQoFdmFsdWUY",
-            "AiABKAI6AjgBGjUKE01hcEludDMyRG91YmxlRW50cnkSCwoDa2V5GAEgASgF",
-            "Eg0KBXZhbHVlGAIgASgBOgI4ARoyChBNYXBCb29sQm9vbEVudHJ5EgsKA2tl",
-            "eRgBIAEoCBINCgV2YWx1ZRgCIAEoCDoCOAEaNgoUTWFwU3RyaW5nU3RyaW5n",
-            "RW50cnkSCwoDa2V5GAEgASgJEg0KBXZhbHVlGAIgASgJOgI4ARo1ChNNYXBT",
-            "dHJpbmdCeXRlc0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoDDoC",
-            "OAEafgobTWFwU3RyaW5nTmVzdGVkTWVzc2FnZUVudHJ5EgsKA2tleRgBIAEo",
-            "CRJOCgV2YWx1ZRgCIAEoCzI/LnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJv",
-            "dG8yLlRlc3RBbGxUeXBlc1Byb3RvMi5OZXN0ZWRNZXNzYWdlOgI4ARpzChxN",
-            "YXBTdHJpbmdGb3JlaWduTWVzc2FnZUVudHJ5EgsKA2tleRgBIAEoCRJCCgV2",
-            "YWx1ZRgCIAEoCzIzLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8yLkZv",
-            "cmVpZ25NZXNzYWdlUHJvdG8yOgI4ARp4ChhNYXBTdHJpbmdOZXN0ZWRFbnVt",
-            "RW50cnkSCwoDa2V5GAEgASgJEksKBXZhbHVlGAIgASgOMjwucHJvdG9idWZf",
-            "dGVzdF9tZXNzYWdlcy5wcm90bzIuVGVzdEFsbFR5cGVzUHJvdG8yLk5lc3Rl",
-            "ZEVudW06AjgBGm0KGU1hcFN0cmluZ0ZvcmVpZ25FbnVtRW50cnkSCwoDa2V5",
-            "GAEgASgJEj8KBXZhbHVlGAIgASgOMjAucHJvdG9idWZfdGVzdF9tZXNzYWdl",
-            "cy5wcm90bzIuRm9yZWlnbkVudW1Qcm90bzI6AjgBGjMKBERhdGESFAoLZ3Jv",
-            "dXBfaW50MzIYygEgASgFEhUKDGdyb3VwX3VpbnQzMhjLASABKA0aIQoRTWVz",
-            "c2FnZVNldENvcnJlY3QqCAgEEP////8HOgIIARrgAQobTWVzc2FnZVNldENv",
-            "cnJlY3RFeHRlbnNpb24xEgsKA3N0chgZIAEoCTKzAQoVbWVzc2FnZV9zZXRf",
-            "ZXh0ZW5zaW9uEkMucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzIuVGVz",
-            "dEFsbFR5cGVzUHJvdG8yLk1lc3NhZ2VTZXRDb3JyZWN0GPm7XiABKAsyTS5w",
-            "cm90b2J1Zl90ZXN0X21lc3NhZ2VzLnByb3RvMi5UZXN0QWxsVHlwZXNQcm90",
-            "bzIuTWVzc2FnZVNldENvcnJlY3RFeHRlbnNpb24xGt8BChtNZXNzYWdlU2V0",
-            "Q29ycmVjdEV4dGVuc2lvbjISCQoBaRgJIAEoBTK0AQoVbWVzc2FnZV9zZXRf",
-            "ZXh0ZW5zaW9uEkMucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzIuVGVz",
-            "dEFsbFR5cGVzUHJvdG8yLk1lc3NhZ2VTZXRDb3JyZWN0GJCz/AEgASgLMk0u",
-            "cHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzIuVGVzdEFsbFR5cGVzUHJv",
-            "dG8yLk1lc3NhZ2VTZXRDb3JyZWN0RXh0ZW5zaW9uMiI5CgpOZXN0ZWRFbnVt",
-            "EgcKA0ZPTxAAEgcKA0JBUhABEgcKA0JBWhACEhAKA05FRxD///////////8B",
-            "KgUIeBDJAUINCgtvbmVvZl9maWVsZEoGCOgHEJBOIiEKFEZvcmVpZ25NZXNz",
-            "YWdlUHJvdG8yEgkKAWMYASABKAUiwQIKFVVua25vd25Ub1Rlc3RBbGxUeXBl",
-            "cxIXCg5vcHRpb25hbF9pbnQzMhjpByABKAUSGAoPb3B0aW9uYWxfc3RyaW5n",
-            "GOoHIAEoCRJMCg5uZXN0ZWRfbWVzc2FnZRjrByABKAsyMy5wcm90b2J1Zl90",
-            "ZXN0X21lc3NhZ2VzLnByb3RvMi5Gb3JlaWduTWVzc2FnZVByb3RvMhJaCg1v",
-            "cHRpb25hbGdyb3VwGOwHIAEoCjJCLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMu",
-            "cHJvdG8yLlVua25vd25Ub1Rlc3RBbGxUeXBlcy5PcHRpb25hbEdyb3VwEhYK",
-            "DW9wdGlvbmFsX2Jvb2wY7gcgASgIEhcKDnJlcGVhdGVkX2ludDMyGPMHIAMo",
-            "BRoaCg1PcHRpb25hbEdyb3VwEgkKAWEYASABKAUiFgoUTnVsbEh5cG90aGVz",
-            "aXNQcm90bzIiLwoORW51bU9ubHlQcm90bzIiHQoEQm9vbBIKCgZrRmFsc2UQ",
-            "ABIJCgVrVHJ1ZRABKkYKEUZvcmVpZ25FbnVtUHJvdG8yEg8KC0ZPUkVJR05f",
-            "Rk9PEAASDwoLRk9SRUlHTl9CQVIQARIPCgtGT1JFSUdOX0JBWhACOkoKD2V4",
-            "dGVuc2lvbl9pbnQzMhIxLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8y",
-            "LlRlc3RBbGxUeXBlc1Byb3RvMhh4IAEoBUIvCihjb20uZ29vZ2xlLnByb3Rv",
-            "YnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8ySAH4AQE="));
+            "X21lc3NhZ2VzLnByb3RvMi5UZXN0QWxsVHlwZXNQcm90bzIuRGF0YRIiCg1k",
+            "ZWZhdWx0X2ludDMyGPEBIAEoBToKLTEyMzQ1Njc4ORIsCg1kZWZhdWx0X2lu",
+            "dDY0GPIBIAEoAzoULTkxMjM0NTY3ODkxMjM0NTY3ODkSIwoOZGVmYXVsdF91",
+            "aW50MzIY8wEgASgNOgoyMTIzNDU2Nzg5Ei0KDmRlZmF1bHRfdWludDY0GPQB",
+            "IAEoBDoUMTAxMjM0NTY3ODkxMjM0NTY3ODkSIwoOZGVmYXVsdF9zaW50MzIY",
+            "9QEgASgROgotMTIzNDU2Nzg5Ei0KDmRlZmF1bHRfc2ludDY0GPYBIAEoEjoU",
+            "LTkxMjM0NTY3ODkxMjM0NTY3ODkSJAoPZGVmYXVsdF9maXhlZDMyGPcBIAEo",
+            "BzoKMjEyMzQ1Njc4ORIuCg9kZWZhdWx0X2ZpeGVkNjQY+AEgASgGOhQxMDEy",
+            "MzQ1Njc4OTEyMzQ1Njc4ORIlChBkZWZhdWx0X3NmaXhlZDMyGPkBIAEoDzoK",
+            "LTEyMzQ1Njc4ORIvChBkZWZhdWx0X3NmaXhlZDY0GPoBIAEoEDoULTkxMjM0",
+            "NTY3ODkxMjM0NTY3ODkSHQoNZGVmYXVsdF9mbG9hdBj7ASABKAI6BTllKzA5",
+            "Eh4KDmRlZmF1bHRfZG91YmxlGPwBIAEoAToFN2UrMjISGwoMZGVmYXVsdF9i",
+            "b29sGP0BIAEoCDoEdHJ1ZRIgCg5kZWZhdWx0X3N0cmluZxj+ASABKAk6B1Jv",
+            "c2VidWQSEwoKZmllbGRuYW1lMRiRAyABKAUSFAoLZmllbGRfbmFtZTIYkgMg",
+            "ASgFEhUKDF9maWVsZF9uYW1lMxiTAyABKAUSFgoNZmllbGRfX25hbWU0XxiU",
+            "AyABKAUSFAoLZmllbGQwbmFtZTUYlQMgASgFEhYKDWZpZWxkXzBfbmFtZTYY",
+            "lgMgASgFEhMKCmZpZWxkTmFtZTcYlwMgASgFEhMKCkZpZWxkTmFtZTgYmAMg",
+            "ASgFEhQKC2ZpZWxkX05hbWU5GJkDIAEoBRIVCgxGaWVsZF9OYW1lMTAYmgMg",
+            "ASgFEhUKDEZJRUxEX05BTUUxMRibAyABKAUSFQoMRklFTERfbmFtZTEyGJwD",
+            "IAEoBRIXCg5fX2ZpZWxkX25hbWUxMxidAyABKAUSFwoOX19GaWVsZF9uYW1l",
+            "MTQYngMgASgFEhYKDWZpZWxkX19uYW1lMTUYnwMgASgFEhYKDWZpZWxkX19O",
+            "YW1lMTYYoAMgASgFEhcKDmZpZWxkX25hbWUxN19fGKEDIAEoBRIXCg5GaWVs",
+            "ZF9uYW1lMThfXxiiAyABKAUaYgoNTmVzdGVkTWVzc2FnZRIJCgFhGAEgASgF",
+            "EkYKC2NvcmVjdXJzaXZlGAIgASgLMjEucHJvdG9idWZfdGVzdF9tZXNzYWdl",
+            "cy5wcm90bzIuVGVzdEFsbFR5cGVzUHJvdG8yGjQKEk1hcEludDMySW50MzJF",
+            "bnRyeRILCgNrZXkYASABKAUSDQoFdmFsdWUYAiABKAU6AjgBGjQKEk1hcElu",
+            "dDY0SW50NjRFbnRyeRILCgNrZXkYASABKAMSDQoFdmFsdWUYAiABKAM6AjgB",
+            "GjYKFE1hcFVpbnQzMlVpbnQzMkVudHJ5EgsKA2tleRgBIAEoDRINCgV2YWx1",
+            "ZRgCIAEoDToCOAEaNgoUTWFwVWludDY0VWludDY0RW50cnkSCwoDa2V5GAEg",
+            "ASgEEg0KBXZhbHVlGAIgASgEOgI4ARo2ChRNYXBTaW50MzJTaW50MzJFbnRy",
+            "eRILCgNrZXkYASABKBESDQoFdmFsdWUYAiABKBE6AjgBGjYKFE1hcFNpbnQ2",
+            "NFNpbnQ2NEVudHJ5EgsKA2tleRgBIAEoEhINCgV2YWx1ZRgCIAEoEjoCOAEa",
+            "OAoWTWFwRml4ZWQzMkZpeGVkMzJFbnRyeRILCgNrZXkYASABKAcSDQoFdmFs",
+            "dWUYAiABKAc6AjgBGjgKFk1hcEZpeGVkNjRGaXhlZDY0RW50cnkSCwoDa2V5",
+            "GAEgASgGEg0KBXZhbHVlGAIgASgGOgI4ARo6ChhNYXBTZml4ZWQzMlNmaXhl",
+            "ZDMyRW50cnkSCwoDa2V5GAEgASgPEg0KBXZhbHVlGAIgASgPOgI4ARo6ChhN",
+            "YXBTZml4ZWQ2NFNmaXhlZDY0RW50cnkSCwoDa2V5GAEgASgQEg0KBXZhbHVl",
+            "GAIgASgQOgI4ARo0ChJNYXBJbnQzMkZsb2F0RW50cnkSCwoDa2V5GAEgASgF",
+            "Eg0KBXZhbHVlGAIgASgCOgI4ARo1ChNNYXBJbnQzMkRvdWJsZUVudHJ5EgsK",
+            "A2tleRgBIAEoBRINCgV2YWx1ZRgCIAEoAToCOAEaMgoQTWFwQm9vbEJvb2xF",
+            "bnRyeRILCgNrZXkYASABKAgSDQoFdmFsdWUYAiABKAg6AjgBGjYKFE1hcFN0",
+            "cmluZ1N0cmluZ0VudHJ5EgsKA2tleRgBIAEoCRINCgV2YWx1ZRgCIAEoCToC",
+            "OAEaNQoTTWFwU3RyaW5nQnl0ZXNFbnRyeRILCgNrZXkYASABKAkSDQoFdmFs",
+            "dWUYAiABKAw6AjgBGn4KG01hcFN0cmluZ05lc3RlZE1lc3NhZ2VFbnRyeRIL",
+            "CgNrZXkYASABKAkSTgoFdmFsdWUYAiABKAsyPy5wcm90b2J1Zl90ZXN0X21l",
+            "c3NhZ2VzLnByb3RvMi5UZXN0QWxsVHlwZXNQcm90bzIuTmVzdGVkTWVzc2Fn",
+            "ZToCOAEacwocTWFwU3RyaW5nRm9yZWlnbk1lc3NhZ2VFbnRyeRILCgNrZXkY",
+            "ASABKAkSQgoFdmFsdWUYAiABKAsyMy5wcm90b2J1Zl90ZXN0X21lc3NhZ2Vz",
+            "LnByb3RvMi5Gb3JlaWduTWVzc2FnZVByb3RvMjoCOAEaeAoYTWFwU3RyaW5n",
+            "TmVzdGVkRW51bUVudHJ5EgsKA2tleRgBIAEoCRJLCgV2YWx1ZRgCIAEoDjI8",
+            "LnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8yLlRlc3RBbGxUeXBlc1By",
+            "b3RvMi5OZXN0ZWRFbnVtOgI4ARptChlNYXBTdHJpbmdGb3JlaWduRW51bUVu",
+            "dHJ5EgsKA2tleRgBIAEoCRI/CgV2YWx1ZRgCIAEoDjIwLnByb3RvYnVmX3Rl",
+            "c3RfbWVzc2FnZXMucHJvdG8yLkZvcmVpZ25FbnVtUHJvdG8yOgI4ARozCgRE",
+            "YXRhEhQKC2dyb3VwX2ludDMyGMoBIAEoBRIVCgxncm91cF91aW50MzIYywEg",
+            "ASgNGiEKEU1lc3NhZ2VTZXRDb3JyZWN0KggIBBD/////BzoCCAEa4AEKG01l",
+            "c3NhZ2VTZXRDb3JyZWN0RXh0ZW5zaW9uMRILCgNzdHIYGSABKAkyswEKFW1l",
+            "c3NhZ2Vfc2V0X2V4dGVuc2lvbhJDLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMu",
+            "cHJvdG8yLlRlc3RBbGxUeXBlc1Byb3RvMi5NZXNzYWdlU2V0Q29ycmVjdBj5",
+            "u14gASgLMk0ucHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzIuVGVzdEFs",
+            "bFR5cGVzUHJvdG8yLk1lc3NhZ2VTZXRDb3JyZWN0RXh0ZW5zaW9uMRrfAQob",
+            "TWVzc2FnZVNldENvcnJlY3RFeHRlbnNpb24yEgkKAWkYCSABKAUytAEKFW1l",
+            "c3NhZ2Vfc2V0X2V4dGVuc2lvbhJDLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMu",
+            "cHJvdG8yLlRlc3RBbGxUeXBlc1Byb3RvMi5NZXNzYWdlU2V0Q29ycmVjdBiQ",
+            "s/wBIAEoCzJNLnByb3RvYnVmX3Rlc3RfbWVzc2FnZXMucHJvdG8yLlRlc3RB",
+            "bGxUeXBlc1Byb3RvMi5NZXNzYWdlU2V0Q29ycmVjdEV4dGVuc2lvbjIiOQoK",
+            "TmVzdGVkRW51bRIHCgNGT08QABIHCgNCQVIQARIHCgNCQVoQAhIQCgNORUcQ",
+            "////////////ASoFCHgQyQFCDQoLb25lb2ZfZmllbGRKBgjoBxCQTiIhChRG",
+            "b3JlaWduTWVzc2FnZVByb3RvMhIJCgFjGAEgASgFIsECChVVbmtub3duVG9U",
+            "ZXN0QWxsVHlwZXMSFwoOb3B0aW9uYWxfaW50MzIY6QcgASgFEhgKD29wdGlv",
+            "bmFsX3N0cmluZxjqByABKAkSTAoObmVzdGVkX21lc3NhZ2UY6wcgASgLMjMu",
+            "cHJvdG9idWZfdGVzdF9tZXNzYWdlcy5wcm90bzIuRm9yZWlnbk1lc3NhZ2VQ",
+            "cm90bzISWgoNb3B0aW9uYWxncm91cBjsByABKAoyQi5wcm90b2J1Zl90ZXN0",
+            "X21lc3NhZ2VzLnByb3RvMi5Vbmtub3duVG9UZXN0QWxsVHlwZXMuT3B0aW9u",
+            "YWxHcm91cBIWCg1vcHRpb25hbF9ib29sGO4HIAEoCBIXCg5yZXBlYXRlZF9p",
+            "bnQzMhjzByADKAUaGgoNT3B0aW9uYWxHcm91cBIJCgFhGAEgASgFIhYKFE51",
+            "bGxIeXBvdGhlc2lzUHJvdG8yIi8KDkVudW1Pbmx5UHJvdG8yIh0KBEJvb2wS",
+            "CgoGa0ZhbHNlEAASCQoFa1RydWUQASpGChFGb3JlaWduRW51bVByb3RvMhIP",
+            "CgtGT1JFSUdOX0ZPTxAAEg8KC0ZPUkVJR05fQkFSEAESDwoLRk9SRUlHTl9C",
+            "QVoQAjpKCg9leHRlbnNpb25faW50MzISMS5wcm90b2J1Zl90ZXN0X21lc3Nh",
+            "Z2VzLnByb3RvMi5UZXN0QWxsVHlwZXNQcm90bzIYeCABKAVCLwooY29tLmdv",
+            "b2dsZS5wcm90b2J1Zl90ZXN0X21lc3NhZ2VzLnByb3RvMkgB+AEB"));
       descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData,
           new pbr::FileDescriptor[] { },
           new pbr::GeneratedClrTypeInfo(new[] {typeof(global::ProtobufTestMessages.Proto2.ForeignEnumProto2), }, new pb::Extension[] { TestMessagesProto2Extensions.ExtensionInt32 }, new pbr::GeneratedClrTypeInfo[] {
-            new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Parser, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalStringPiece", "OptionalCord", "RecursiveMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedStringPiece", "RepeatedCord", "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedNestedEnum", "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedNestedEnum", "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapStringBytes", "MapStringNestedMessage", "MapStringForeignMessage", "MapStringNestedEnum", "MapStringForeignEnum", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes", "OneofBool", "OneofUint64", "OneofFloat", "OneofDouble", "OneofEnum", "Data", "Fieldname1", "FieldName2", "FieldName3", "FieldName4", "Field0Name5", "Field0Name6", "FieldName7", "FieldName8", "FieldName9", "FieldName10", "FIELDNAME11", "FIELDName12", "FieldName13", "FieldName14", "FieldName15", "FieldName16", "FieldName17", "FieldName18" }, new[]{ "OneofField" }, new[]{ typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedEnum) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage.Parser, new[]{ "A", "Corecursive" }, null, null, null, null),
+            new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Parser, new[]{ "OptionalInt32", "OptionalInt64", "OptionalUint32", "OptionalUint64", "OptionalSint32", "OptionalSint64", "OptionalFixed32", "OptionalFixed64", "OptionalSfixed32", "OptionalSfixed64", "OptionalFloat", "OptionalDouble", "OptionalBool", "OptionalString", "OptionalBytes", "OptionalNestedMessage", "OptionalForeignMessage", "OptionalNestedEnum", "OptionalForeignEnum", "OptionalStringPiece", "OptionalCord", "RecursiveMessage", "RepeatedInt32", "RepeatedInt64", "RepeatedUint32", "RepeatedUint64", "RepeatedSint32", "RepeatedSint64", "RepeatedFixed32", "RepeatedFixed64", "RepeatedSfixed32", "RepeatedSfixed64", "RepeatedFloat", "RepeatedDouble", "RepeatedBool", "RepeatedString", "RepeatedBytes", "RepeatedNestedMessage", "RepeatedForeignMessage", "RepeatedNestedEnum", "RepeatedForeignEnum", "RepeatedStringPiece", "RepeatedCord", "PackedInt32", "PackedInt64", "PackedUint32", "PackedUint64", "PackedSint32", "PackedSint64", "PackedFixed32", "PackedFixed64", "PackedSfixed32", "PackedSfixed64", "PackedFloat", "PackedDouble", "PackedBool", "PackedNestedEnum", "UnpackedInt32", "UnpackedInt64", "UnpackedUint32", "UnpackedUint64", "UnpackedSint32", "UnpackedSint64", "UnpackedFixed32", "UnpackedFixed64", "UnpackedSfixed32", "UnpackedSfixed64", "UnpackedFloat", "UnpackedDouble", "UnpackedBool", "UnpackedNestedEnum", "MapInt32Int32", "MapInt64Int64", "MapUint32Uint32", "MapUint64Uint64", "MapSint32Sint32", "MapSint64Sint64", "MapFixed32Fixed32", "MapFixed64Fixed64", "MapSfixed32Sfixed32", "MapSfixed64Sfixed64", "MapInt32Float", "MapInt32Double", "MapBoolBool", "MapStringString", "MapStringBytes", "MapStringNestedMessage", "MapStringForeignMessage", "MapStringNestedEnum", "MapStringForeignEnum", "OneofUint32", "OneofNestedMessage", "OneofString", "OneofBytes", "OneofBool", "OneofUint64", "OneofFloat", "OneofDouble", "OneofEnum", "Data", "DefaultInt32", "DefaultInt64", "DefaultUint32", "DefaultUint64", "DefaultSint32", "DefaultSint64", "DefaultFixed32", "DefaultFixed64", "DefaultSfixed32", "DefaultSfixed64", "DefaultFloat", "DefaultDouble", "DefaultBool", "DefaultString", "Fieldname1", "FieldName2", "FieldName3", "FieldName4", "Field0Name5", "Field0Name6", "FieldName7", "FieldName8", "FieldName9", "FieldName10", "FIELDNAME11", "FIELDName12", "FieldName13", "FieldName14", "FieldName15", "FieldName16", "FieldName17", "FieldName18" }, new[]{ "OneofField" }, new[]{ typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedEnum) }, null, new pbr::GeneratedClrTypeInfo[] { new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.NestedMessage.Parser, new[]{ "A", "Corecursive" }, null, null, null, null),
             null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.Data), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.Data.Parser, new[]{ "GroupInt32", "GroupUint32" }, null, null, null, null),
             new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrect), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrect.Parser, null, null, null, null, null),
             new pbr::GeneratedClrTypeInfo(typeof(global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrectExtension1), global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrectExtension1.Parser, new[]{ "Str" }, null, null, new pb::Extension[] { global::ProtobufTestMessages.Proto2.TestAllTypesProto2.Types.MessageSetCorrectExtension1.Extensions.MessageSetExtension }, null),
@@ -378,6 +390,20 @@
       mapStringNestedEnum_ = other.mapStringNestedEnum_.Clone();
       mapStringForeignEnum_ = other.mapStringForeignEnum_.Clone();
       data_ = other.HasData ? other.data_.Clone() : null;
+      defaultInt32_ = other.defaultInt32_;
+      defaultInt64_ = other.defaultInt64_;
+      defaultUint32_ = other.defaultUint32_;
+      defaultUint64_ = other.defaultUint64_;
+      defaultSint32_ = other.defaultSint32_;
+      defaultSint64_ = other.defaultSint64_;
+      defaultFixed32_ = other.defaultFixed32_;
+      defaultFixed64_ = other.defaultFixed64_;
+      defaultSfixed32_ = other.defaultSfixed32_;
+      defaultSfixed64_ = other.defaultSfixed64_;
+      defaultFloat_ = other.defaultFloat_;
+      defaultDouble_ = other.defaultDouble_;
+      defaultBool_ = other.defaultBool_;
+      defaultString_ = other.defaultString_;
       fieldname1_ = other.fieldname1_;
       fieldName2_ = other.fieldName2_;
       FieldName3_ = other.FieldName3_;
@@ -1988,6 +2014,386 @@
       data_ = null;
     }
 
+    /// <summary>Field number for the "default_int32" field.</summary>
+    public const int DefaultInt32FieldNumber = 241;
+    private readonly static int DefaultInt32DefaultValue = -123456789;
+
+    private int defaultInt32_;
+    /// <summary>
+    /// default values
+    /// </summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public int DefaultInt32 {
+      get { if ((_hasBits0 & 32768) != 0) { return defaultInt32_; } else { return DefaultInt32DefaultValue; } }
+      set {
+        _hasBits0 |= 32768;
+        defaultInt32_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_int32" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultInt32 {
+      get { return (_hasBits0 & 32768) != 0; }
+    }
+    /// <summary>Clears the value of the "default_int32" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultInt32() {
+      _hasBits0 &= ~32768;
+    }
+
+    /// <summary>Field number for the "default_int64" field.</summary>
+    public const int DefaultInt64FieldNumber = 242;
+    private readonly static long DefaultInt64DefaultValue = -9123456789123456789L;
+
+    private long defaultInt64_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public long DefaultInt64 {
+      get { if ((_hasBits0 & 65536) != 0) { return defaultInt64_; } else { return DefaultInt64DefaultValue; } }
+      set {
+        _hasBits0 |= 65536;
+        defaultInt64_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_int64" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultInt64 {
+      get { return (_hasBits0 & 65536) != 0; }
+    }
+    /// <summary>Clears the value of the "default_int64" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultInt64() {
+      _hasBits0 &= ~65536;
+    }
+
+    /// <summary>Field number for the "default_uint32" field.</summary>
+    public const int DefaultUint32FieldNumber = 243;
+    private readonly static uint DefaultUint32DefaultValue = 2123456789;
+
+    private uint defaultUint32_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public uint DefaultUint32 {
+      get { if ((_hasBits0 & 131072) != 0) { return defaultUint32_; } else { return DefaultUint32DefaultValue; } }
+      set {
+        _hasBits0 |= 131072;
+        defaultUint32_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_uint32" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultUint32 {
+      get { return (_hasBits0 & 131072) != 0; }
+    }
+    /// <summary>Clears the value of the "default_uint32" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultUint32() {
+      _hasBits0 &= ~131072;
+    }
+
+    /// <summary>Field number for the "default_uint64" field.</summary>
+    public const int DefaultUint64FieldNumber = 244;
+    private readonly static ulong DefaultUint64DefaultValue = 10123456789123456789UL;
+
+    private ulong defaultUint64_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public ulong DefaultUint64 {
+      get { if ((_hasBits0 & 262144) != 0) { return defaultUint64_; } else { return DefaultUint64DefaultValue; } }
+      set {
+        _hasBits0 |= 262144;
+        defaultUint64_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_uint64" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultUint64 {
+      get { return (_hasBits0 & 262144) != 0; }
+    }
+    /// <summary>Clears the value of the "default_uint64" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultUint64() {
+      _hasBits0 &= ~262144;
+    }
+
+    /// <summary>Field number for the "default_sint32" field.</summary>
+    public const int DefaultSint32FieldNumber = 245;
+    private readonly static int DefaultSint32DefaultValue = -123456789;
+
+    private int defaultSint32_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public int DefaultSint32 {
+      get { if ((_hasBits0 & 524288) != 0) { return defaultSint32_; } else { return DefaultSint32DefaultValue; } }
+      set {
+        _hasBits0 |= 524288;
+        defaultSint32_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_sint32" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultSint32 {
+      get { return (_hasBits0 & 524288) != 0; }
+    }
+    /// <summary>Clears the value of the "default_sint32" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultSint32() {
+      _hasBits0 &= ~524288;
+    }
+
+    /// <summary>Field number for the "default_sint64" field.</summary>
+    public const int DefaultSint64FieldNumber = 246;
+    private readonly static long DefaultSint64DefaultValue = -9123456789123456789L;
+
+    private long defaultSint64_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public long DefaultSint64 {
+      get { if ((_hasBits0 & 1048576) != 0) { return defaultSint64_; } else { return DefaultSint64DefaultValue; } }
+      set {
+        _hasBits0 |= 1048576;
+        defaultSint64_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_sint64" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultSint64 {
+      get { return (_hasBits0 & 1048576) != 0; }
+    }
+    /// <summary>Clears the value of the "default_sint64" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultSint64() {
+      _hasBits0 &= ~1048576;
+    }
+
+    /// <summary>Field number for the "default_fixed32" field.</summary>
+    public const int DefaultFixed32FieldNumber = 247;
+    private readonly static uint DefaultFixed32DefaultValue = 2123456789;
+
+    private uint defaultFixed32_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public uint DefaultFixed32 {
+      get { if ((_hasBits0 & 2097152) != 0) { return defaultFixed32_; } else { return DefaultFixed32DefaultValue; } }
+      set {
+        _hasBits0 |= 2097152;
+        defaultFixed32_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_fixed32" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultFixed32 {
+      get { return (_hasBits0 & 2097152) != 0; }
+    }
+    /// <summary>Clears the value of the "default_fixed32" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultFixed32() {
+      _hasBits0 &= ~2097152;
+    }
+
+    /// <summary>Field number for the "default_fixed64" field.</summary>
+    public const int DefaultFixed64FieldNumber = 248;
+    private readonly static ulong DefaultFixed64DefaultValue = 10123456789123456789UL;
+
+    private ulong defaultFixed64_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public ulong DefaultFixed64 {
+      get { if ((_hasBits0 & 4194304) != 0) { return defaultFixed64_; } else { return DefaultFixed64DefaultValue; } }
+      set {
+        _hasBits0 |= 4194304;
+        defaultFixed64_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_fixed64" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultFixed64 {
+      get { return (_hasBits0 & 4194304) != 0; }
+    }
+    /// <summary>Clears the value of the "default_fixed64" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultFixed64() {
+      _hasBits0 &= ~4194304;
+    }
+
+    /// <summary>Field number for the "default_sfixed32" field.</summary>
+    public const int DefaultSfixed32FieldNumber = 249;
+    private readonly static int DefaultSfixed32DefaultValue = -123456789;
+
+    private int defaultSfixed32_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public int DefaultSfixed32 {
+      get { if ((_hasBits0 & 8388608) != 0) { return defaultSfixed32_; } else { return DefaultSfixed32DefaultValue; } }
+      set {
+        _hasBits0 |= 8388608;
+        defaultSfixed32_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_sfixed32" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultSfixed32 {
+      get { return (_hasBits0 & 8388608) != 0; }
+    }
+    /// <summary>Clears the value of the "default_sfixed32" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultSfixed32() {
+      _hasBits0 &= ~8388608;
+    }
+
+    /// <summary>Field number for the "default_sfixed64" field.</summary>
+    public const int DefaultSfixed64FieldNumber = 250;
+    private readonly static long DefaultSfixed64DefaultValue = -9123456789123456789L;
+
+    private long defaultSfixed64_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public long DefaultSfixed64 {
+      get { if ((_hasBits0 & 16777216) != 0) { return defaultSfixed64_; } else { return DefaultSfixed64DefaultValue; } }
+      set {
+        _hasBits0 |= 16777216;
+        defaultSfixed64_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_sfixed64" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultSfixed64 {
+      get { return (_hasBits0 & 16777216) != 0; }
+    }
+    /// <summary>Clears the value of the "default_sfixed64" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultSfixed64() {
+      _hasBits0 &= ~16777216;
+    }
+
+    /// <summary>Field number for the "default_float" field.</summary>
+    public const int DefaultFloatFieldNumber = 251;
+    private readonly static float DefaultFloatDefaultValue = 9e+09F;
+
+    private float defaultFloat_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public float DefaultFloat {
+      get { if ((_hasBits0 & 33554432) != 0) { return defaultFloat_; } else { return DefaultFloatDefaultValue; } }
+      set {
+        _hasBits0 |= 33554432;
+        defaultFloat_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_float" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultFloat {
+      get { return (_hasBits0 & 33554432) != 0; }
+    }
+    /// <summary>Clears the value of the "default_float" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultFloat() {
+      _hasBits0 &= ~33554432;
+    }
+
+    /// <summary>Field number for the "default_double" field.</summary>
+    public const int DefaultDoubleFieldNumber = 252;
+    private readonly static double DefaultDoubleDefaultValue = 7e+22D;
+
+    private double defaultDouble_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public double DefaultDouble {
+      get { if ((_hasBits0 & 67108864) != 0) { return defaultDouble_; } else { return DefaultDoubleDefaultValue; } }
+      set {
+        _hasBits0 |= 67108864;
+        defaultDouble_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_double" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultDouble {
+      get { return (_hasBits0 & 67108864) != 0; }
+    }
+    /// <summary>Clears the value of the "default_double" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultDouble() {
+      _hasBits0 &= ~67108864;
+    }
+
+    /// <summary>Field number for the "default_bool" field.</summary>
+    public const int DefaultBoolFieldNumber = 253;
+    private readonly static bool DefaultBoolDefaultValue = true;
+
+    private bool defaultBool_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool DefaultBool {
+      get { if ((_hasBits0 & 134217728) != 0) { return defaultBool_; } else { return DefaultBoolDefaultValue; } }
+      set {
+        _hasBits0 |= 134217728;
+        defaultBool_ = value;
+      }
+    }
+    /// <summary>Gets whether the "default_bool" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultBool {
+      get { return (_hasBits0 & 134217728) != 0; }
+    }
+    /// <summary>Clears the value of the "default_bool" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultBool() {
+      _hasBits0 &= ~134217728;
+    }
+
+    /// <summary>Field number for the "default_string" field.</summary>
+    public const int DefaultStringFieldNumber = 254;
+    private readonly static string DefaultStringDefaultValue = global::System.Text.Encoding.UTF8.GetString(global::System.Convert.FromBase64String("Um9zZWJ1ZA=="), 0, 7);
+
+    private string defaultString_;
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public string DefaultString {
+      get { return defaultString_ ?? DefaultStringDefaultValue; }
+      set {
+        defaultString_ = pb::ProtoPreconditions.CheckNotNull(value, "value");
+      }
+    }
+    /// <summary>Gets whether the "default_string" field is set</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public bool HasDefaultString {
+      get { return defaultString_ != null; }
+    }
+    /// <summary>Clears the value of the "default_string" field</summary>
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
+    [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
+    public void ClearDefaultString() {
+      defaultString_ = null;
+    }
+
     /// <summary>Field number for the "fieldname1" field.</summary>
     public const int Fieldname1FieldNumber = 401;
     private readonly static int Fieldname1DefaultValue = 0;
@@ -2000,9 +2406,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int Fieldname1 {
-      get { if ((_hasBits0 & 32768) != 0) { return fieldname1_; } else { return Fieldname1DefaultValue; } }
+      get { if ((_hasBits0 & 268435456) != 0) { return fieldname1_; } else { return Fieldname1DefaultValue; } }
       set {
-        _hasBits0 |= 32768;
+        _hasBits0 |= 268435456;
         fieldname1_ = value;
       }
     }
@@ -2010,13 +2416,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldname1 {
-      get { return (_hasBits0 & 32768) != 0; }
+      get { return (_hasBits0 & 268435456) != 0; }
     }
     /// <summary>Clears the value of the "fieldname1" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldname1() {
-      _hasBits0 &= ~32768;
+      _hasBits0 &= ~268435456;
     }
 
     /// <summary>Field number for the "field_name2" field.</summary>
@@ -2027,9 +2433,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName2 {
-      get { if ((_hasBits0 & 65536) != 0) { return fieldName2_; } else { return FieldName2DefaultValue; } }
+      get { if ((_hasBits0 & 536870912) != 0) { return fieldName2_; } else { return FieldName2DefaultValue; } }
       set {
-        _hasBits0 |= 65536;
+        _hasBits0 |= 536870912;
         fieldName2_ = value;
       }
     }
@@ -2037,13 +2443,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName2 {
-      get { return (_hasBits0 & 65536) != 0; }
+      get { return (_hasBits0 & 536870912) != 0; }
     }
     /// <summary>Clears the value of the "field_name2" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName2() {
-      _hasBits0 &= ~65536;
+      _hasBits0 &= ~536870912;
     }
 
     /// <summary>Field number for the "_field_name3" field.</summary>
@@ -2054,9 +2460,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName3 {
-      get { if ((_hasBits0 & 131072) != 0) { return FieldName3_; } else { return FieldName3DefaultValue; } }
+      get { if ((_hasBits0 & 1073741824) != 0) { return FieldName3_; } else { return FieldName3DefaultValue; } }
       set {
-        _hasBits0 |= 131072;
+        _hasBits0 |= 1073741824;
         FieldName3_ = value;
       }
     }
@@ -2064,13 +2470,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName3 {
-      get { return (_hasBits0 & 131072) != 0; }
+      get { return (_hasBits0 & 1073741824) != 0; }
     }
     /// <summary>Clears the value of the "_field_name3" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName3() {
-      _hasBits0 &= ~131072;
+      _hasBits0 &= ~1073741824;
     }
 
     /// <summary>Field number for the "field__name4_" field.</summary>
@@ -2081,9 +2487,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName4 {
-      get { if ((_hasBits0 & 262144) != 0) { return fieldName4_; } else { return FieldName4DefaultValue; } }
+      get { if ((_hasBits0 & -2147483648) != 0) { return fieldName4_; } else { return FieldName4DefaultValue; } }
       set {
-        _hasBits0 |= 262144;
+        _hasBits0 |= -2147483648;
         fieldName4_ = value;
       }
     }
@@ -2091,13 +2497,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName4 {
-      get { return (_hasBits0 & 262144) != 0; }
+      get { return (_hasBits0 & -2147483648) != 0; }
     }
     /// <summary>Clears the value of the "field__name4_" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName4() {
-      _hasBits0 &= ~262144;
+      _hasBits0 &= ~-2147483648;
     }
 
     /// <summary>Field number for the "field0name5" field.</summary>
@@ -2108,9 +2514,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int Field0Name5 {
-      get { if ((_hasBits0 & 524288) != 0) { return field0Name5_; } else { return Field0Name5DefaultValue; } }
+      get { if ((_hasBits1 & 1) != 0) { return field0Name5_; } else { return Field0Name5DefaultValue; } }
       set {
-        _hasBits0 |= 524288;
+        _hasBits1 |= 1;
         field0Name5_ = value;
       }
     }
@@ -2118,13 +2524,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasField0Name5 {
-      get { return (_hasBits0 & 524288) != 0; }
+      get { return (_hasBits1 & 1) != 0; }
     }
     /// <summary>Clears the value of the "field0name5" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearField0Name5() {
-      _hasBits0 &= ~524288;
+      _hasBits1 &= ~1;
     }
 
     /// <summary>Field number for the "field_0_name6" field.</summary>
@@ -2135,9 +2541,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int Field0Name6 {
-      get { if ((_hasBits0 & 1048576) != 0) { return field0Name6_; } else { return Field0Name6DefaultValue; } }
+      get { if ((_hasBits1 & 2) != 0) { return field0Name6_; } else { return Field0Name6DefaultValue; } }
       set {
-        _hasBits0 |= 1048576;
+        _hasBits1 |= 2;
         field0Name6_ = value;
       }
     }
@@ -2145,13 +2551,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasField0Name6 {
-      get { return (_hasBits0 & 1048576) != 0; }
+      get { return (_hasBits1 & 2) != 0; }
     }
     /// <summary>Clears the value of the "field_0_name6" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearField0Name6() {
-      _hasBits0 &= ~1048576;
+      _hasBits1 &= ~2;
     }
 
     /// <summary>Field number for the "fieldName7" field.</summary>
@@ -2162,9 +2568,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName7 {
-      get { if ((_hasBits0 & 2097152) != 0) { return fieldName7_; } else { return FieldName7DefaultValue; } }
+      get { if ((_hasBits1 & 4) != 0) { return fieldName7_; } else { return FieldName7DefaultValue; } }
       set {
-        _hasBits0 |= 2097152;
+        _hasBits1 |= 4;
         fieldName7_ = value;
       }
     }
@@ -2172,13 +2578,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName7 {
-      get { return (_hasBits0 & 2097152) != 0; }
+      get { return (_hasBits1 & 4) != 0; }
     }
     /// <summary>Clears the value of the "fieldName7" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName7() {
-      _hasBits0 &= ~2097152;
+      _hasBits1 &= ~4;
     }
 
     /// <summary>Field number for the "FieldName8" field.</summary>
@@ -2189,9 +2595,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName8 {
-      get { if ((_hasBits0 & 4194304) != 0) { return fieldName8_; } else { return FieldName8DefaultValue; } }
+      get { if ((_hasBits1 & 8) != 0) { return fieldName8_; } else { return FieldName8DefaultValue; } }
       set {
-        _hasBits0 |= 4194304;
+        _hasBits1 |= 8;
         fieldName8_ = value;
       }
     }
@@ -2199,13 +2605,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName8 {
-      get { return (_hasBits0 & 4194304) != 0; }
+      get { return (_hasBits1 & 8) != 0; }
     }
     /// <summary>Clears the value of the "FieldName8" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName8() {
-      _hasBits0 &= ~4194304;
+      _hasBits1 &= ~8;
     }
 
     /// <summary>Field number for the "field_Name9" field.</summary>
@@ -2216,9 +2622,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName9 {
-      get { if ((_hasBits0 & 8388608) != 0) { return fieldName9_; } else { return FieldName9DefaultValue; } }
+      get { if ((_hasBits1 & 16) != 0) { return fieldName9_; } else { return FieldName9DefaultValue; } }
       set {
-        _hasBits0 |= 8388608;
+        _hasBits1 |= 16;
         fieldName9_ = value;
       }
     }
@@ -2226,13 +2632,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName9 {
-      get { return (_hasBits0 & 8388608) != 0; }
+      get { return (_hasBits1 & 16) != 0; }
     }
     /// <summary>Clears the value of the "field_Name9" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName9() {
-      _hasBits0 &= ~8388608;
+      _hasBits1 &= ~16;
     }
 
     /// <summary>Field number for the "Field_Name10" field.</summary>
@@ -2243,9 +2649,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName10 {
-      get { if ((_hasBits0 & 16777216) != 0) { return fieldName10_; } else { return FieldName10DefaultValue; } }
+      get { if ((_hasBits1 & 32) != 0) { return fieldName10_; } else { return FieldName10DefaultValue; } }
       set {
-        _hasBits0 |= 16777216;
+        _hasBits1 |= 32;
         fieldName10_ = value;
       }
     }
@@ -2253,13 +2659,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName10 {
-      get { return (_hasBits0 & 16777216) != 0; }
+      get { return (_hasBits1 & 32) != 0; }
     }
     /// <summary>Clears the value of the "Field_Name10" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName10() {
-      _hasBits0 &= ~16777216;
+      _hasBits1 &= ~32;
     }
 
     /// <summary>Field number for the "FIELD_NAME11" field.</summary>
@@ -2270,9 +2676,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FIELDNAME11 {
-      get { if ((_hasBits0 & 33554432) != 0) { return fIELDNAME11_; } else { return FIELDNAME11DefaultValue; } }
+      get { if ((_hasBits1 & 64) != 0) { return fIELDNAME11_; } else { return FIELDNAME11DefaultValue; } }
       set {
-        _hasBits0 |= 33554432;
+        _hasBits1 |= 64;
         fIELDNAME11_ = value;
       }
     }
@@ -2280,13 +2686,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFIELDNAME11 {
-      get { return (_hasBits0 & 33554432) != 0; }
+      get { return (_hasBits1 & 64) != 0; }
     }
     /// <summary>Clears the value of the "FIELD_NAME11" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFIELDNAME11() {
-      _hasBits0 &= ~33554432;
+      _hasBits1 &= ~64;
     }
 
     /// <summary>Field number for the "FIELD_name12" field.</summary>
@@ -2297,9 +2703,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FIELDName12 {
-      get { if ((_hasBits0 & 67108864) != 0) { return fIELDName12_; } else { return FIELDName12DefaultValue; } }
+      get { if ((_hasBits1 & 128) != 0) { return fIELDName12_; } else { return FIELDName12DefaultValue; } }
       set {
-        _hasBits0 |= 67108864;
+        _hasBits1 |= 128;
         fIELDName12_ = value;
       }
     }
@@ -2307,13 +2713,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFIELDName12 {
-      get { return (_hasBits0 & 67108864) != 0; }
+      get { return (_hasBits1 & 128) != 0; }
     }
     /// <summary>Clears the value of the "FIELD_name12" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFIELDName12() {
-      _hasBits0 &= ~67108864;
+      _hasBits1 &= ~128;
     }
 
     /// <summary>Field number for the "__field_name13" field.</summary>
@@ -2324,9 +2730,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName13 {
-      get { if ((_hasBits0 & 134217728) != 0) { return FieldName13_; } else { return FieldName13DefaultValue; } }
+      get { if ((_hasBits1 & 256) != 0) { return FieldName13_; } else { return FieldName13DefaultValue; } }
       set {
-        _hasBits0 |= 134217728;
+        _hasBits1 |= 256;
         FieldName13_ = value;
       }
     }
@@ -2334,13 +2740,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName13 {
-      get { return (_hasBits0 & 134217728) != 0; }
+      get { return (_hasBits1 & 256) != 0; }
     }
     /// <summary>Clears the value of the "__field_name13" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName13() {
-      _hasBits0 &= ~134217728;
+      _hasBits1 &= ~256;
     }
 
     /// <summary>Field number for the "__Field_name14" field.</summary>
@@ -2351,9 +2757,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName14 {
-      get { if ((_hasBits0 & 268435456) != 0) { return FieldName14_; } else { return FieldName14DefaultValue; } }
+      get { if ((_hasBits1 & 512) != 0) { return FieldName14_; } else { return FieldName14DefaultValue; } }
       set {
-        _hasBits0 |= 268435456;
+        _hasBits1 |= 512;
         FieldName14_ = value;
       }
     }
@@ -2361,13 +2767,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName14 {
-      get { return (_hasBits0 & 268435456) != 0; }
+      get { return (_hasBits1 & 512) != 0; }
     }
     /// <summary>Clears the value of the "__Field_name14" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName14() {
-      _hasBits0 &= ~268435456;
+      _hasBits1 &= ~512;
     }
 
     /// <summary>Field number for the "field__name15" field.</summary>
@@ -2378,9 +2784,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName15 {
-      get { if ((_hasBits0 & 536870912) != 0) { return fieldName15_; } else { return FieldName15DefaultValue; } }
+      get { if ((_hasBits1 & 1024) != 0) { return fieldName15_; } else { return FieldName15DefaultValue; } }
       set {
-        _hasBits0 |= 536870912;
+        _hasBits1 |= 1024;
         fieldName15_ = value;
       }
     }
@@ -2388,13 +2794,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName15 {
-      get { return (_hasBits0 & 536870912) != 0; }
+      get { return (_hasBits1 & 1024) != 0; }
     }
     /// <summary>Clears the value of the "field__name15" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName15() {
-      _hasBits0 &= ~536870912;
+      _hasBits1 &= ~1024;
     }
 
     /// <summary>Field number for the "field__Name16" field.</summary>
@@ -2405,9 +2811,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName16 {
-      get { if ((_hasBits0 & 1073741824) != 0) { return fieldName16_; } else { return FieldName16DefaultValue; } }
+      get { if ((_hasBits1 & 2048) != 0) { return fieldName16_; } else { return FieldName16DefaultValue; } }
       set {
-        _hasBits0 |= 1073741824;
+        _hasBits1 |= 2048;
         fieldName16_ = value;
       }
     }
@@ -2415,13 +2821,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName16 {
-      get { return (_hasBits0 & 1073741824) != 0; }
+      get { return (_hasBits1 & 2048) != 0; }
     }
     /// <summary>Clears the value of the "field__Name16" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName16() {
-      _hasBits0 &= ~1073741824;
+      _hasBits1 &= ~2048;
     }
 
     /// <summary>Field number for the "field_name17__" field.</summary>
@@ -2432,9 +2838,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName17 {
-      get { if ((_hasBits0 & -2147483648) != 0) { return fieldName17_; } else { return FieldName17DefaultValue; } }
+      get { if ((_hasBits1 & 4096) != 0) { return fieldName17_; } else { return FieldName17DefaultValue; } }
       set {
-        _hasBits0 |= -2147483648;
+        _hasBits1 |= 4096;
         fieldName17_ = value;
       }
     }
@@ -2442,13 +2848,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName17 {
-      get { return (_hasBits0 & -2147483648) != 0; }
+      get { return (_hasBits1 & 4096) != 0; }
     }
     /// <summary>Clears the value of the "field_name17__" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName17() {
-      _hasBits0 &= ~-2147483648;
+      _hasBits1 &= ~4096;
     }
 
     /// <summary>Field number for the "Field_name18__" field.</summary>
@@ -2459,9 +2865,9 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public int FieldName18 {
-      get { if ((_hasBits1 & 1) != 0) { return fieldName18_; } else { return FieldName18DefaultValue; } }
+      get { if ((_hasBits1 & 8192) != 0) { return fieldName18_; } else { return FieldName18DefaultValue; } }
       set {
-        _hasBits1 |= 1;
+        _hasBits1 |= 8192;
         fieldName18_ = value;
       }
     }
@@ -2469,13 +2875,13 @@
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public bool HasFieldName18 {
-      get { return (_hasBits1 & 1) != 0; }
+      get { return (_hasBits1 & 8192) != 0; }
     }
     /// <summary>Clears the value of the "Field_name18__" field</summary>
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute]
     [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)]
     public void ClearFieldName18() {
-      _hasBits1 &= ~1;
+      _hasBits1 &= ~8192;
     }
 
     private object oneofField_;
@@ -2621,6 +3027,20 @@
       if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(OneofDouble, other.OneofDouble)) return false;
       if (OneofEnum != other.OneofEnum) return false;
       if (!object.Equals(Data, other.Data)) return false;
+      if (DefaultInt32 != other.DefaultInt32) return false;
+      if (DefaultInt64 != other.DefaultInt64) return false;
+      if (DefaultUint32 != other.DefaultUint32) return false;
+      if (DefaultUint64 != other.DefaultUint64) return false;
+      if (DefaultSint32 != other.DefaultSint32) return false;
+      if (DefaultSint64 != other.DefaultSint64) return false;
+      if (DefaultFixed32 != other.DefaultFixed32) return false;
+      if (DefaultFixed64 != other.DefaultFixed64) return false;
+      if (DefaultSfixed32 != other.DefaultSfixed32) return false;
+      if (DefaultSfixed64 != other.DefaultSfixed64) return false;
+      if (!pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.Equals(DefaultFloat, other.DefaultFloat)) return false;
+      if (!pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.Equals(DefaultDouble, other.DefaultDouble)) return false;
+      if (DefaultBool != other.DefaultBool) return false;
+      if (DefaultString != other.DefaultString) return false;
       if (Fieldname1 != other.Fieldname1) return false;
       if (FieldName2 != other.FieldName2) return false;
       if (FieldName3 != other.FieldName3) return false;
@@ -2750,6 +3170,20 @@
       if (HasOneofDouble) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(OneofDouble);
       if (HasOneofEnum) hash ^= OneofEnum.GetHashCode();
       if (HasData) hash ^= Data.GetHashCode();
+      if (HasDefaultInt32) hash ^= DefaultInt32.GetHashCode();
+      if (HasDefaultInt64) hash ^= DefaultInt64.GetHashCode();
+      if (HasDefaultUint32) hash ^= DefaultUint32.GetHashCode();
+      if (HasDefaultUint64) hash ^= DefaultUint64.GetHashCode();
+      if (HasDefaultSint32) hash ^= DefaultSint32.GetHashCode();
+      if (HasDefaultSint64) hash ^= DefaultSint64.GetHashCode();
+      if (HasDefaultFixed32) hash ^= DefaultFixed32.GetHashCode();
+      if (HasDefaultFixed64) hash ^= DefaultFixed64.GetHashCode();
+      if (HasDefaultSfixed32) hash ^= DefaultSfixed32.GetHashCode();
+      if (HasDefaultSfixed64) hash ^= DefaultSfixed64.GetHashCode();
+      if (HasDefaultFloat) hash ^= pbc::ProtobufEqualityComparers.BitwiseSingleEqualityComparer.GetHashCode(DefaultFloat);
+      if (HasDefaultDouble) hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(DefaultDouble);
+      if (HasDefaultBool) hash ^= DefaultBool.GetHashCode();
+      if (HasDefaultString) hash ^= DefaultString.GetHashCode();
       if (HasFieldname1) hash ^= Fieldname1.GetHashCode();
       if (HasFieldName2) hash ^= FieldName2.GetHashCode();
       if (HasFieldName3) hash ^= FieldName3.GetHashCode();
@@ -2987,6 +3421,62 @@
         output.WriteGroup(Data);
         output.WriteRawTag(204, 12);
       }
+      if (HasDefaultInt32) {
+        output.WriteRawTag(136, 15);
+        output.WriteInt32(DefaultInt32);
+      }
+      if (HasDefaultInt64) {
+        output.WriteRawTag(144, 15);
+        output.WriteInt64(DefaultInt64);
+      }
+      if (HasDefaultUint32) {
+        output.WriteRawTag(152, 15);
+        output.WriteUInt32(DefaultUint32);
+      }
+      if (HasDefaultUint64) {
+        output.WriteRawTag(160, 15);
+        output.WriteUInt64(DefaultUint64);
+      }
+      if (HasDefaultSint32) {
+        output.WriteRawTag(168, 15);
+        output.WriteSInt32(DefaultSint32);
+      }
+      if (HasDefaultSint64) {
+        output.WriteRawTag(176, 15);
+        output.WriteSInt64(DefaultSint64);
+      }
+      if (HasDefaultFixed32) {
+        output.WriteRawTag(189, 15);
+        output.WriteFixed32(DefaultFixed32);
+      }
+      if (HasDefaultFixed64) {
+        output.WriteRawTag(193, 15);
+        output.WriteFixed64(DefaultFixed64);
+      }
+      if (HasDefaultSfixed32) {
+        output.WriteRawTag(205, 15);
+        output.WriteSFixed32(DefaultSfixed32);
+      }
+      if (HasDefaultSfixed64) {
+        output.WriteRawTag(209, 15);
+        output.WriteSFixed64(DefaultSfixed64);
+      }
+      if (HasDefaultFloat) {
+        output.WriteRawTag(221, 15);
+        output.WriteFloat(DefaultFloat);
+      }
+      if (HasDefaultDouble) {
+        output.WriteRawTag(225, 15);
+        output.WriteDouble(DefaultDouble);
+      }
+      if (HasDefaultBool) {
+        output.WriteRawTag(232, 15);
+        output.WriteBool(DefaultBool);
+      }
+      if (HasDefaultString) {
+        output.WriteRawTag(242, 15);
+        output.WriteString(DefaultString);
+      }
       if (HasFieldname1) {
         output.WriteRawTag(136, 25);
         output.WriteInt32(Fieldname1);
@@ -3269,6 +3759,62 @@
         output.WriteGroup(Data);
         output.WriteRawTag(204, 12);
       }
+      if (HasDefaultInt32) {
+        output.WriteRawTag(136, 15);
+        output.WriteInt32(DefaultInt32);
+      }
+      if (HasDefaultInt64) {
+        output.WriteRawTag(144, 15);
+        output.WriteInt64(DefaultInt64);
+      }
+      if (HasDefaultUint32) {
+        output.WriteRawTag(152, 15);
+        output.WriteUInt32(DefaultUint32);
+      }
+      if (HasDefaultUint64) {
+        output.WriteRawTag(160, 15);
+        output.WriteUInt64(DefaultUint64);
+      }
+      if (HasDefaultSint32) {
+        output.WriteRawTag(168, 15);
+        output.WriteSInt32(DefaultSint32);
+      }
+      if (HasDefaultSint64) {
+        output.WriteRawTag(176, 15);
+        output.WriteSInt64(DefaultSint64);
+      }
+      if (HasDefaultFixed32) {
+        output.WriteRawTag(189, 15);
+        output.WriteFixed32(DefaultFixed32);
+      }
+      if (HasDefaultFixed64) {
+        output.WriteRawTag(193, 15);
+        output.WriteFixed64(DefaultFixed64);
+      }
+      if (HasDefaultSfixed32) {
+        output.WriteRawTag(205, 15);
+        output.WriteSFixed32(DefaultSfixed32);
+      }
+      if (HasDefaultSfixed64) {
+        output.WriteRawTag(209, 15);
+        output.WriteSFixed64(DefaultSfixed64);
+      }
+      if (HasDefaultFloat) {
+        output.WriteRawTag(221, 15);
+        output.WriteFloat(DefaultFloat);
+      }
+      if (HasDefaultDouble) {
+        output.WriteRawTag(225, 15);
+        output.WriteDouble(DefaultDouble);
+      }
+      if (HasDefaultBool) {
+        output.WriteRawTag(232, 15);
+        output.WriteBool(DefaultBool);
+      }
+      if (HasDefaultString) {
+        output.WriteRawTag(242, 15);
+        output.WriteString(DefaultString);
+      }
       if (HasFieldname1) {
         output.WriteRawTag(136, 25);
         output.WriteInt32(Fieldname1);
@@ -3518,6 +4064,48 @@
       if (HasData) {
         size += 4 + pb::CodedOutputStream.ComputeGroupSize(Data);
       }
+      if (HasDefaultInt32) {
+        size += 2 + pb::CodedOutputStream.ComputeInt32Size(DefaultInt32);
+      }
+      if (HasDefaultInt64) {
+        size += 2 + pb::CodedOutputStream.ComputeInt64Size(DefaultInt64);
+      }
+      if (HasDefaultUint32) {
+        size += 2 + pb::CodedOutputStream.ComputeUInt32Size(DefaultUint32);
+      }
+      if (HasDefaultUint64) {
+        size += 2 + pb::CodedOutputStream.ComputeUInt64Size(DefaultUint64);
+      }
+      if (HasDefaultSint32) {
+        size += 2 + pb::CodedOutputStream.ComputeSInt32Size(DefaultSint32);
+      }
+      if (HasDefaultSint64) {
+        size += 2 + pb::CodedOutputStream.ComputeSInt64Size(DefaultSint64);
+      }
+      if (HasDefaultFixed32) {
+        size += 2 + 4;
+      }
+      if (HasDefaultFixed64) {
+        size += 2 + 8;
+      }
+      if (HasDefaultSfixed32) {
+        size += 2 + 4;
+      }
+      if (HasDefaultSfixed64) {
+        size += 2 + 8;
+      }
+      if (HasDefaultFloat) {
+        size += 2 + 4;
+      }
+      if (HasDefaultDouble) {
+        size += 2 + 8;
+      }
+      if (HasDefaultBool) {
+        size += 2 + 1;
+      }
+      if (HasDefaultString) {
+        size += 2 + pb::CodedOutputStream.ComputeStringSize(DefaultString);
+      }
       if (HasFieldname1) {
         size += 2 + pb::CodedOutputStream.ComputeInt32Size(Fieldname1);
       }
@@ -3736,6 +4324,48 @@
         }
         Data.MergeFrom(other.Data);
       }
+      if (other.HasDefaultInt32) {
+        DefaultInt32 = other.DefaultInt32;
+      }
+      if (other.HasDefaultInt64) {
+        DefaultInt64 = other.DefaultInt64;
+      }
+      if (other.HasDefaultUint32) {
+        DefaultUint32 = other.DefaultUint32;
+      }
+      if (other.HasDefaultUint64) {
+        DefaultUint64 = other.DefaultUint64;
+      }
+      if (other.HasDefaultSint32) {
+        DefaultSint32 = other.DefaultSint32;
+      }
+      if (other.HasDefaultSint64) {
+        DefaultSint64 = other.DefaultSint64;
+      }
+      if (other.HasDefaultFixed32) {
+        DefaultFixed32 = other.DefaultFixed32;
+      }
+      if (other.HasDefaultFixed64) {
+        DefaultFixed64 = other.DefaultFixed64;
+      }
+      if (other.HasDefaultSfixed32) {
+        DefaultSfixed32 = other.DefaultSfixed32;
+      }
+      if (other.HasDefaultSfixed64) {
+        DefaultSfixed64 = other.DefaultSfixed64;
+      }
+      if (other.HasDefaultFloat) {
+        DefaultFloat = other.DefaultFloat;
+      }
+      if (other.HasDefaultDouble) {
+        DefaultDouble = other.DefaultDouble;
+      }
+      if (other.HasDefaultBool) {
+        DefaultBool = other.DefaultBool;
+      }
+      if (other.HasDefaultString) {
+        DefaultString = other.DefaultString;
+      }
       if (other.HasFieldname1) {
         Fieldname1 = other.Fieldname1;
       }
@@ -4302,6 +4932,62 @@
             input.ReadGroup(Data);
             break;
           }
+          case 1928: {
+            DefaultInt32 = input.ReadInt32();
+            break;
+          }
+          case 1936: {
+            DefaultInt64 = input.ReadInt64();
+            break;
+          }
+          case 1944: {
+            DefaultUint32 = input.ReadUInt32();
+            break;
+          }
+          case 1952: {
+            DefaultUint64 = input.ReadUInt64();
+            break;
+          }
+          case 1960: {
+            DefaultSint32 = input.ReadSInt32();
+            break;
+          }
+          case 1968: {
+            DefaultSint64 = input.ReadSInt64();
+            break;
+          }
+          case 1981: {
+            DefaultFixed32 = input.ReadFixed32();
+            break;
+          }
+          case 1985: {
+            DefaultFixed64 = input.ReadFixed64();
+            break;
+          }
+          case 1997: {
+            DefaultSfixed32 = input.ReadSFixed32();
+            break;
+          }
+          case 2001: {
+            DefaultSfixed64 = input.ReadSFixed64();
+            break;
+          }
+          case 2013: {
+            DefaultFloat = input.ReadFloat();
+            break;
+          }
+          case 2017: {
+            DefaultDouble = input.ReadDouble();
+            break;
+          }
+          case 2024: {
+            DefaultBool = input.ReadBool();
+            break;
+          }
+          case 2034: {
+            DefaultString = input.ReadString();
+            break;
+          }
           case 3208: {
             Fieldname1 = input.ReadInt32();
             break;
@@ -4852,6 +5538,62 @@
             input.ReadGroup(Data);
             break;
           }
+          case 1928: {
+            DefaultInt32 = input.ReadInt32();
+            break;
+          }
+          case 1936: {
+            DefaultInt64 = input.ReadInt64();
+            break;
+          }
+          case 1944: {
+            DefaultUint32 = input.ReadUInt32();
+            break;
+          }
+          case 1952: {
+            DefaultUint64 = input.ReadUInt64();
+            break;
+          }
+          case 1960: {
+            DefaultSint32 = input.ReadSInt32();
+            break;
+          }
+          case 1968: {
+            DefaultSint64 = input.ReadSInt64();
+            break;
+          }
+          case 1981: {
+            DefaultFixed32 = input.ReadFixed32();
+            break;
+          }
+          case 1985: {
+            DefaultFixed64 = input.ReadFixed64();
+            break;
+          }
+          case 1997: {
+            DefaultSfixed32 = input.ReadSFixed32();
+            break;
+          }
+          case 2001: {
+            DefaultSfixed64 = input.ReadSFixed64();
+            break;
+          }
+          case 2013: {
+            DefaultFloat = input.ReadFloat();
+            break;
+          }
+          case 2017: {
+            DefaultDouble = input.ReadDouble();
+            break;
+          }
+          case 2024: {
+            DefaultBool = input.ReadBool();
+            break;
+          }
+          case 2034: {
+            DefaultString = input.ReadString();
+            break;
+          }
           case 3208: {
             Fieldname1 = input.ReadInt32();
             break;
diff --git a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs
index 1abed60..894d914 100644
--- a/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs
+++ b/csharp/src/Google.Protobuf.Test/GeneratedMessageTest.Proto2.cs
@@ -380,5 +380,18 @@
                 TestGroupExtension.Parser.WithExtensionRegistry(new ExtensionRegistry() { TestNestedExtension.Extensions.OptionalGroupExtension }),

                 message);

         }

+

+        [Test]

+        public void RoundTrip_ParseUsingCodedInput()

+        {

+            var message = new TestAllExtensions();

+            message.SetExtension(UnittestExtensions.OptionalBoolExtension, true);

+            byte[] bytes = message.ToByteArray();

+            using (CodedInputStream input = new CodedInputStream(bytes))

+            {

+                var parsed = TestAllExtensions.Parser.WithExtensionRegistry(new ExtensionRegistry() { UnittestExtensions.OptionalBoolExtension }).ParseFrom(input);

+                Assert.AreEqual(message, parsed);

+            }

+        }

     }

 }

diff --git a/csharp/src/Google.Protobuf.Test/testprotos.pb b/csharp/src/Google.Protobuf.Test/testprotos.pb
index caf5164..f1f44f1 100644
--- a/csharp/src/Google.Protobuf.Test/testprotos.pb
+++ b/csharp/src/Google.Protobuf.Test/testprotos.pb
Binary files differ
diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj
index f6d6069..010e4b4 100644
--- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj
+++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj
@@ -4,7 +4,7 @@
     <Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description>
     <Copyright>Copyright 2015, Google Inc.</Copyright>
     <AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
-    <VersionPrefix>3.18.1</VersionPrefix>
+    <VersionPrefix>3.19.4</VersionPrefix>
     <!-- C# 7.2 is required for Span/BufferWriter/ReadOnlySequence -->
     <LangVersion>7.2</LangVersion>
     <Authors>Google Inc.</Authors>
diff --git a/csharp/src/Google.Protobuf/MessageParser.cs b/csharp/src/Google.Protobuf/MessageParser.cs
index 30a25a8..a10c908 100644
--- a/csharp/src/Google.Protobuf/MessageParser.cs
+++ b/csharp/src/Google.Protobuf/MessageParser.cs
@@ -187,14 +187,17 @@
         internal void MergeFrom(IMessage message, CodedInputStream codedInput)
         {
             bool originalDiscard = codedInput.DiscardUnknownFields;
+            ExtensionRegistry originalRegistry = codedInput.ExtensionRegistry;
             try
             {
                 codedInput.DiscardUnknownFields = DiscardUnknownFields;
+                codedInput.ExtensionRegistry = Extensions;
                 message.MergeFrom(codedInput);
             }
             finally
             {
                 codedInput.DiscardUnknownFields = originalDiscard;
+                codedInput.ExtensionRegistry = originalRegistry;
             }
         }
 
diff --git a/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
index 7324e3d..0ba16cf 100644
--- a/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
+++ b/csharp/src/Google.Protobuf/Reflection/FieldDescriptor.cs
@@ -45,7 +45,6 @@
         private MessageDescriptor extendeeType;
         private MessageDescriptor messageType;
         private FieldType fieldType;
-        private readonly string propertyName; // Annoyingly, needed in Crosslink.
         private IFieldAccessor accessor;
 
         /// <summary>
@@ -71,6 +70,11 @@
         public string JsonName { get; }
 
         /// <summary>
+        /// The name of the property in the <c>ContainingType.ClrType</c> class.
+        /// </summary>
+        public string PropertyName { get; }
+
+        /// <summary>
         /// Indicates whether this field supports presence, either implicitly (e.g. due to it being a message
         /// type field) or explicitly via Has/Clear members. If this returns true, it is safe to call
         /// <see cref="IFieldAccessor.Clear(IMessage)"/> and <see cref="IFieldAccessor.HasValue(IMessage)"/>
@@ -123,7 +127,7 @@
             // for later.
             // We could trust the generated code and check whether the type of the property is
             // a MapField, but that feels a tad nasty.
-            this.propertyName = propertyName;
+            PropertyName = propertyName;
             Extension = extension;
             JsonName =  Proto.JsonName == "" ? JsonFormatter.ToJsonName(Proto.Name) : Proto.JsonName;
         }
@@ -436,15 +440,15 @@
             // If we're given no property name, that's because we really don't want an accessor.
             // This could be because it's a map message, or it could be that we're loading a FileDescriptor dynamically.
             // TODO: Support dynamic messages.
-            if (propertyName == null)
+            if (PropertyName == null)
             {
                 return null;
             }
 
-            var property = ContainingType.ClrType.GetProperty(propertyName);
+            var property = ContainingType.ClrType.GetProperty(PropertyName);
             if (property == null)
             {
-                throw new DescriptorValidationException(this, $"Property {propertyName} not found in {ContainingType.ClrType}");
+                throw new DescriptorValidationException(this, $"Property {PropertyName} not found in {ContainingType.ClrType}");
             }
             return IsMap ? new MapFieldAccessor(property, this)
                 : IsRepeated ? new RepeatedFieldAccessor(property, this)
diff --git a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
index b32b76c..123d80a 100644
--- a/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
+++ b/csharp/src/Google.Protobuf/WellKnownTypes/Struct.cs
@@ -261,8 +261,8 @@
   /// <summary>
   /// `Value` represents a dynamically typed value which can be either
   /// null, a number, a string, a boolean, a recursive struct value, or a
-  /// list of values. A producer of value is expected to set one of that
-  /// variants, absence of any variant indicates an error.
+  /// list of values. A producer of value is expected to set one of these
+  /// variants. Absence of any variant indicates an error.
   ///
   /// The JSON representation for `Value` is JSON value.
   /// </summary>
diff --git a/docs/field_presence.md b/docs/field_presence.md
index a82f933..ed76375 100644
--- a/docs/field_presence.md
+++ b/docs/field_presence.md
@@ -1,12 +1,12 @@
 # Application note: Field presence
 
-This application note explains the various presence tracking disciplines for protobuf fields. It also explains how to enable experimental support for explicit presence tracking for singular proto3 fields with basic types.
+This application note explains the various presence tracking disciplines for protobuf fields. It also explains the behaviour of explicit presence tracking for singular proto3 fields with basic types.
 
 ## Background
 
 _Field presence_ is the notion of whether a protobuf field has a value. There are two different manifestations of presence for protobufs: _no presence_, where the generated message API stores field values (only), and _explicit presence_, where the API also stores whether or not a field has been set.
 
-Historically, proto2 has mostly followed _explicit presence_, while proto3 exposes only _no presence_ semantics. Singular proto3 fields of basic types (numeric, string, bytes, and enums) which are defined with the `optional` label have _explicit presence_, like proto2 (this is an experimental feature added as of release 3.12, and must be enabled by passing a flag to `protoc`).
+Historically, proto2 has mostly followed _explicit presence_, while proto3 exposes only _no presence_ semantics. Singular proto3 fields of basic types (numeric, string, bytes, and enums) which are defined with the `optional` label have _explicit presence_, like proto2 (this feature is enabled by default as release 3.15).
 
 ### Presence disciplines
 
@@ -100,7 +100,7 @@
 Oneofs                                       | N/A        | ✔️
 Maps                                         | N/A        |
 
-Similar to proto2 APIs, proto3 does not track presence explicitly for repeated fields. Without the `optional` label, proto3 APIs do not track presence for basic types (numeric, string, bytes, and enums), either. (Note that `optional` for proto3 fields is only experimentally available as of release 3.12.) Oneof fields affirmatively expose presence, although the same set of hazzer methods may not generated as in proto2 APIs.
+Similar to proto2 APIs, proto3 does not track presence explicitly for repeated fields. Without the `optional` label, proto3 APIs do not track presence for basic types (numeric, string, bytes, and enums), either. Oneof fields affirmatively expose presence, although the same set of hazzer methods may not generated as in proto2 APIs.
 
 Under the _no presence_ discipline, the default value is synonymous with "not present" for purposes of serialization. To notionally "clear" a field (so it won't be serialized), an API user would set it to the default value.
 
@@ -198,10 +198,10 @@
 
 ## How to enable _explicit presence_ in proto3
 
-These are the general steps to use the experimental field tracking support for proto3:
+These are the general steps to use field tracking support for proto3:
 
 1.  Add an `optional` field to a `.proto` file.
-1.  Run `protoc` (from release 3.12 or later) with an extra flag to recognize `optional` (i.e,. explicit presence) in proto3 files.
+1.  Run `protoc` (at least v3.15, or v3.12 using `--experimental_allow_proto3_optional` flag).
 1.  Use the generated "hazzer" methods and "clear" methods in application code, instead of comparing or setting default values.
 
 ### `.proto` file changes
@@ -223,7 +223,7 @@
 
 ### `protoc` invocation
 
-To enable presence tracking for proto3 messages, pass the `--experimental_allow_proto3_optional` flag to protoc. Without this flag, the `optional` label is an error in files using proto3 syntax. This flag is available in protobuf release 3.12 or later (or at HEAD, if you are reading this application note from Git).
+Presence tracking for proto3 messages is enabled by default [since v3.15.0](https://github.com/protocolbuffers/protobuf/releases/tag/v3.15.0) release, formerly up until [v3.12.0](https://github.com/protocolbuffers/protobuf/releases/tag/v3.12.0) the `--experimental_allow_proto3_optional` flag was required when using presence tracking with protoc.
 
 ### Using the generated code
 
diff --git a/docs/options.md b/docs/options.md
index d78406a..159951a 100644
--- a/docs/options.md
+++ b/docs/options.md
@@ -205,7 +205,7 @@
    * Website: https://github.com/envoyproxy/protoc-gen-validate
    * Extensions: 1071
 
-1. protokt
+1. Protokt
    * Website: https://github.com/open-toast/protokt
    * Extensions: 1072
 
@@ -283,4 +283,12 @@
 
 1. eigr/protocol
    * Website: https://eigr.io
-   * Extension: 1110-1114
\ No newline at end of file
+   * Extension: 1110-1114
+
+1. Container Object Storage Interface (COSI)
+   * Website: https://github.com/kubernetes-sigs/container-object-storage-interface-spec
+   * Extension: 1115-1124
+
+1. Protoc-gen-jsonschema
+   * Website: https://github.com/chrusty/protoc-gen-jsonschema
+   * Extension: 1125-1129
diff --git a/docs/third_party.md b/docs/third_party.md
index 4075327..645ada8 100644
--- a/docs/third_party.md
+++ b/docs/third_party.md
@@ -70,6 +70,7 @@
 * Kotlin: https://github.com/marcoferrer/kroto-plus
 * Kotlin: https://github.com/Kotlin/kotlinx.serialization
 * Kotlin: https://github.com/ButterCam/sisyphus
+* Kotlin: https://github.com/open-toast/protokt
 * Lua: http://code.google.com/p/protoc-gen-lua/
 * Lua: http://github.com/indygreg/lua-protobuf
 * Lua: https://github.com/Neopallium/lua-pb
@@ -96,7 +97,9 @@
 * Ruby: http://github.com/mozy/ruby-protocol-buffers
 * Ruby: https://github.com/bmizerany/beefcake/tree/master/lib/beefcake
 * Ruby: https://github.com/localshred/protobuf
+* Rust: https://github.com/tokio-rs/prost
 * Rust: https://github.com/stepancheg/rust-protobuf/
+* Rust: https://github.com/tafia/quick-protobuf
 * Scala: http://github.com/jeffplaisance/scala-protobuf
 * Scala: http://code.google.com/p/protobuf-scala
 * Scala: https://github.com/SandroGrzicic/ScalaBuff
@@ -128,6 +131,7 @@
 * https://github.com/Yeolar/raster (C++)
 * https://github.com/jnordberg/wsrpc (JavaScript Node.js/Browser)
 * https://github.com/ppissias/xsrpcj (Java)
+* https://github.com/twitchtv/twirp (Multiple languages)
 
 Inactive:
 
diff --git a/editors/protobuf-mode.el b/editors/protobuf-mode.el
index 8102771..bbb82b7 100644
--- a/editors/protobuf-mode.el
+++ b/editors/protobuf-mode.el
@@ -68,7 +68,7 @@
 (eval-when-compile
   (and (= emacs-major-version 24)
        (>= emacs-minor-version 4)
-       (require 'cl))
+       (require 'cl-lib))
   (require 'cc-langs)
   (require 'cc-fonts))
 
@@ -193,7 +193,7 @@
 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.proto\\'" . protobuf-mode))
 
 ;;;###autoload
-(defun protobuf-mode ()
+(define-derived-mode protobuf-mode prog-mode "Protobuf"
   "Major mode for editing Protocol Buffers description language.
 
 The hook `c-mode-common-hook' is run with no argument at mode
diff --git a/java/README.md b/java/README.md
index 48c3aec..0170b9d 100644
--- a/java/README.md
+++ b/java/README.md
@@ -23,7 +23,7 @@
 <dependency>
   <groupId>com.google.protobuf</groupId>
   <artifactId>protobuf-java</artifactId>
-  <version>3.15.3</version>
+  <version>3.19.4</version>
 </dependency>
 ```
 
@@ -37,7 +37,7 @@
 <dependency>
   <groupId>com.google.protobuf</groupId>
   <artifactId>protobuf-java-util</artifactId>
-  <version>3.15.3</version>
+  <version>3.19.4</version>
 </dependency>
 ```
 
@@ -45,7 +45,7 @@
 
 If you are using Gradle, add the following to your `build.gradle` file's dependencies:
 ```
-    implementation 'com.google.protobuf:protobuf-java:3.15.3'
+    implementation 'com.google.protobuf:protobuf-java:3.19.4'
 ```
 Again, be sure to check that the version number matches (or is newer than) the version number of protoc that you are using.
 
diff --git a/java/bom/pom.xml b/java/bom/pom.xml
index c4ec685..c818a14 100644
--- a/java/bom/pom.xml
+++ b/java/bom/pom.xml
@@ -4,7 +4,7 @@
 
   <groupId>com.google.protobuf</groupId>
   <artifactId>protobuf-bom</artifactId>
-  <version>3.18.1</version>
+  <version>3.19.4</version>
   <packaging>pom</packaging>
 
   <name>Protocol Buffers [BOM]</name>
diff --git a/java/core/BUILD b/java/core/BUILD
index 9308ba7..419eafb 100644
--- a/java/core/BUILD
+++ b/java/core/BUILD
@@ -1,5 +1,5 @@
 load("@bazel_skylib//rules:build_test.bzl", "build_test")
-load("@rules_java//java:defs.bzl", "java_library", "java_proto_library", "java_lite_proto_library")
+load("@rules_java//java:defs.bzl", "java_library", "java_lite_proto_library", "java_proto_library")
 load("@rules_jvm_external//:defs.bzl", "java_export")
 load("@rules_proto//proto:defs.bzl", "proto_lang_toolchain", "proto_library")
 load("//:internal.bzl", "conformance_test")
@@ -21,6 +21,8 @@
     "src/main/java/com/google/protobuf/ByteBufferWriter.java",
     "src/main/java/com/google/protobuf/ByteOutput.java",
     "src/main/java/com/google/protobuf/ByteString.java",
+    "src/main/java/com/google/protobuf/CanIgnoreReturnValue.java",
+    "src/main/java/com/google/protobuf/CheckReturnValue.java",
     "src/main/java/com/google/protobuf/CodedInputStream.java",
     "src/main/java/com/google/protobuf/CodedInputStreamReader.java",
     "src/main/java/com/google/protobuf/CodedOutputStream.java",
@@ -101,7 +103,7 @@
 java_library(
     name = "lite",
     srcs = LITE_SRCS + [
-        "//:gen_well_known_protos_javalite"
+        "//:gen_well_known_protos_javalite",
     ],
     visibility = [
         "//java/lite:__pkg__",
@@ -113,10 +115,10 @@
     name = "lite_mvn",
     maven_coordinates = "com.google.protobuf:protobuf-javalite:%s" % PROTOBUF_VERSION,
     pom_template = "//java/lite:pom_template.xml",
-    runtime_deps = [":lite"],
     resources = [
         "//:lite_well_known_protos",
     ],
+    runtime_deps = [":lite"],
 )
 
 java_library(
@@ -148,25 +150,25 @@
     name = "core_mvn",
     maven_coordinates = "com.google.protobuf:protobuf-java:%s" % PROTOBUF_VERSION,
     pom_template = "pom_template.xml",
-    runtime_deps = [":core"],
     resources = [
         "//:well_known_protos",
     ],
+    runtime_deps = [":core"],
 )
 
 filegroup(
     name = "release",
-    visibility = ["//java:__pkg__"],
     srcs = [
-        ":core_mvn-pom",
-        ":core_mvn-maven-source",
         ":core_mvn-docs",
+        ":core_mvn-maven-source",
+        ":core_mvn-pom",
         ":core_mvn-project",
-        ":lite_mvn-pom",
-        ":lite_mvn-maven-source",
         ":lite_mvn-docs",
+        ":lite_mvn-maven-source",
+        ":lite_mvn-pom",
         ":lite_mvn-project",
-    ]
+    ],
+    visibility = ["//java:__pkg__"],
 )
 
 proto_lang_toolchain(
@@ -205,23 +207,24 @@
     name = "test_util",
     srcs = [
         "src/test/java/com/google/protobuf/TestUtil.java",
-        "src/test/java/com/google/protobuf/TestUtilLite.java"
+        "src/test/java/com/google/protobuf/TestUtilLite.java",
     ],
     deps = [
         ":core",
         ":generic_test_protos_java_proto",
         ":java_test_protos_java_proto",
-        "//external:guava",
-        "//external:junit",
+        "@maven//:com_google_guava_guava",
+        "@maven//:junit_junit",
     ],
 )
 
 test_suite(
     name = "tests",
     tests = [
-        "core_build_test",
         "conformance_test",
+        "core_build_test",
         "core_tests",
+        "utf8_tests",
     ],
 )
 
@@ -234,30 +237,52 @@
 
 conformance_test(
     name = "conformance_test",
-    testee = "//:conformance_java",
     failure_list = "//:conformance/failure_list_java.txt",
+    testee = "//:conformance_java",
     text_format_failure_list = "//:conformance/text_format_failure_list_java.txt",
 )
 
 junit_tests(
     name = "core_tests",
-    srcs = glob(["src/test/java/**/*.java"], exclude = [
-        "src/test/java/com/google/protobuf/TestUtil.java",
-        "src/test/java/com/google/protobuf/TestUtilLite.java",
-    ]),
+    size = "small",
+    srcs = glob(
+        ["src/test/java/**/*.java"],
+        exclude = [
+            "src/test/java/com/google/protobuf/DecodeUtf8Test.java",
+            "src/test/java/com/google/protobuf/IsValidUtf8Test.java",
+            "src/test/java/com/google/protobuf/TestUtil.java",
+            "src/test/java/com/google/protobuf/TestUtilLite.java",
+        ],
+    ),
     data = ["//:testdata"],
-    size = "large",
     deps = [
         ":core",
         ":generic_test_protos_java_proto",
         ":java_test_protos_java_proto",
         ":test_util",
-        "//external:easymock",
-        "//external:easymock_classextension",
-        "//external:guava",
-        "//external:junit",
-        "//external:truth",
-    ]
+        "@maven//:com_google_guava_guava",
+        "@maven//:com_google_truth_truth",
+        "@maven//:junit_junit",
+        "@maven//:org_easymock_easymock",
+    ],
+)
+
+# The UTF-8 validation tests are much slower than the other tests, so they get
+# their own test target with a longer timeout.
+junit_tests(
+    name = "utf8_tests",
+    size = "large",
+    srcs = [
+        "src/test/java/com/google/protobuf/DecodeUtf8Test.java",
+        "src/test/java/com/google/protobuf/IsValidUtf8Test.java",
+        "src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java",
+    ],
+    deps = [
+        ":core",
+        "@maven//:com_google_guava_guava",
+        "@maven//:com_google_truth_truth",
+        "@maven//:junit_junit",
+    ],
 )
 
 java_lite_proto_library(
@@ -280,17 +305,17 @@
     name = "rewrite_javalite_test_util",
     srcs = [
         "//java/lite:lite.awk",
-        "src/test/java/com/google/protobuf/TestUtil.java"
+        "src/test/java/com/google/protobuf/TestUtil.java",
     ],
     outs = ["TestUtil.java"],
-    cmd = "awk -f $(location //java/lite:lite.awk) $(location src/test/java/com/google/protobuf/TestUtil.java) > $@"
+    cmd = "awk -f $(location //java/lite:lite.awk) $(location src/test/java/com/google/protobuf/TestUtil.java) > $@",
 )
 
 java_library(
     name = "test_util_lite",
     srcs = [
+        "src/test/java/com/google/protobuf/TestUtilLite.java",
         ":rewrite_javalite_test_util",
-        "src/test/java/com/google/protobuf/TestUtilLite.java"
     ],
     visibility = [
         "//java/lite:__pkg__",
@@ -299,8 +324,8 @@
         ":generic_test_protos_java_proto_lite",
         ":java_test_protos_java_proto_lite",
         ":lite_runtime_only",
-        "//external:guava",
-        "//external:junit",
+        "@maven//:com_google_guava_guava",
+        "@maven//:junit_junit",
     ],
 )
 
@@ -342,6 +367,7 @@
     "src/test/java/com/google/protobuf/TypeRegistryTest.java",
     "src/test/java/com/google/protobuf/UnknownEnumValueTest.java",
     "src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java",
+    "src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.java",
     "src/test/java/com/google/protobuf/UnknownFieldSetTest.java",
     "src/test/java/com/google/protobuf/WellKnownTypesTest.java",
     "src/test/java/com/google/protobuf/WireFormatTest.java",
@@ -349,19 +375,20 @@
 
 junit_tests(
     name = "lite_tests",
-    srcs = glob(["src/test/java/**/*.java"], exclude = LITE_TEST_EXCLUSIONS),
+    size = "large",
+    srcs = glob(
+        ["src/test/java/**/*.java"],
+        exclude = LITE_TEST_EXCLUSIONS,
+    ),
     data = ["//:testdata"],
     test_prefix = "Lite",
-    size = "large",
     deps = [
-        ":lite",
         ":generic_test_protos_java_proto_lite",
         ":java_test_protos_java_proto_lite",
+        ":lite",
         ":test_util_lite",
-        "//external:easymock",
-        "//external:easymock_classextension",
-        "//external:junit",
-        "//external:truth",
-    ]
+        "@maven//:com_google_truth_truth",
+        "@maven//:junit_junit",
+        "@maven//:org_easymock_easymock",
+    ],
 )
-
diff --git a/java/core/pom.xml b/java/core/pom.xml
index 838f4a7..ce068ee 100644
--- a/java/core/pom.xml
+++ b/java/core/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.protobuf</groupId>
     <artifactId>protobuf-parent</artifactId>
-    <version>3.18.1</version>
+    <version>3.19.4</version>
   </parent>
 
   <artifactId>protobuf-java</artifactId>
@@ -28,11 +28,6 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.easymock</groupId>
-      <artifactId>easymockclassextension</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
       <scope>test</scope>
diff --git a/java/core/src/main/java/com/google/protobuf/ByteString.java b/java/core/src/main/java/com/google/protobuf/ByteString.java
index 74c9a71..a4beaeb 100644
--- a/java/core/src/main/java/com/google/protobuf/ByteString.java
+++ b/java/core/src/main/java/com/google/protobuf/ByteString.java
@@ -73,6 +73,7 @@
  * @author carlanton@google.com Carl Haverl
  * @author martinrb@google.com Martin Buchholz
  */
+@CheckReturnValue
 public abstract class ByteString implements Iterable<Byte>, Serializable {
 
   /**
@@ -479,7 +480,8 @@
    * @param streamToDrain The source stream, which is read completely but not closed.
    * @return A new {@code ByteString} which is made up of chunks of various sizes, depending on the
    *     behavior of the underlying stream.
-   * @throws IOException IOException is thrown if there is a problem reading the underlying stream.
+   * @throws IOException if there is a problem reading the underlying stream
+   * @throws IllegalArgumentException if the stream supplies more than Integer.MAX_VALUE bytes
    */
   public static ByteString readFrom(InputStream streamToDrain) throws IOException {
     return readFrom(streamToDrain, MIN_READ_FROM_CHUNK_SIZE, MAX_READ_FROM_CHUNK_SIZE);
@@ -499,13 +501,23 @@
    * @param streamToDrain The source stream, which is read completely but not closed.
    * @param chunkSize The size of the chunks in which to read the stream.
    * @return A new {@code ByteString} which is made up of chunks of the given size.
-   * @throws IOException IOException is thrown if there is a problem reading the underlying stream.
+   * @throws IOException if there is a problem reading the underlying stream
+   * @throws IllegalArgumentException if the stream supplies more than Integer.MAX_VALUE bytes
    */
   public static ByteString readFrom(InputStream streamToDrain, int chunkSize) throws IOException {
     return readFrom(streamToDrain, chunkSize, chunkSize);
   }
 
-  // Helper method that takes the chunk size range as a parameter.
+  /**
+   * Helper method that takes the chunk size range as a parameter.
+   *
+   * @param streamToDrain the source stream, which is read completely but not closed
+   * @param minChunkSize the minimum size of the chunks in which to read the stream
+   * @param maxChunkSize the maximum size of the chunks in which to read the stream
+   * @return a new {@code ByteString} which is made up of chunks within the given size range
+   * @throws IOException if there is a problem reading the underlying stream
+   * @throws IllegalArgumentException if the stream supplies more than Integer.MAX_VALUE bytes
+   */
   public static ByteString readFrom(InputStream streamToDrain, int minChunkSize, int maxChunkSize)
       throws IOException {
     Collection<ByteString> results = new ArrayList<ByteString>();
@@ -564,6 +576,8 @@
    *
    * @param other string to concatenate
    * @return a new {@code ByteString} instance
+   * @throws IllegalArgumentException if the combined size of the two byte strings exceeds
+   *     Integer.MAX_VALUE
    */
   public final ByteString concat(ByteString other) {
     if (Integer.MAX_VALUE - size() < other.size()) {
@@ -584,6 +598,8 @@
    *
    * @param byteStrings strings to be concatenated
    * @return new {@code ByteString}
+   * @throws IllegalArgumentException if the combined size of the byte strings exceeds
+   *     Integer.MAX_VALUE
    */
   public static ByteString copyFrom(Iterable<ByteString> byteStrings) {
     // Determine the size;
@@ -1260,6 +1276,7 @@
    * @return the length of the range.
    * @throws IndexOutOfBoundsException some or all of the range falls outside of the array.
    */
+  @CanIgnoreReturnValue
   static int checkRange(int startIndex, int endIndex, int size) {
     final int length = endIndex - startIndex;
     if ((startIndex | endIndex | length | (size - endIndex)) < 0) {
diff --git a/java/core/src/main/java/com/google/protobuf/CanIgnoreReturnValue.java b/java/core/src/main/java/com/google/protobuf/CanIgnoreReturnValue.java
new file mode 100644
index 0000000..9e84432
--- /dev/null
+++ b/java/core/src/main/java/com/google/protobuf/CanIgnoreReturnValue.java
@@ -0,0 +1,50 @@
+// 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.
+
+package com.google.protobuf;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.CLASS;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates that the return value of the annotated method can be safely ignored.
+ *
+ * <p>This is the opposite of {@link CheckReturnValue}. It can be used inside classes or packages
+ * annotated with {@code @CheckReturnValue} to exempt specific methods from the default.
+ */
+@Documented
+@Target({METHOD, TYPE})
+@Retention(CLASS)
+@interface CanIgnoreReturnValue {}
diff --git a/java/core/src/main/java/com/google/protobuf/CheckReturnValue.java b/java/core/src/main/java/com/google/protobuf/CheckReturnValue.java
new file mode 100644
index 0000000..38c83d8
--- /dev/null
+++ b/java/core/src/main/java/com/google/protobuf/CheckReturnValue.java
@@ -0,0 +1,55 @@
+// 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.
+
+package com.google.protobuf;
+
+import static java.lang.annotation.ElementType.CONSTRUCTOR;
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.ElementType.PACKAGE;
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+/**
+ * Indicates that the return value of the annotated method must be checked. An error is triggered
+ * when one of these methods is called but the result is not used.
+ *
+ * <p>{@code @CheckReturnValue} may be applied to a class or package to indicate that all methods in
+ * that class or package must have their return values checked. For convenience, we provide an
+ * annotation, {@link CanIgnoreReturnValue}, to exempt specific methods or classes from this
+ * behavior.
+ */
+@Documented
+@Target({METHOD, CONSTRUCTOR, TYPE, PACKAGE})
+@Retention(RUNTIME)
+@interface CheckReturnValue {}
diff --git a/java/core/src/main/java/com/google/protobuf/CodedInputStream.java b/java/core/src/main/java/com/google/protobuf/CodedInputStream.java
index 8717f9e..6e9c0f6 100644
--- a/java/core/src/main/java/com/google/protobuf/CodedInputStream.java
+++ b/java/core/src/main/java/com/google/protobuf/CodedInputStream.java
@@ -87,7 +87,7 @@
       throw new IllegalArgumentException("bufferSize must be > 0");
     }
     if (input == null) {
-      // TODO(nathanmittler): Ideally we should throw here. This is done for backward compatibility.
+      // Ideally we would throw here. This is done for backward compatibility.
       return newInstance(EMPTY_BYTE_ARRAY);
     }
     return new StreamDecoder(input, bufferSize);
@@ -404,9 +404,9 @@
    *
    * <p>Set the maximum message size. In order to prevent malicious messages from exhausting memory
    * or causing integer overflows, {@code CodedInputStream} limits how large a message may be. The
-   * default limit is {@code Integer.MAX_INT}. You should set this limit as small as you can without
-   * harming your app's functionality. Note that size limits only apply when reading from an {@code
-   * InputStream}, not when constructed around a raw byte array.
+   * default limit is {@code Integer.MAX_VALUE}. You should set this limit as small as you can
+   * without harming your app's functionality. Note that size limits only apply when reading from an
+   * {@code InputStream}, not when constructed around a raw byte array.
    *
    * <p>If you want to read several messages from a single CodedInputStream, you could call {@link
    * #resetSizeCounter()} after each one to avoid hitting the size limit.
@@ -1146,7 +1146,7 @@
 
       final byte[] buffer = this.buffer;
       pos = tempPos + FIXED32_SIZE;
-      return (((buffer[tempPos] & 0xff))
+      return ((buffer[tempPos] & 0xff)
           | ((buffer[tempPos + 1] & 0xff) << 8)
           | ((buffer[tempPos + 2] & 0xff) << 16)
           | ((buffer[tempPos + 3] & 0xff) << 24));
@@ -1162,7 +1162,7 @@
 
       final byte[] buffer = this.buffer;
       pos = tempPos + FIXED64_SIZE;
-      return (((buffer[tempPos] & 0xffL))
+      return ((buffer[tempPos] & 0xffL)
           | ((buffer[tempPos + 1] & 0xffL) << 8)
           | ((buffer[tempPos + 2] & 0xffL) << 16)
           | ((buffer[tempPos + 3] & 0xffL) << 24)
@@ -1871,7 +1871,7 @@
       }
 
       pos = tempPos + FIXED32_SIZE;
-      return (((UnsafeUtil.getByte(tempPos) & 0xff))
+      return ((UnsafeUtil.getByte(tempPos) & 0xff)
           | ((UnsafeUtil.getByte(tempPos + 1) & 0xff) << 8)
           | ((UnsafeUtil.getByte(tempPos + 2) & 0xff) << 16)
           | ((UnsafeUtil.getByte(tempPos + 3) & 0xff) << 24));
@@ -1886,7 +1886,7 @@
       }
 
       pos = tempPos + FIXED64_SIZE;
-      return (((UnsafeUtil.getByte(tempPos) & 0xffL))
+      return ((UnsafeUtil.getByte(tempPos) & 0xffL)
           | ((UnsafeUtil.getByte(tempPos + 1) & 0xffL) << 8)
           | ((UnsafeUtil.getByte(tempPos + 2) & 0xffL) << 16)
           | ((UnsafeUtil.getByte(tempPos + 3) & 0xffL) << 24)
@@ -2013,15 +2013,20 @@
     private ByteBuffer slice(long begin, long end) throws IOException {
       int prevPos = buffer.position();
       int prevLimit = buffer.limit();
+      // View ByteBuffer as Buffer to avoid cross-Java version issues.
+      // See https://issues.apache.org/jira/browse/MRESOLVER-85
+      Buffer asBuffer = buffer;
       try {
-        ((Buffer) buffer).position(bufferPos(begin));
-        ((Buffer) buffer).limit(bufferPos(end));
+        asBuffer.position(bufferPos(begin));
+        asBuffer.limit(bufferPos(end));
         return buffer.slice();
       } catch (IllegalArgumentException e) {
-        throw InvalidProtocolBufferException.truncatedMessage();
+        InvalidProtocolBufferException ex = InvalidProtocolBufferException.truncatedMessage();
+        ex.initCause(e);
+        throw ex;
       } finally {
-        ((Buffer) buffer).position(prevPos);
-        ((Buffer) buffer).limit(prevLimit);
+        asBuffer.position(prevPos);
+        asBuffer.limit(prevLimit);
       }
     }
   }
@@ -2660,7 +2665,7 @@
 
       final byte[] buffer = this.buffer;
       pos = tempPos + FIXED32_SIZE;
-      return (((buffer[tempPos] & 0xff))
+      return ((buffer[tempPos] & 0xff)
           | ((buffer[tempPos + 1] & 0xff) << 8)
           | ((buffer[tempPos + 2] & 0xff) << 16)
           | ((buffer[tempPos + 3] & 0xff) << 24));
@@ -2987,7 +2992,7 @@
       // by allocating and reading only a small chunk at a time, so that the
       // malicious message must actually *be* extremely large to cause
       // problems.  Meanwhile, we limit the allowed size of a message elsewhere.
-      final List<byte[]> chunks = new ArrayList<byte[]>();
+      final List<byte[]> chunks = new ArrayList<>();
 
       while (sizeLeft > 0) {
         // TODO(nathanmittler): Consider using a value larger than DEFAULT_BUFFER_SIZE.
@@ -3134,16 +3139,16 @@
    */
   private static final class IterableDirectByteBufferDecoder extends CodedInputStream {
     /** The object that need to decode. */
-    private Iterable<ByteBuffer> input;
+    private final Iterable<ByteBuffer> input;
     /** The {@link Iterator} with type {@link ByteBuffer} of {@code input} */
-    private Iterator<ByteBuffer> iterator;
+    private final Iterator<ByteBuffer> iterator;
     /** The current ByteBuffer; */
     private ByteBuffer currentByteBuffer;
     /**
-     * If {@code true}, indicates that all the buffer are backing a {@link ByteString} and are
+     * If {@code true}, indicates that all the buffers are backing a {@link ByteString} and are
      * therefore considered to be an immutable input source.
      */
-    private boolean immutable;
+    private final boolean immutable;
     /**
      * If {@code true}, indicates that calls to read {@link ByteString} or {@code byte[]}
      * <strong>may</strong> return slices of the underlying buffer, rather than copies.
@@ -3516,8 +3521,7 @@
           currentByteBufferPos += size;
           return result;
         } else {
-          byte[] bytes;
-          bytes = new byte[size];
+          byte[] bytes = new byte[size];
           UnsafeUtil.copyMemory(currentByteBufferPos, bytes, 0, size);
           currentByteBufferPos += size;
           return ByteString.wrap(bytes);
@@ -3738,7 +3742,7 @@
       if (currentRemaining() >= FIXED32_SIZE) {
         long tempPos = currentByteBufferPos;
         currentByteBufferPos += FIXED32_SIZE;
-        return (((UnsafeUtil.getByte(tempPos) & 0xff))
+        return ((UnsafeUtil.getByte(tempPos) & 0xff)
             | ((UnsafeUtil.getByte(tempPos + 1) & 0xff) << 8)
             | ((UnsafeUtil.getByte(tempPos + 2) & 0xff) << 16)
             | ((UnsafeUtil.getByte(tempPos + 3) & 0xff) << 24));
@@ -3754,7 +3758,7 @@
       if (currentRemaining() >= FIXED64_SIZE) {
         long tempPos = currentByteBufferPos;
         currentByteBufferPos += FIXED64_SIZE;
-        return (((UnsafeUtil.getByte(tempPos) & 0xffL))
+        return ((UnsafeUtil.getByte(tempPos) & 0xffL)
             | ((UnsafeUtil.getByte(tempPos + 1) & 0xffL) << 8)
             | ((UnsafeUtil.getByte(tempPos + 2) & 0xffL) << 16)
             | ((UnsafeUtil.getByte(tempPos + 3) & 0xffL) << 24)
@@ -3875,11 +3879,6 @@
      * Try to get raw bytes from {@code input} with the size of {@code length} and copy to {@code
      * bytes} array. If the size is bigger than the number of remaining bytes in the input, then
      * throw {@code truncatedMessage} exception.
-     *
-     * @param bytes
-     * @param offset
-     * @param length
-     * @throws IOException
      */
     private void readRawBytesTo(byte[] bytes, int offset, final int length) throws IOException {
       if (length >= 0 && length <= remaining()) {
@@ -3965,15 +3964,18 @@
     private ByteBuffer slice(int begin, int end) throws IOException {
       int prevPos = currentByteBuffer.position();
       int prevLimit = currentByteBuffer.limit();
+      // View ByteBuffer as Buffer to avoid cross-Java version issues.
+      // See https://issues.apache.org/jira/browse/MRESOLVER-85
+      Buffer asBuffer = currentByteBuffer;
       try {
-        ((Buffer) currentByteBuffer).position(begin);
-        ((Buffer) currentByteBuffer).limit(end);
+        asBuffer.position(begin);
+        asBuffer.limit(end);
         return currentByteBuffer.slice();
       } catch (IllegalArgumentException e) {
         throw InvalidProtocolBufferException.truncatedMessage();
       } finally {
-        ((Buffer) currentByteBuffer).position(prevPos);
-        ((Buffer) currentByteBuffer).limit(prevLimit);
+        asBuffer.position(prevPos);
+        asBuffer.limit(prevLimit);
       }
     }
   }
diff --git a/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java b/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
index a9192d3..12f2097 100644
--- a/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
+++ b/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
@@ -692,7 +692,7 @@
   }
 
   /**
-   * Compute the number of bytes that would be needed to encode an lazily parsed MessageSet
+   * Compute the number of bytes that would be needed to encode a lazily parsed MessageSet
    * extension field to the stream. For historical reasons, the wire format differs from normal
    * fields.
    */
diff --git a/java/core/src/main/java/com/google/protobuf/Descriptors.java b/java/core/src/main/java/com/google/protobuf/Descriptors.java
index 7b14584..f36d033 100644
--- a/java/core/src/main/java/com/google/protobuf/Descriptors.java
+++ b/java/core/src/main/java/com/google/protobuf/Descriptors.java
@@ -49,16 +49,17 @@
 import com.google.protobuf.DescriptorProtos.ServiceDescriptorProto;
 import com.google.protobuf.DescriptorProtos.ServiceOptions;
 import com.google.protobuf.Descriptors.FileDescriptor.Syntax;
+import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
-import java.util.HashSet;
+import java.util.IdentityHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.WeakHashMap;
 import java.util.logging.Logger;
 
 /**
@@ -79,6 +80,13 @@
  */
 public final class Descriptors {
   private static final Logger logger = Logger.getLogger(Descriptors.class.getName());
+  private static final int[] EMPTY_INT_ARRAY = new int[0];
+  private static final Descriptor[] EMPTY_DESCRIPTORS = new Descriptor[0];
+  private static final FieldDescriptor[] EMPTY_FIELD_DESCRIPTORS = new FieldDescriptor[0];
+  private static final EnumDescriptor[] EMPTY_ENUM_DESCRIPTORS = new EnumDescriptor[0];
+  private static final ServiceDescriptor[] EMPTY_SERVICE_DESCRIPTORS = new ServiceDescriptor[0];
+  private static final OneofDescriptor[] EMPTY_ONEOF_DESCRIPTORS = new OneofDescriptor[0];
+
   /**
    * Describes a {@code .proto} file, including everything defined within. That includes, in
    * particular, descriptors for all the messages and file descriptors for all other imported {@code
@@ -401,8 +409,7 @@
      * except that the {@code FileDescriptorProto} is encoded in protocol buffer wire format.
      */
     public static FileDescriptor internalBuildGeneratedFileFrom(
-        final String[] descriptorDataParts,
-        final FileDescriptor[] dependencies) {
+        final String[] descriptorDataParts, final FileDescriptor[] dependencies) {
       final byte[] descriptorBytes = latin1Cat(descriptorDataParts);
 
       FileDescriptorProto proto;
@@ -434,10 +441,9 @@
         final String[] dependencyClassNames,
         final String[] dependencyFileNames,
         final InternalDescriptorAssigner descriptorAssigner) {
-      FileDescriptor[] dependencies = findDescriptors(
-          descriptorOuterClass, dependencyClassNames, dependencyFileNames);
-      internalBuildGeneratedFileFrom(
-          descriptorDataParts, dependencies, descriptorAssigner);
+      FileDescriptor[] dependencies =
+          findDescriptors(descriptorOuterClass, dependencyClassNames, dependencyFileNames);
+      internalBuildGeneratedFileFrom(descriptorDataParts, dependencies, descriptorAssigner);
     }
 
     /**
@@ -449,8 +455,8 @@
         final Class<?> descriptorOuterClass,
         final String[] dependencyClassNames,
         final String[] dependencyFileNames) {
-      FileDescriptor[] dependencies = findDescriptors(
-          descriptorOuterClass, dependencyClassNames, dependencyFileNames);
+      FileDescriptor[] dependencies =
+          findDescriptors(descriptorOuterClass, dependencyClassNames, dependencyFileNames);
       return internalBuildGeneratedFileFrom(descriptorDataParts, dependencies);
     }
 
@@ -482,7 +488,8 @@
      * "Options" messages defined in descriptor.proto. The callback may also return null to indicate
      * that no extensions are used in the descriptor.
      *
-     * This interface is deprecated.  Use the return value of internalBuildGeneratedFrom() instead.
+     * <p>This interface is deprecated. Use the return value of internalBuildGeneratedFrom()
+     * instead.
      */
     @Deprecated
     public interface InternalDescriptorAssigner {
@@ -533,22 +540,34 @@
 
       pool.addPackage(getPackage(), this);
 
-      messageTypes = new Descriptor[proto.getMessageTypeCount()];
+      messageTypes =
+          (proto.getMessageTypeCount() > 0)
+              ? new Descriptor[proto.getMessageTypeCount()]
+              : EMPTY_DESCRIPTORS;
       for (int i = 0; i < proto.getMessageTypeCount(); i++) {
         messageTypes[i] = new Descriptor(proto.getMessageType(i), this, null, i);
       }
 
-      enumTypes = new EnumDescriptor[proto.getEnumTypeCount()];
+      enumTypes =
+          (proto.getEnumTypeCount() > 0)
+              ? new EnumDescriptor[proto.getEnumTypeCount()]
+              : EMPTY_ENUM_DESCRIPTORS;
       for (int i = 0; i < proto.getEnumTypeCount(); i++) {
         enumTypes[i] = new EnumDescriptor(proto.getEnumType(i), this, null, i);
       }
 
-      services = new ServiceDescriptor[proto.getServiceCount()];
+      services =
+          (proto.getServiceCount() > 0)
+              ? new ServiceDescriptor[proto.getServiceCount()]
+              : EMPTY_SERVICE_DESCRIPTORS;
       for (int i = 0; i < proto.getServiceCount(); i++) {
         services[i] = new ServiceDescriptor(proto.getService(i), this, i);
       }
 
-      extensions = new FieldDescriptor[proto.getExtensionCount()];
+      extensions =
+          (proto.getExtensionCount() > 0)
+              ? new FieldDescriptor[proto.getExtensionCount()]
+              : EMPTY_FIELD_DESCRIPTORS;
       for (int i = 0; i < proto.getExtensionCount(); i++) {
         extensions[i] = new FieldDescriptor(proto.getExtension(i), this, null, i, true);
       }
@@ -567,9 +586,9 @@
       this.publicDependencies = new FileDescriptor[0];
 
       messageTypes = new Descriptor[] {message};
-      enumTypes = new EnumDescriptor[0];
-      services = new ServiceDescriptor[0];
-      extensions = new FieldDescriptor[0];
+      enumTypes = EMPTY_ENUM_DESCRIPTORS;
+      services = EMPTY_SERVICE_DESCRIPTORS;
+      extensions = EMPTY_FIELD_DESCRIPTORS;
 
       pool.addPackage(packageName, this);
       pool.addSymbol(message);
@@ -767,7 +786,9 @@
      * @param name The unqualified name of the field (e.g. "foo"). For protocol buffer messages that
      *     follow <a
      *     href=https://developers.google.com/protocol-buffers/docs/style#message_and_field_names>Google's
-     *     guidance on naming</a> this will be a snake case string, such as <pre>song_name</pre>.
+     *     guidance on naming</a> this will be a snake case string, such as
+     *     <pre>song_name</pre>
+     *     .
      * @return The field's descriptor, or {@code null} if not found.
      */
     public FieldDescriptor findFieldByName(final String name) {
@@ -786,7 +807,8 @@
      * @return The field's descriptor, or {@code null} if not found.
      */
     public FieldDescriptor findFieldByNumber(final int number) {
-      return file.pool.fieldsByNumber.get(new DescriptorPool.DescriptorIntPair(this, number));
+      return binarySearch(
+          fieldsSortedByNumber, fieldsSortedByNumber.length, FieldDescriptor.NUMBER_GETTER, number);
     }
 
     /**
@@ -827,6 +849,7 @@
     private final Descriptor[] nestedTypes;
     private final EnumDescriptor[] enumTypes;
     private final FieldDescriptor[] fields;
+    private final FieldDescriptor[] fieldsSortedByNumber;
     private final FieldDescriptor[] extensions;
     private final OneofDescriptor[] oneofs;
     private final int realOneofCount;
@@ -853,11 +876,12 @@
       this.fullName = fullname;
       this.containingType = null;
 
-      this.nestedTypes = new Descriptor[0];
-      this.enumTypes = new EnumDescriptor[0];
-      this.fields = new FieldDescriptor[0];
-      this.extensions = new FieldDescriptor[0];
-      this.oneofs = new OneofDescriptor[0];
+      this.nestedTypes = EMPTY_DESCRIPTORS;
+      this.enumTypes = EMPTY_ENUM_DESCRIPTORS;
+      this.fields = EMPTY_FIELD_DESCRIPTORS;
+      this.fieldsSortedByNumber = EMPTY_FIELD_DESCRIPTORS;
+      this.extensions = EMPTY_FIELD_DESCRIPTORS;
+      this.oneofs = EMPTY_ONEOF_DESCRIPTORS;
       this.realOneofCount = 0;
 
       // Create a placeholder FileDescriptor to hold this message.
@@ -879,27 +903,44 @@
       this.file = file;
       containingType = parent;
 
-      oneofs = new OneofDescriptor[proto.getOneofDeclCount()];
+      oneofs =
+          (proto.getOneofDeclCount() > 0)
+              ? new OneofDescriptor[proto.getOneofDeclCount()]
+              : EMPTY_ONEOF_DESCRIPTORS;
       for (int i = 0; i < proto.getOneofDeclCount(); i++) {
         oneofs[i] = new OneofDescriptor(proto.getOneofDecl(i), file, this, i);
       }
 
-      nestedTypes = new Descriptor[proto.getNestedTypeCount()];
+      nestedTypes =
+          (proto.getNestedTypeCount() > 0)
+              ? new Descriptor[proto.getNestedTypeCount()]
+              : EMPTY_DESCRIPTORS;
       for (int i = 0; i < proto.getNestedTypeCount(); i++) {
         nestedTypes[i] = new Descriptor(proto.getNestedType(i), file, this, i);
       }
 
-      enumTypes = new EnumDescriptor[proto.getEnumTypeCount()];
+      enumTypes =
+          (proto.getEnumTypeCount() > 0)
+              ? new EnumDescriptor[proto.getEnumTypeCount()]
+              : EMPTY_ENUM_DESCRIPTORS;
       for (int i = 0; i < proto.getEnumTypeCount(); i++) {
         enumTypes[i] = new EnumDescriptor(proto.getEnumType(i), file, this, i);
       }
 
-      fields = new FieldDescriptor[proto.getFieldCount()];
+      fields =
+          (proto.getFieldCount() > 0)
+              ? new FieldDescriptor[proto.getFieldCount()]
+              : EMPTY_FIELD_DESCRIPTORS;
       for (int i = 0; i < proto.getFieldCount(); i++) {
         fields[i] = new FieldDescriptor(proto.getField(i), file, this, i, false);
       }
+      this.fieldsSortedByNumber =
+          (proto.getFieldCount() > 0) ? fields.clone() : EMPTY_FIELD_DESCRIPTORS;
 
-      extensions = new FieldDescriptor[proto.getExtensionCount()];
+      extensions =
+          (proto.getExtensionCount() > 0)
+              ? new FieldDescriptor[proto.getExtensionCount()]
+              : EMPTY_FIELD_DESCRIPTORS;
       for (int i = 0; i < proto.getExtensionCount(); i++) {
         extensions[i] = new FieldDescriptor(proto.getExtension(i), file, this, i, true);
       }
@@ -930,18 +971,23 @@
       file.pool.addSymbol(this);
 
       // NOTE: The defined extension ranges are guaranteed to be disjoint.
-      extensionRangeLowerBounds = new int[proto.getExtensionRangeCount()];
-      extensionRangeUpperBounds = new int[proto.getExtensionRangeCount()];
-      int i = 0;
-      for (final DescriptorProto.ExtensionRange range : proto.getExtensionRangeList()) {
-        extensionRangeLowerBounds[i] = range.getStart();
-        extensionRangeUpperBounds[i] = range.getEnd();
-        i++;
+      if (proto.getExtensionRangeCount() > 0) {
+        extensionRangeLowerBounds = new int[proto.getExtensionRangeCount()];
+        extensionRangeUpperBounds = new int[proto.getExtensionRangeCount()];
+        int i = 0;
+        for (final DescriptorProto.ExtensionRange range : proto.getExtensionRangeList()) {
+          extensionRangeLowerBounds[i] = range.getStart();
+          extensionRangeUpperBounds[i] = range.getEnd();
+          i++;
+        }
+        // Since the ranges are disjoint, sorting these independently must still produce the correct
+        // order.
+        Arrays.sort(extensionRangeLowerBounds);
+        Arrays.sort(extensionRangeUpperBounds);
+      } else {
+        extensionRangeLowerBounds = EMPTY_INT_ARRAY;
+        extensionRangeUpperBounds = EMPTY_INT_ARRAY;
       }
-      // Since the ranges are disjoint, sorting these independently must still produce the correct
-      // order.
-      Arrays.sort(extensionRangeLowerBounds);
-      Arrays.sort(extensionRangeUpperBounds);
     }
 
     /** Look up and cross-link all field types, etc. */
@@ -953,12 +999,32 @@
       for (final FieldDescriptor field : fields) {
         field.crossLink();
       }
+      Arrays.sort(fieldsSortedByNumber);
+      validateNoDuplicateFieldNumbers();
 
       for (final FieldDescriptor extension : extensions) {
         extension.crossLink();
       }
     }
 
+    private void validateNoDuplicateFieldNumbers() throws DescriptorValidationException {
+      for (int i = 0; i + 1 < fieldsSortedByNumber.length; i++) {
+        FieldDescriptor old = fieldsSortedByNumber[i];
+        FieldDescriptor field = fieldsSortedByNumber[i + 1];
+        if (old.getNumber() == field.getNumber()) {
+          throw new DescriptorValidationException(
+              field,
+              "Field number "
+                  + field.getNumber()
+                  + " has already been used in \""
+                  + field.getContainingType().getFullName()
+                  + "\" by field \""
+                  + old.getName()
+                  + "\".");
+        }
+      }
+    }
+
     /** See {@link FileDescriptor#setProto}. */
     private void setProto(final DescriptorProto proto) {
       this.proto = proto;
@@ -990,6 +1056,14 @@
   /** Describes a field of a message type. */
   public static final class FieldDescriptor extends GenericDescriptor
       implements Comparable<FieldDescriptor>, FieldSet.FieldDescriptorLite<FieldDescriptor> {
+    private static final NumberGetter<FieldDescriptor> NUMBER_GETTER =
+        new NumberGetter<FieldDescriptor>() {
+          @Override
+          public int getNumber(FieldDescriptor fieldDescriptor) {
+            return fieldDescriptor.getNumber();
+          }
+        };
+
     /**
      * Get the index of this descriptor within its parent.
      *
@@ -1029,7 +1103,14 @@
 
     /** Get the JSON name of this field. */
     public String getJsonName() {
-      return jsonName;
+      String result = jsonName;
+      if (result != null) {
+        return result;
+      } else if (proto.hasJsonName()) {
+        return jsonName = proto.getJsonName();
+      } else {
+        return jsonName = fieldNameToJsonName(proto.getName());
+      }
     }
 
     /**
@@ -1191,7 +1272,7 @@
      * <p>For fields where hasPresence() == true, the return value of msg.hasField() is semantically
      * meaningful.
      */
-    boolean hasPresence() {
+    public boolean hasPresence() {
       if (isRepeated()) {
         return false;
       }
@@ -1276,7 +1357,7 @@
 
     private FieldDescriptorProto proto;
     private final String fullName;
-    private final String jsonName;
+    private String jsonName;
     private final FileDescriptor file;
     private final Descriptor extensionScope;
     private final boolean isProto3Optional;
@@ -1397,11 +1478,6 @@
       this.proto = proto;
       fullName = computeFullName(file, parent, proto.getName());
       this.file = file;
-      if (proto.hasJsonName()) {
-        jsonName = proto.getJsonName();
-      } else {
-        jsonName = fieldNameToJsonName(proto.getName());
-      }
 
       if (proto.hasType()) {
         type = Type.valueOf(proto.getType());
@@ -1627,10 +1703,6 @@
         }
       }
 
-      if (!isExtension()) {
-        file.pool.addFieldByNumber(this);
-      }
-
       if (containingType != null && containingType.getOptions().getMessageSetWireFormat()) {
         if (isExtension()) {
           if (!isOptional() || getType() != Type.MESSAGE) {
@@ -1740,7 +1812,17 @@
      */
     @Override
     public EnumValueDescriptor findValueByNumber(final int number) {
-      return file.pool.enumValuesByNumber.get(new DescriptorPool.DescriptorIntPair(this, number));
+      return binarySearch(
+          valuesSortedByNumber, distinctNumbers, EnumValueDescriptor.NUMBER_GETTER, number);
+    }
+
+    private static class UnknownEnumValueReference extends WeakReference<EnumValueDescriptor> {
+      private final int number;
+
+      private UnknownEnumValueReference(int number, EnumValueDescriptor descriptor) {
+        super(descriptor);
+        this.number = number;
+      }
     }
 
     /**
@@ -1754,43 +1836,28 @@
       }
       // The number represents an unknown enum value.
       synchronized (this) {
-        // Descriptors are compared by object identity so for the same number
-        // we need to return the same EnumValueDescriptor object. This means
-        // we have to store created EnumValueDescriptors. However, as there
-        // are potentially 2G unknown enum values, storing all of these
-        // objects persistently will consume lots of memory for long-running
-        // services and it's also unnecessary as not many EnumValueDescriptors
-        // will be used at the same time.
-        //
-        // To solve the problem we take advantage of Java's weak references and
-        // rely on gc to release unused descriptors.
-        //
-        // Here is how it works:
-        //   * We store unknown EnumValueDescriptors in a WeakHashMap with the
-        //     value being a weak reference to the descriptor.
-        //   * The descriptor holds a strong reference to the key so as long
-        //     as the EnumValueDescriptor is in use, the key will be there
-        //     and the corresponding map entry will be there. Following-up
-        //     queries with the same number will return the same descriptor.
-        //   * If the user no longer uses an unknown EnumValueDescriptor,
-        //     it will be gc-ed since we only hold a weak reference to it in
-        //     the map. The key in the corresponding map entry will also be
-        //     gc-ed as the only strong reference to it is in the descriptor
-        //     which is just gc-ed. With the key being gone WeakHashMap will
-        //     then remove the whole entry. This way unknown descriptors will
-        //     be freed automatically and we don't need to do anything to
-        //     clean-up unused map entries.
-
-        // Note: We must use "new Integer(number)" here because we don't want
-        // these Integer objects to be cached.
-        Integer key = new Integer(number);
-        WeakReference<EnumValueDescriptor> reference = unknownValues.get(key);
-        if (reference != null) {
-          result = reference.get();
+        if (cleanupQueue == null) {
+          cleanupQueue = new ReferenceQueue<EnumValueDescriptor>();
+          unknownValues = new HashMap<Integer, WeakReference<EnumValueDescriptor>>();
+        } else {
+          while (true) {
+            UnknownEnumValueReference toClean = (UnknownEnumValueReference) cleanupQueue.poll();
+            if (toClean == null) {
+              break;
+            }
+            unknownValues.remove(toClean.number);
+          }
         }
+
+        // There are two ways we can be missing a value: it wasn't in the map, or the reference
+        // has been GC'd.  (It may even have been GC'd since we cleaned up the references a few
+        // lines of code ago.)  So get out the reference, if it's still present...
+        WeakReference<EnumValueDescriptor> reference = unknownValues.get(number);
+        result = (reference == null) ? null : reference.get();
+
         if (result == null) {
-          result = new EnumValueDescriptor(file, this, key);
-          unknownValues.put(key, new WeakReference<EnumValueDescriptor>(result));
+          result = new EnumValueDescriptor(this, number);
+          unknownValues.put(number, new UnknownEnumValueReference(number, result));
         }
       }
       return result;
@@ -1806,9 +1873,11 @@
     private final String fullName;
     private final FileDescriptor file;
     private final Descriptor containingType;
-    private EnumValueDescriptor[] values;
-    private final WeakHashMap<Integer, WeakReference<EnumValueDescriptor>> unknownValues =
-        new WeakHashMap<>();
+    private final EnumValueDescriptor[] values;
+    private final EnumValueDescriptor[] valuesSortedByNumber;
+    private final int distinctNumbers;
+    private Map<Integer, WeakReference<EnumValueDescriptor>> unknownValues = null;
+    private ReferenceQueue<EnumValueDescriptor> cleanupQueue = null;
 
     private EnumDescriptor(
         final EnumDescriptorProto proto,
@@ -1832,6 +1901,19 @@
       for (int i = 0; i < proto.getValueCount(); i++) {
         values[i] = new EnumValueDescriptor(proto.getValue(i), file, this, i);
       }
+      valuesSortedByNumber = values.clone();
+      Arrays.sort(valuesSortedByNumber, EnumValueDescriptor.BY_NUMBER);
+      // deduplicate
+      int j = 0;
+      for (int i = 1; i < proto.getValueCount(); i++) {
+        EnumValueDescriptor oldValue = valuesSortedByNumber[j];
+        EnumValueDescriptor newValue = valuesSortedByNumber[i];
+        if (oldValue.getNumber() != newValue.getNumber()) {
+          valuesSortedByNumber[++j] = newValue;
+        }
+      }
+      this.distinctNumbers = j + 1;
+      Arrays.fill(valuesSortedByNumber, distinctNumbers, proto.getValueCount(), null);
 
       file.pool.addSymbol(this);
     }
@@ -1855,6 +1937,22 @@
    */
   public static final class EnumValueDescriptor extends GenericDescriptor
       implements Internal.EnumLite {
+    static final Comparator<EnumValueDescriptor> BY_NUMBER =
+        new Comparator<EnumValueDescriptor>() {
+          @Override
+          public int compare(EnumValueDescriptor o1, EnumValueDescriptor o2) {
+            return Integer.compare(o1.getNumber(), o2.getNumber());
+          }
+        };
+
+    static final NumberGetter<EnumValueDescriptor> NUMBER_GETTER =
+        new NumberGetter<EnumValueDescriptor>() {
+          @Override
+          public int getNumber(EnumValueDescriptor enumValueDescriptor) {
+            return enumValueDescriptor.getNumber();
+          }
+        };
+
     /**
      * Get the index of this descriptor within its parent.
      *
@@ -1900,7 +1998,7 @@
     /** Get the {@link FileDescriptor} containing this descriptor. */
     @Override
     public FileDescriptor getFile() {
-      return file;
+      return type.file;
     }
 
     /** Get the value's enum type. */
@@ -1916,7 +2014,6 @@
     private final int index;
     private EnumValueDescriptorProto proto;
     private final String fullName;
-    private final FileDescriptor file;
     private final EnumDescriptor type;
 
     private EnumValueDescriptor(
@@ -1927,24 +2024,20 @@
         throws DescriptorValidationException {
       this.index = index;
       this.proto = proto;
-      this.file = file;
       type = parent;
 
       fullName = parent.getFullName() + '.' + proto.getName();
 
       file.pool.addSymbol(this);
-      file.pool.addEnumValueByNumber(this);
     }
 
     // Create an unknown enum value.
-    private EnumValueDescriptor(
-        final FileDescriptor file, final EnumDescriptor parent, final Integer number) {
+    private EnumValueDescriptor(final EnumDescriptor parent, final Integer number) {
       String name = "UNKNOWN_ENUM_VALUE_" + parent.getName() + "_" + number;
       EnumValueDescriptorProto proto =
           EnumValueDescriptorProto.newBuilder().setName(name).setNumber(number).build();
       this.index = -1;
       this.proto = proto;
-      this.file = file;
       this.type = parent;
       this.fullName = parent.getFullName() + '.' + proto.getName();
 
@@ -2156,8 +2249,9 @@
 
     private void crossLink() throws DescriptorValidationException {
       final GenericDescriptor input =
-          file.pool.lookupSymbol(
-              proto.getInputType(), this, DescriptorPool.SearchFilter.TYPES_ONLY);
+          getFile()
+              .pool
+              .lookupSymbol(proto.getInputType(), this, DescriptorPool.SearchFilter.TYPES_ONLY);
       if (!(input instanceof Descriptor)) {
         throw new DescriptorValidationException(
             this, '\"' + proto.getInputType() + "\" is not a message type.");
@@ -2165,8 +2259,9 @@
       inputType = (Descriptor) input;
 
       final GenericDescriptor output =
-          file.pool.lookupSymbol(
-              proto.getOutputType(), this, DescriptorPool.SearchFilter.TYPES_ONLY);
+          getFile()
+              .pool
+              .lookupSymbol(proto.getOutputType(), this, DescriptorPool.SearchFilter.TYPES_ONLY);
       if (!(output instanceof Descriptor)) {
         throw new DescriptorValidationException(
             this, '\"' + proto.getOutputType() + "\" is not a message type.");
@@ -2288,7 +2383,9 @@
     }
 
     DescriptorPool(final FileDescriptor[] dependencies, boolean allowUnknownDependencies) {
-      this.dependencies = new HashSet<>();
+      this.dependencies =
+          Collections.newSetFromMap(
+              new IdentityHashMap<FileDescriptor, Boolean>(dependencies.length));
       this.allowUnknownDependencies = allowUnknownDependencies;
 
       for (Descriptors.FileDescriptor dependency : dependencies) {
@@ -2321,8 +2418,6 @@
     private boolean allowUnknownDependencies;
 
     private final Map<String, GenericDescriptor> descriptorsByName = new HashMap<>();
-    private final Map<DescriptorIntPair, FieldDescriptor> fieldsByNumber = new HashMap<>();
-    private final Map<DescriptorIntPair, EnumValueDescriptor> enumValuesByNumber = new HashMap<>();
 
     /** Find a generic descriptor by fully-qualified name. */
     GenericDescriptor findSymbol(final String fullName) {
@@ -2581,68 +2676,6 @@
       }
     }
 
-    /** A (GenericDescriptor, int) pair, used as a map key. */
-    private static final class DescriptorIntPair {
-      private final GenericDescriptor descriptor;
-      private final int number;
-
-      DescriptorIntPair(final GenericDescriptor descriptor, final int number) {
-        this.descriptor = descriptor;
-        this.number = number;
-      }
-
-      @Override
-      public int hashCode() {
-        return descriptor.hashCode() * ((1 << 16) - 1) + number;
-      }
-
-      @Override
-      public boolean equals(final Object obj) {
-        if (!(obj instanceof DescriptorIntPair)) {
-          return false;
-        }
-        final DescriptorIntPair other = (DescriptorIntPair) obj;
-        return descriptor == other.descriptor && number == other.number;
-      }
-    }
-
-    /**
-     * Adds a field to the fieldsByNumber table. Throws an exception if a field with the same
-     * containing type and number already exists.
-     */
-    void addFieldByNumber(final FieldDescriptor field) throws DescriptorValidationException {
-      final DescriptorIntPair key =
-          new DescriptorIntPair(field.getContainingType(), field.getNumber());
-      final FieldDescriptor old = fieldsByNumber.put(key, field);
-      if (old != null) {
-        fieldsByNumber.put(key, old);
-        throw new DescriptorValidationException(
-            field,
-            "Field number "
-                + field.getNumber()
-                + " has already been used in \""
-                + field.getContainingType().getFullName()
-                + "\" by field \""
-                + old.getName()
-                + "\".");
-      }
-    }
-
-    /**
-     * Adds an enum value to the enumValuesByNumber table. If an enum value with the same type and
-     * number already exists, does nothing. (This is allowed; the first value define with the number
-     * takes precedence.)
-     */
-    void addEnumValueByNumber(final EnumValueDescriptor value) {
-      final DescriptorIntPair key = new DescriptorIntPair(value.getType(), value.getNumber());
-      final EnumValueDescriptor old = enumValuesByNumber.put(key, value);
-      if (old != null) {
-        enumValuesByNumber.put(key, old);
-        // Not an error:  Multiple enum values may have the same number, but
-        // we only want the first one in the map.
-      }
-    }
-
     /**
      * Verifies that the descriptor's name is valid (i.e. it contains only letters, digits, and
      * underscores, and does not start with a digit).
@@ -2660,9 +2693,10 @@
       // Subsequent characters may be letters, numbers, or digits.
       for (int i = 0; i < name.length(); i++) {
         final char c = name.charAt(i);
-        if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')
-          || (c == '_')
-          || ('0' <= c && c <= '9' && i > 0)) {
+        if (('a' <= c && c <= 'z')
+            || ('A' <= c && c <= 'Z')
+            || (c == '_')
+            || ('0' <= c && c <= '9' && i > 0)) {
           // Valid
           continue;
         }
@@ -2752,4 +2786,27 @@
     private int fieldCount;
     private FieldDescriptor[] fields;
   }
+
+  private static <T> T binarySearch(T[] array, int size, NumberGetter<T> getter, int number) {
+    int left = 0;
+    int right = size - 1;
+
+    while (left <= right) {
+      int mid = (left + right) / 2;
+      T midValue = array[mid];
+      int midValueNumber = getter.getNumber(midValue);
+      if (number < midValueNumber) {
+        right = mid - 1;
+      } else if (number > midValueNumber) {
+        left = mid + 1;
+      } else {
+        return midValue;
+      }
+    }
+    return null;
+  }
+
+  private interface NumberGetter<T> {
+    int getNumber(T t);
+  }
 }
diff --git a/java/core/src/main/java/com/google/protobuf/FieldSet.java b/java/core/src/main/java/com/google/protobuf/FieldSet.java
index 4853df2..8d11360 100644
--- a/java/core/src/main/java/com/google/protobuf/FieldSet.java
+++ b/java/core/src/main/java/com/google/protobuf/FieldSet.java
@@ -1081,8 +1081,7 @@
 
         // Wrap the contents in a new list so that the caller cannot change
         // the list's contents after setting it.
-        final List newList = new ArrayList();
-        newList.addAll((List) value);
+        final List newList = new ArrayList((List) value);
         for (final Object element : newList) {
           verifyType(descriptor, element);
           hasNestedBuilders = hasNestedBuilders || element instanceof MessageLite.Builder;
diff --git a/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java b/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
index f54b123..46427b3 100644
--- a/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
+++ b/java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
@@ -43,14 +43,14 @@
 import com.google.protobuf.Internal.FloatList;
 import com.google.protobuf.Internal.IntList;
 import com.google.protobuf.Internal.LongList;
-// In opensource protobuf, we have versioned this GeneratedMessageV3 class to GeneratedMessageV3V3 and
-// in the future may have GeneratedMessageV3V4 etc. This allows us to change some aspects of this
+// In opensource protobuf, we have versioned this GeneratedMessageV3 class to GeneratedMessageV3 and
+// in the future may have GeneratedMessageV4 etc. This allows us to change some aspects of this
 // class without breaking binary compatibility with old generated code that still subclasses
-// the old GeneratedMessageV3 class. To allow these different GeneratedMessageV3V? classes to
-// interoperate (e.g., a GeneratedMessageV3V3 object has a message extension field whose class
-// type is GeneratedMessageV3V4), these classes still share a common parent class AbstractMessage
+// the old GeneratedMessageV3 class. To allow these different GeneratedMessageV? classes to
+// interoperate (e.g., a GeneratedMessageV3 object has a message extension field whose class
+// type is GeneratedMessageV4), these classes still share a common parent class AbstractMessage
 // and are using the same GeneratedMessage.GeneratedExtension class for extension definitions.
-// Since this class becomes GeneratedMessageV3V? in opensource, we have to add an import here
+// Since this class becomes GeneratedMessageV? in opensource, we have to add an import here
 // to be able to use GeneratedMessage.GeneratedExtension. The GeneratedExtension definition in
 // this file is also excluded from opensource to avoid conflict.
 import com.google.protobuf.GeneratedMessage.GeneratedExtension;
diff --git a/java/core/src/main/java/com/google/protobuf/Internal.java b/java/core/src/main/java/com/google/protobuf/Internal.java
index 90643b8..07e8dd1 100644
--- a/java/core/src/main/java/com/google/protobuf/Internal.java
+++ b/java/core/src/main/java/com/google/protobuf/Internal.java
@@ -54,6 +54,7 @@
 
   private Internal() {}
 
+  static final Charset US_ASCII = Charset.forName("US-ASCII");
   static final Charset UTF_8 = Charset.forName("UTF-8");
   static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
 
diff --git a/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java b/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java
index 4b43033..118a1e8 100644
--- a/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java
+++ b/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java
@@ -134,7 +134,7 @@
     return new InvalidWireTypeException("Protocol message tag had invalid wire type.");
   }
 
-  /** Exception indicating that and unexpected wire type was encountered for a field. */
+  /** Exception indicating that an unexpected wire type was encountered for a field. */
   @ExperimentalApi
   public static class InvalidWireTypeException extends InvalidProtocolBufferException {
     private static final long serialVersionUID = 3283890091615336259L;
diff --git a/java/core/src/main/java/com/google/protobuf/MapFieldLite.java b/java/core/src/main/java/com/google/protobuf/MapFieldLite.java
index a9fec4d..f792ae9 100644
--- a/java/core/src/main/java/com/google/protobuf/MapFieldLite.java
+++ b/java/core/src/main/java/com/google/protobuf/MapFieldLite.java
@@ -64,7 +64,7 @@
     EMPTY_MAP_FIELD.makeImmutable();
   }
 
-  /** Returns an singleton immutable empty MapFieldLite instance. */
+  /** Returns a singleton immutable empty MapFieldLite instance. */
   @SuppressWarnings({"unchecked", "cast"})
   public static <K, V> MapFieldLite<K, V> emptyMapField() {
     return (MapFieldLite<K, V>) EMPTY_MAP_FIELD;
diff --git a/java/core/src/main/java/com/google/protobuf/MessageLite.java b/java/core/src/main/java/com/google/protobuf/MessageLite.java
index 7d2ef33..bbf3036 100644
--- a/java/core/src/main/java/com/google/protobuf/MessageLite.java
+++ b/java/core/src/main/java/com/google/protobuf/MessageLite.java
@@ -73,6 +73,9 @@
   /**
    * Get the number of bytes required to encode this message. The result is only computed on the
    * first call and memoized after that.
+   *
+   * If this message requires more than Integer.MAX_VALUE bytes to encode, the return value will
+   * be smaller than the actual number of bytes required and might be negative.
    */
   int getSerializedSize();
 
@@ -85,12 +88,18 @@
   /**
    * Serializes the message to a {@code ByteString} and returns it. This is just a trivial wrapper
    * around {@link #writeTo(CodedOutputStream)}.
+   *
+   * If this message requires more than Integer.MAX_VALUE bytes to encode, the behavior is
+   * unpredictable. It may throw a runtime exception or truncate or slice the data.
    */
   ByteString toByteString();
 
   /**
    * Serializes the message to a {@code byte} array and returns it. This is just a trivial wrapper
    * around {@link #writeTo(CodedOutputStream)}.
+   *
+   * If this message requires more than Integer.MAX_VALUE bytes to encode, the behavior is
+   * unpredictable. It may throw a runtime exception or truncate or slice the data.
    */
   byte[] toByteArray();
 
diff --git a/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java b/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java
index 4aea952..9ad6816 100644
--- a/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java
+++ b/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java
@@ -187,10 +187,10 @@
       return ((Integer) o) == 0;
     }
     if (o instanceof Float) {
-      return ((Float) o) == 0f;
+      return Float.floatToRawIntBits((Float) o) == 0;
     }
     if (o instanceof Double) {
-      return ((Double) o) == 0d;
+      return Double.doubleToRawLongBits((Double) o) == 0;
     }
     if (o instanceof String) {
       return o.equals("");
diff --git a/java/core/src/main/java/com/google/protobuf/MessageSchema.java b/java/core/src/main/java/com/google/protobuf/MessageSchema.java
index 33c8e91..4170f4f 100644
--- a/java/core/src/main/java/com/google/protobuf/MessageSchema.java
+++ b/java/core/src/main/java/com/google/protobuf/MessageSchema.java
@@ -5808,9 +5808,9 @@
       final long offset = offset(typeAndOffset);
       switch (type(typeAndOffset)) {
         case 0: // DOUBLE:
-          return UnsafeUtil.getDouble(message, offset) != 0D;
+            return Double.doubleToRawLongBits(UnsafeUtil.getDouble(message, offset)) != 0L;
         case 1: // FLOAT:
-          return UnsafeUtil.getFloat(message, offset) != 0F;
+            return Float.floatToRawIntBits(UnsafeUtil.getFloat(message, offset)) != 0;
         case 2: // INT64:
           return UnsafeUtil.getLong(message, offset) != 0L;
         case 3: // UINT64:
diff --git a/java/core/src/main/java/com/google/protobuf/SchemaUtil.java b/java/core/src/main/java/com/google/protobuf/SchemaUtil.java
index 4c8bb06..1d5e6ba 100644
--- a/java/core/src/main/java/com/google/protobuf/SchemaUtil.java
+++ b/java/core/src/main/java/com/google/protobuf/SchemaUtil.java
@@ -63,18 +63,18 @@
         && GENERATED_MESSAGE_CLASS != null
         && !GENERATED_MESSAGE_CLASS.isAssignableFrom(messageType)) {
       throw new IllegalArgumentException(
-          "Message classes must extend GeneratedMessage or GeneratedMessageLite");
+          "Message classes must extend GeneratedMessageV3 or GeneratedMessageLite");
     }
   }
 
   public static void writeDouble(int fieldNumber, double value, Writer writer) throws IOException {
-    if (Double.compare(value, 0.0) != 0) {
+    if (Double.doubleToRawLongBits(value) != 0) {
       writer.writeDouble(fieldNumber, value);
     }
   }
 
   public static void writeFloat(int fieldNumber, float value, Writer writer) throws IOException {
-    if (Float.compare(value, 0.0f) != 0) {
+    if (Float.floatToRawIntBits(value) != 0) {
       writer.writeFloat(fieldNumber, value);
     }
   }
diff --git a/java/core/src/main/java/com/google/protobuf/TextFormat.java b/java/core/src/main/java/com/google/protobuf/TextFormat.java
index e781df3..21f1ff0 100644
--- a/java/core/src/main/java/com/google/protobuf/TextFormat.java
+++ b/java/core/src/main/java/com/google/protobuf/TextFormat.java
@@ -445,9 +445,7 @@
     }
 
     /**
-     * An adapter class that can take a MapEntry or a MutableMapEntry and returns its key and entry.
-     * This class is created solely for the purpose of sorting map entries by its key and prevent
-     * duplicated logic by having a separate comparator for MapEntry and MutableMapEntry.
+     * An adapter class that can take a {@link MapEntry} and returns its key and entry.
      */
     private static class MapEntryAdapter implements Comparable<MapEntryAdapter> {
       private Object entry;
@@ -2360,6 +2358,9 @@
               case '"':
                 result[pos++] = '\"';
                 break;
+              case '?':
+                result[pos++] = '?';
+                break;
 
               case 'x':
                 // hex escape
diff --git a/java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java b/java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java
index 6ce9f78..36232e9 100644
--- a/java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java
+++ b/java/core/src/main/java/com/google/protobuf/TextFormatParseInfoTree.java
@@ -90,7 +90,7 @@
   /**
    * Retrieve all the locations of a field.
    *
-   * @param fieldDescriptor the @{link FieldDescriptor} of the desired field
+   * @param fieldDescriptor the {@link FieldDescriptor} of the desired field
    * @return a list of the locations of values of the field. If there are not values or the field
    *     doesn't exist, an empty list is returned.
    */
@@ -105,7 +105,7 @@
    * <p>Returns the {@link TextFormatParseLocation} for index-th value of the field in the parsed
    * text.
    *
-   * @param fieldDescriptor the @{link FieldDescriptor} of the desired field
+   * @param fieldDescriptor the {@link FieldDescriptor} of the desired field
    * @param index the index of the value.
    * @return the {@link TextFormatParseLocation} of the value
    * @throws IllegalArgumentException index is out of range
@@ -117,7 +117,7 @@
   /**
    * Retrieve a list of all the location information trees for a sub message field.
    *
-   * @param fieldDescriptor the @{link FieldDescriptor} of the desired field
+   * @param fieldDescriptor the {@link FieldDescriptor} of the desired field
    * @return A list of {@link TextFormatParseInfoTree}
    */
   public List<TextFormatParseInfoTree> getNestedTrees(final FieldDescriptor fieldDescriptor) {
@@ -128,7 +128,7 @@
   /**
    * Returns the parse info tree for the given field, which must be a message type.
    *
-   * @param fieldDescriptor the @{link FieldDescriptor} of the desired sub message
+   * @param fieldDescriptor the {@link FieldDescriptor} of the desired sub message
    * @param index the index of message value.
    * @return the {@code ParseInfoTree} of the message value. {@code null} is returned if the field
    *     doesn't exist or the index is out of range.
diff --git a/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java b/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java
index ba2f9df..5c482d6 100644
--- a/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java
+++ b/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java
@@ -43,13 +43,13 @@
 import java.util.TreeMap;
 
 /**
- * {@code UnknownFieldSet} is used to keep track of fields which were seen when parsing a protocol
+ * {@code UnknownFieldSet} keeps track of fields which were seen when parsing a protocol
  * message but whose field numbers or types are unrecognized. This most frequently occurs when new
  * fields are added to a message type and then messages containing those fields are read by old
  * software that was compiled before the new types were added.
  *
  * <p>Every {@link Message} contains an {@code UnknownFieldSet} (and every {@link Message.Builder}
- * contains an {@link Builder}).
+ * contains a {@link Builder}).
  *
  * <p>Most users will never need to use this class.
  *
@@ -57,9 +57,13 @@
  */
 public final class UnknownFieldSet implements MessageLite {
 
-  private UnknownFieldSet() {
-    fields = null;
-    fieldsDescending = null;
+  private final TreeMap<Integer, Field> fields;
+
+  /**
+   * Construct an {@code UnknownFieldSet} around the given map.
+   */
+  UnknownFieldSet(TreeMap<Integer, Field> fields) {
+    this.fields = fields;
   }
 
   /** Create a new {@link Builder}. */
@@ -68,7 +72,7 @@
   }
 
   /** Create a new {@link Builder} and initialize it to be a copy of {@code copyFrom}. */
-  public static Builder newBuilder(final UnknownFieldSet copyFrom) {
+  public static Builder newBuilder(UnknownFieldSet copyFrom) {
     return newBuilder().mergeFrom(copyFrom);
   }
 
@@ -83,25 +87,11 @@
   }
 
   private static final UnknownFieldSet defaultInstance =
-      new UnknownFieldSet(
-          Collections.<Integer, Field>emptyMap(), Collections.<Integer, Field>emptyMap());
-
-  /**
-   * Construct an {@code UnknownFieldSet} around the given map. The map is expected to be immutable.
-   */
-  UnknownFieldSet(final Map<Integer, Field> fields, final Map<Integer, Field> fieldsDescending) {
-    this.fields = fields;
-    this.fieldsDescending = fieldsDescending;
-  }
-
-  private final Map<Integer, Field> fields;
-
-  /** A copy of {@link #fields} who's iterator order is reversed. */
-  private final Map<Integer, Field> fieldsDescending;
+      new UnknownFieldSet(new TreeMap<Integer, Field>());
 
 
   @Override
-  public boolean equals(final Object other) {
+  public boolean equals(Object other) {
     if (this == other) {
       return true;
     }
@@ -110,29 +100,33 @@
 
   @Override
   public int hashCode() {
+    if (fields.isEmpty()) { // avoid allocation of iterator.
+      // This optimization may not be helpful but it is needed for the allocation tests to pass.
+      return 0;
+    }
     return fields.hashCode();
   }
 
   /** Get a map of fields in the set by number. */
   public Map<Integer, Field> asMap() {
-    return fields;
+    return (Map<Integer, Field>) fields.clone();
   }
 
   /** Check if the given field number is present in the set. */
-  public boolean hasField(final int number) {
+  public boolean hasField(int number) {
     return fields.containsKey(number);
   }
 
   /** Get a field by number. Returns an empty field if not present. Never returns {@code null}. */
-  public Field getField(final int number) {
-    final Field result = fields.get(number);
+  public Field getField(int number) {
+    Field result = fields.get(number);
     return (result == null) ? Field.getDefaultInstance() : result;
   }
 
   /** Serializes the set and writes it to {@code output}. */
   @Override
-  public void writeTo(final CodedOutputStream output) throws IOException {
-    for (final Map.Entry<Integer, Field> entry : fields.entrySet()) {
+  public void writeTo(CodedOutputStream output) throws IOException {
+    for (Map.Entry<Integer, Field> entry : fields.entrySet()) {
       Field field = entry.getValue();
       field.writeTo(entry.getKey(), output);
     }
@@ -154,10 +148,10 @@
   @Override
   public ByteString toByteString() {
     try {
-      final ByteString.CodedBuilder out = ByteString.newCodedBuilder(getSerializedSize());
+      ByteString.CodedBuilder out = ByteString.newCodedBuilder(getSerializedSize());
       writeTo(out.getCodedOutput());
       return out.build();
-    } catch (final IOException e) {
+    } catch (IOException e) {
       throw new RuntimeException(
           "Serializing to a ByteString threw an IOException (should never happen).", e);
     }
@@ -170,12 +164,12 @@
   @Override
   public byte[] toByteArray() {
     try {
-      final byte[] result = new byte[getSerializedSize()];
-      final CodedOutputStream output = CodedOutputStream.newInstance(result);
+      byte[] result = new byte[getSerializedSize()];
+      CodedOutputStream output = CodedOutputStream.newInstance(result);
       writeTo(output);
       output.checkNoSpaceLeft();
       return result;
-    } catch (final IOException e) {
+    } catch (IOException e) {
       throw new RuntimeException(
           "Serializing to a byte array threw an IOException (should never happen).", e);
     }
@@ -186,16 +180,16 @@
    * {@link #writeTo(CodedOutputStream)}.
    */
   @Override
-  public void writeTo(final OutputStream output) throws IOException {
-    final CodedOutputStream codedOutput = CodedOutputStream.newInstance(output);
+  public void writeTo(OutputStream output) throws IOException {
+    CodedOutputStream codedOutput = CodedOutputStream.newInstance(output);
     writeTo(codedOutput);
     codedOutput.flush();
   }
 
   @Override
   public void writeDelimitedTo(OutputStream output) throws IOException {
-    final CodedOutputStream codedOutput = CodedOutputStream.newInstance(output);
-    codedOutput.writeRawVarint32(getSerializedSize());
+    CodedOutputStream codedOutput = CodedOutputStream.newInstance(output);
+    codedOutput.writeUInt32NoTag(getSerializedSize());
     writeTo(codedOutput);
     codedOutput.flush();
   }
@@ -204,15 +198,17 @@
   @Override
   public int getSerializedSize() {
     int result = 0;
-    for (final Map.Entry<Integer, Field> entry : fields.entrySet()) {
-      result += entry.getValue().getSerializedSize(entry.getKey());
+    if (!fields.isEmpty()) {
+      for (Map.Entry<Integer, Field> entry : fields.entrySet()) {
+        result += entry.getValue().getSerializedSize(entry.getKey());
+      }
     }
     return result;
   }
 
   /** Serializes the set and writes it to {@code output} using {@code MessageSet} wire format. */
-  public void writeAsMessageSetTo(final CodedOutputStream output) throws IOException {
-    for (final Map.Entry<Integer, Field> entry : fields.entrySet()) {
+  public void writeAsMessageSetTo(CodedOutputStream output) throws IOException {
+    for (Map.Entry<Integer, Field> entry : fields.entrySet()) {
       entry.getValue().writeAsMessageSetExtensionTo(entry.getKey(), output);
     }
   }
@@ -221,7 +217,7 @@
   void writeTo(Writer writer) throws IOException {
     if (writer.fieldOrder() == Writer.FieldOrder.DESCENDING) {
       // Write fields in descending order.
-      for (Map.Entry<Integer, Field> entry : fieldsDescending.entrySet()) {
+      for (Map.Entry<Integer, Field> entry : fields.descendingMap().entrySet()) {
         entry.getValue().writeTo(entry.getKey(), writer);
       }
     } else {
@@ -233,15 +229,15 @@
   }
 
   /** Serializes the set and writes it to {@code writer} using {@code MessageSet} wire format. */
-  void writeAsMessageSetTo(final Writer writer) throws IOException {
+  void writeAsMessageSetTo(Writer writer) throws IOException {
     if (writer.fieldOrder() == Writer.FieldOrder.DESCENDING) {
       // Write fields in descending order.
-      for (final Map.Entry<Integer, Field> entry : fieldsDescending.entrySet()) {
+      for (Map.Entry<Integer, Field> entry : fields.descendingMap().entrySet()) {
         entry.getValue().writeAsMessageSetExtensionTo(entry.getKey(), writer);
       }
     } else {
       // Write fields in ascending order.
-      for (final Map.Entry<Integer, Field> entry : fields.entrySet()) {
+      for (Map.Entry<Integer, Field> entry : fields.entrySet()) {
         entry.getValue().writeAsMessageSetExtensionTo(entry.getKey(), writer);
       }
     }
@@ -250,7 +246,7 @@
   /** Get the number of bytes required to encode this set using {@code MessageSet} wire format. */
   public int getSerializedSizeAsMessageSet() {
     int result = 0;
-    for (final Map.Entry<Integer, Field> entry : fields.entrySet()) {
+    for (Map.Entry<Integer, Field> entry : fields.entrySet()) {
       result += entry.getValue().getSerializedSizeAsMessageSetExtension(entry.getKey());
     }
     return result;
@@ -264,23 +260,23 @@
   }
 
   /** Parse an {@code UnknownFieldSet} from the given input stream. */
-  public static UnknownFieldSet parseFrom(final CodedInputStream input) throws IOException {
+  public static UnknownFieldSet parseFrom(CodedInputStream input) throws IOException {
     return newBuilder().mergeFrom(input).build();
   }
 
   /** Parse {@code data} as an {@code UnknownFieldSet} and return it. */
-  public static UnknownFieldSet parseFrom(final ByteString data)
+  public static UnknownFieldSet parseFrom(ByteString data)
       throws InvalidProtocolBufferException {
     return newBuilder().mergeFrom(data).build();
   }
 
   /** Parse {@code data} as an {@code UnknownFieldSet} and return it. */
-  public static UnknownFieldSet parseFrom(final byte[] data) throws InvalidProtocolBufferException {
+  public static UnknownFieldSet parseFrom(byte[] data) throws InvalidProtocolBufferException {
     return newBuilder().mergeFrom(data).build();
   }
 
   /** Parse an {@code UnknownFieldSet} from {@code input} and return it. */
-  public static UnknownFieldSet parseFrom(final InputStream input) throws IOException {
+  public static UnknownFieldSet parseFrom(InputStream input) throws IOException {
     return newBuilder().mergeFrom(input).build();
   }
 
@@ -309,64 +305,43 @@
     // This constructor should never be called directly (except from 'create').
     private Builder() {}
 
-    private Map<Integer, Field> fields;
-
-    // Optimization:  We keep around a builder for the last field that was
-    //   modified so that we can efficiently add to it multiple times in a
-    //   row (important when parsing an unknown repeated field).
-    private int lastFieldNumber;
-    private Field.Builder lastField;
+    private TreeMap<Integer, Field.Builder> fieldBuilders = new TreeMap<>();
 
     private static Builder create() {
-      Builder builder = new Builder();
-      builder.reinitialize();
-      return builder;
+      return new Builder();
     }
 
     /**
      * Get a field builder for the given field number which includes any values that already exist.
      */
-    private Field.Builder getFieldBuilder(final int number) {
-      if (lastField != null) {
-        if (number == lastFieldNumber) {
-          return lastField;
-        }
-        // Note:  addField() will reset lastField and lastFieldNumber.
-        addField(lastFieldNumber, lastField.build());
-      }
+    private Field.Builder getFieldBuilder(int number) {
       if (number == 0) {
         return null;
       } else {
-        final Field existing = fields.get(number);
-        lastFieldNumber = number;
-        lastField = Field.newBuilder();
-        if (existing != null) {
-          lastField.mergeFrom(existing);
+        Field.Builder builder = fieldBuilders.get(number);
+        if (builder == null) {
+          builder = Field.newBuilder();
+          fieldBuilders.put(number, builder);
         }
-        return lastField;
+        return builder;
       }
     }
 
     /**
      * Build the {@link UnknownFieldSet} and return it.
-     *
-     * <p>Once {@code build()} has been called, the {@code Builder} will no longer be usable.
-     * Calling any method after {@code build()} will result in undefined behavior and can cause a
-     * {@code NullPointerException} to be thrown.
      */
     @Override
     public UnknownFieldSet build() {
-      getFieldBuilder(0); // Force lastField to be built.
-      final UnknownFieldSet result;
-      if (fields.isEmpty()) {
+      UnknownFieldSet result;
+      if (fieldBuilders.isEmpty()) {
         result = getDefaultInstance();
       } else {
-        Map<Integer, Field> descendingFields = null;
-        descendingFields =
-            Collections.unmodifiableMap(((TreeMap<Integer, Field>) fields).descendingMap());
-        result = new UnknownFieldSet(Collections.unmodifiableMap(fields), descendingFields);
+        TreeMap<Integer, Field> fields = new TreeMap<>();
+        for (Map.Entry<Integer, Field.Builder> entry : fieldBuilders.entrySet()) {
+          fields.put(entry.getKey(), entry.getValue().build());
+        }
+        result = new UnknownFieldSet(fields);
       }
-      fields = null;
       return result;
     }
 
@@ -378,11 +353,13 @@
 
     @Override
     public Builder clone() {
-      getFieldBuilder(0); // Force lastField to be built.
-      Map<Integer, Field> descendingFields = null;
-      descendingFields =
-          Collections.unmodifiableMap(((TreeMap<Integer, Field>) fields).descendingMap());
-      return UnknownFieldSet.newBuilder().mergeFrom(new UnknownFieldSet(fields, descendingFields));
+      Builder clone = UnknownFieldSet.newBuilder();
+      for (Map.Entry<Integer, Field.Builder> entry : fieldBuilders.entrySet()) {
+        Integer key = entry.getKey();
+        Field.Builder value = entry.getValue();
+        clone.fieldBuilders.put(key, value.clone());
+      }
+      return clone;
     }
 
     @Override
@@ -390,31 +367,24 @@
       return UnknownFieldSet.getDefaultInstance();
     }
 
-    private void reinitialize() {
-      fields = Collections.emptyMap();
-      lastFieldNumber = 0;
-      lastField = null;
-    }
-
     /** Reset the builder to an empty set. */
     @Override
     public Builder clear() {
-      reinitialize();
+      fieldBuilders = new TreeMap<>();
       return this;
     }
 
-    /** Clear fields from the set with a given field number. */
-    public Builder clearField(final int number) {
-      if (number == 0) {
-        throw new IllegalArgumentException("Zero is not a valid field number.");
+    /**
+     * Clear fields from the set with a given field number.
+     *
+     * @throws IllegalArgumentException if number is not positive
+     */
+    public Builder clearField(int number) {
+      if (number <= 0) {
+        throw new IllegalArgumentException(number + " is not a valid field number.");
       }
-      if (lastField != null && lastFieldNumber == number) {
-        // Discard this.
-        lastField = null;
-        lastFieldNumber = 0;
-      }
-      if (fields.containsKey(number)) {
-        fields.remove(number);
+      if (fieldBuilders.containsKey(number)) {
+        fieldBuilders.remove(number);
       }
       return this;
     }
@@ -423,9 +393,9 @@
      * Merge the fields from {@code other} into this set. If a field number exists in both sets,
      * {@code other}'s values for that field will be appended to the values in this set.
      */
-    public Builder mergeFrom(final UnknownFieldSet other) {
+    public Builder mergeFrom(UnknownFieldSet other) {
       if (other != getDefaultInstance()) {
-        for (final Map.Entry<Integer, Field> entry : other.fields.entrySet()) {
+        for (Map.Entry<Integer, Field> entry : other.fields.entrySet()) {
           mergeField(entry.getKey(), entry.getValue());
         }
       }
@@ -435,10 +405,12 @@
     /**
      * Add a field to the {@code UnknownFieldSet}. If a field with the same number already exists,
      * the two are merged.
+     *
+     * @throws IllegalArgumentException if number is not positive
      */
-    public Builder mergeField(final int number, final Field field) {
-      if (number == 0) {
-        throw new IllegalArgumentException("Zero is not a valid field number.");
+    public Builder mergeField(int number, final Field field) {
+      if (number <= 0) {
+        throw new IllegalArgumentException(number + " is not a valid field number.");
       }
       if (hasField(number)) {
         getFieldBuilder(number).mergeFrom(field);
@@ -454,10 +426,12 @@
     /**
      * Convenience method for merging a new field containing a single varint value. This is used in
      * particular when an unknown enum value is encountered.
+     *
+     * @throws IllegalArgumentException if number is not positive
      */
-    public Builder mergeVarintField(final int number, final int value) {
-      if (number == 0) {
-        throw new IllegalArgumentException("Zero is not a valid field number.");
+    public Builder mergeVarintField(int number, int value) {
+      if (number <= 0) {
+        throw new IllegalArgumentException(number + " is not a valid field number.");
       }
       getFieldBuilder(number).addVarint(value);
       return this;
@@ -467,40 +441,33 @@
      * Convenience method for merging a length-delimited field.
      *
      * <p>For use by generated code only.
+     *
+     * @throws IllegalArgumentException if number is not positive
      */
-    public Builder mergeLengthDelimitedField(final int number, final ByteString value) {
-      if (number == 0) {
-        throw new IllegalArgumentException("Zero is not a valid field number.");
+    public Builder mergeLengthDelimitedField(int number, ByteString value) {
+      if (number <= 0) {
+        throw new IllegalArgumentException(number + " is not a valid field number.");
       }
       getFieldBuilder(number).addLengthDelimited(value);
       return this;
     }
 
     /** Check if the given field number is present in the set. */
-    public boolean hasField(final int number) {
-      if (number == 0) {
-        throw new IllegalArgumentException("Zero is not a valid field number.");
-      }
-      return number == lastFieldNumber || fields.containsKey(number);
+    public boolean hasField(int number) {
+      return fieldBuilders.containsKey(number);
     }
 
     /**
      * Add a field to the {@code UnknownFieldSet}. If a field with the same number already exists,
      * it is removed.
+     *
+     * @throws IllegalArgumentException if number is not positive
      */
-    public Builder addField(final int number, final Field field) {
-      if (number == 0) {
-        throw new IllegalArgumentException("Zero is not a valid field number.");
+    public Builder addField(int number, Field field) {
+      if (number <= 0) {
+        throw new IllegalArgumentException(number + " is not a valid field number.");
       }
-      if (lastField != null && lastFieldNumber == number) {
-        // Discard this.
-        lastField = null;
-        lastFieldNumber = 0;
-      }
-      if (fields.isEmpty()) {
-        fields = new TreeMap<Integer, Field>();
-      }
-      fields.put(number, field);
+      fieldBuilders.put(number, Field.newBuilder(field));
       return this;
     }
 
@@ -509,15 +476,18 @@
      * changes may or may not be reflected in this map.
      */
     public Map<Integer, Field> asMap() {
-      getFieldBuilder(0); // Force lastField to be built.
+      TreeMap<Integer, Field> fields = new TreeMap<>();
+      for (Map.Entry<Integer, Field.Builder> entry : fieldBuilders.entrySet()) {
+        fields.put(entry.getKey(), entry.getValue().build());
+      }
       return Collections.unmodifiableMap(fields);
     }
 
     /** Parse an entire message from {@code input} and merge its fields into this set. */
     @Override
-    public Builder mergeFrom(final CodedInputStream input) throws IOException {
+    public Builder mergeFrom(CodedInputStream input) throws IOException {
       while (true) {
-        final int tag = input.readTag();
+        int tag = input.readTag();
         if (tag == 0 || !mergeFieldFrom(tag, input)) {
           break;
         }
@@ -531,8 +501,8 @@
      * @param tag The field's tag number, which was already parsed.
      * @return {@code false} if the tag is an end group tag.
      */
-    public boolean mergeFieldFrom(final int tag, final CodedInputStream input) throws IOException {
-      final int number = WireFormat.getTagFieldNumber(tag);
+    public boolean mergeFieldFrom(int tag, CodedInputStream input) throws IOException {
+      int number = WireFormat.getTagFieldNumber(tag);
       switch (WireFormat.getTagWireType(tag)) {
         case WireFormat.WIRETYPE_VARINT:
           getFieldBuilder(number).addVarint(input.readInt64());
@@ -544,7 +514,7 @@
           getFieldBuilder(number).addLengthDelimited(input.readBytes());
           return true;
         case WireFormat.WIRETYPE_START_GROUP:
-          final Builder subBuilder = newBuilder();
+          Builder subBuilder = newBuilder();
           input.readGroup(number, subBuilder, ExtensionRegistry.getEmptyRegistry());
           getFieldBuilder(number).addGroup(subBuilder.build());
           return true;
@@ -563,15 +533,15 @@
      * is just a small wrapper around {@link #mergeFrom(CodedInputStream)}.
      */
     @Override
-    public Builder mergeFrom(final ByteString data) throws InvalidProtocolBufferException {
+    public Builder mergeFrom(ByteString data) throws InvalidProtocolBufferException {
       try {
-        final CodedInputStream input = data.newCodedInput();
+        CodedInputStream input = data.newCodedInput();
         mergeFrom(input);
         input.checkLastTagWas(0);
         return this;
-      } catch (final InvalidProtocolBufferException e) {
+      } catch (InvalidProtocolBufferException e) {
         throw e;
-      } catch (final IOException e) {
+      } catch (IOException e) {
         throw new RuntimeException(
             "Reading from a ByteString threw an IOException (should never happen).", e);
       }
@@ -582,15 +552,15 @@
      * is just a small wrapper around {@link #mergeFrom(CodedInputStream)}.
      */
     @Override
-    public Builder mergeFrom(final byte[] data) throws InvalidProtocolBufferException {
+    public Builder mergeFrom(byte[] data) throws InvalidProtocolBufferException {
       try {
-        final CodedInputStream input = CodedInputStream.newInstance(data);
+        CodedInputStream input = CodedInputStream.newInstance(data);
         mergeFrom(input);
         input.checkLastTagWas(0);
         return this;
-      } catch (final InvalidProtocolBufferException e) {
+      } catch (InvalidProtocolBufferException e) {
         throw e;
-      } catch (final IOException e) {
+      } catch (IOException e) {
         throw new RuntimeException(
             "Reading from a byte array threw an IOException (should never happen).", e);
       }
@@ -601,8 +571,8 @@
      * This is just a small wrapper around {@link #mergeFrom(CodedInputStream)}.
      */
     @Override
-    public Builder mergeFrom(final InputStream input) throws IOException {
-      final CodedInputStream codedInput = CodedInputStream.newInstance(input);
+    public Builder mergeFrom(InputStream input) throws IOException {
+      CodedInputStream codedInput = CodedInputStream.newInstance(input);
       mergeFrom(codedInput);
       codedInput.checkLastTagWas(0);
       return this;
@@ -610,12 +580,12 @@
 
     @Override
     public boolean mergeDelimitedFrom(InputStream input) throws IOException {
-      final int firstByte = input.read();
+      int firstByte = input.read();
       if (firstByte == -1) {
         return false;
       }
-      final int size = CodedInputStream.readRawVarint32(firstByte, input);
-      final InputStream limitedInput = new LimitedInputStream(input, size);
+      int size = CodedInputStream.readRawVarint32(firstByte, input);
+      InputStream limitedInput = new LimitedInputStream(input, size);
       mergeFrom(limitedInput);
       return true;
     }
@@ -644,7 +614,7 @@
     @Override
     public Builder mergeFrom(byte[] data, int off, int len) throws InvalidProtocolBufferException {
       try {
-        final CodedInputStream input = CodedInputStream.newInstance(data, off, len);
+        CodedInputStream input = CodedInputStream.newInstance(data, off, len);
         mergeFrom(input);
         input.checkLastTagWas(0);
         return this;
@@ -718,7 +688,7 @@
     }
 
     /** Construct a new {@link Builder} and initialize it to a copy of {@code copyFrom}. */
-    public static Builder newBuilder(final Field copyFrom) {
+    public static Builder newBuilder(Field copyFrom) {
       return newBuilder().mergeFrom(copyFrom);
     }
 
@@ -758,7 +728,7 @@
     }
 
     @Override
-    public boolean equals(final Object other) {
+    public boolean equals(Object other) {
       if (this == other) {
         return true;
       }
@@ -785,7 +755,7 @@
     public ByteString toByteString(int fieldNumber) {
       try {
         // TODO(lukes): consider caching serialized size in a volatile long
-        final ByteString.CodedBuilder out =
+        ByteString.CodedBuilder out =
             ByteString.newCodedBuilder(getSerializedSize(fieldNumber));
         writeTo(fieldNumber, out.getCodedOutput());
         return out.build();
@@ -796,40 +766,40 @@
     }
 
     /** Serializes the field, including field number, and writes it to {@code output}. */
-    public void writeTo(final int fieldNumber, final CodedOutputStream output) throws IOException {
-      for (final long value : varint) {
+    public void writeTo(int fieldNumber, CodedOutputStream output) throws IOException {
+      for (long value : varint) {
         output.writeUInt64(fieldNumber, value);
       }
-      for (final int value : fixed32) {
+      for (int value : fixed32) {
         output.writeFixed32(fieldNumber, value);
       }
-      for (final long value : fixed64) {
+      for (long value : fixed64) {
         output.writeFixed64(fieldNumber, value);
       }
-      for (final ByteString value : lengthDelimited) {
+      for (ByteString value : lengthDelimited) {
         output.writeBytes(fieldNumber, value);
       }
-      for (final UnknownFieldSet value : group) {
+      for (UnknownFieldSet value : group) {
         output.writeGroup(fieldNumber, value);
       }
     }
 
     /** Get the number of bytes required to encode this field, including field number. */
-    public int getSerializedSize(final int fieldNumber) {
+    public int getSerializedSize(int fieldNumber) {
       int result = 0;
-      for (final long value : varint) {
+      for (long value : varint) {
         result += CodedOutputStream.computeUInt64Size(fieldNumber, value);
       }
-      for (final int value : fixed32) {
+      for (int value : fixed32) {
         result += CodedOutputStream.computeFixed32Size(fieldNumber, value);
       }
-      for (final long value : fixed64) {
+      for (long value : fixed64) {
         result += CodedOutputStream.computeFixed64Size(fieldNumber, value);
       }
-      for (final ByteString value : lengthDelimited) {
+      for (ByteString value : lengthDelimited) {
         result += CodedOutputStream.computeBytesSize(fieldNumber, value);
       }
-      for (final UnknownFieldSet value : group) {
+      for (UnknownFieldSet value : group) {
         result += CodedOutputStream.computeGroupSize(fieldNumber, value);
       }
       return result;
@@ -839,15 +809,15 @@
      * Serializes the field, including field number, and writes it to {@code output}, using {@code
      * MessageSet} wire format.
      */
-    public void writeAsMessageSetExtensionTo(final int fieldNumber, final CodedOutputStream output)
+    public void writeAsMessageSetExtensionTo(int fieldNumber, CodedOutputStream output)
         throws IOException {
-      for (final ByteString value : lengthDelimited) {
+      for (ByteString value : lengthDelimited) {
         output.writeRawMessageSetExtension(fieldNumber, value);
       }
     }
 
     /** Serializes the field, including field number, and writes it to {@code writer}. */
-    void writeTo(final int fieldNumber, final Writer writer) throws IOException {
+    void writeTo(int fieldNumber, Writer writer) throws IOException {
       writer.writeInt64List(fieldNumber, varint, false);
       writer.writeFixed32List(fieldNumber, fixed32, false);
       writer.writeFixed64List(fieldNumber, fixed64, false);
@@ -872,7 +842,7 @@
      * Serializes the field, including field number, and writes it to {@code writer}, using {@code
      * MessageSet} wire format.
      */
-    private void writeAsMessageSetExtensionTo(final int fieldNumber, final Writer writer)
+    private void writeAsMessageSetExtensionTo(int fieldNumber, Writer writer)
         throws IOException {
       if (writer.fieldOrder() == Writer.FieldOrder.DESCENDING) {
         // Write in descending field order.
@@ -882,7 +852,7 @@
         }
       } else {
         // Write in ascending field order.
-        for (final ByteString value : lengthDelimited) {
+        for (ByteString value : lengthDelimited) {
           writer.writeMessageSetItem(fieldNumber, value);
         }
       }
@@ -892,9 +862,9 @@
      * Get the number of bytes required to encode this field, including field number, using {@code
      * MessageSet} wire format.
      */
-    public int getSerializedSizeAsMessageSetExtension(final int fieldNumber) {
+    public int getSerializedSizeAsMessageSetExtension(int fieldNumber) {
       int result = 0;
-      for (final ByteString value : lengthDelimited) {
+      for (ByteString value : lengthDelimited) {
         result += CodedOutputStream.computeRawMessageSetExtensionSize(fieldNumber, value);
       }
       return result;
@@ -912,52 +882,85 @@
      * <p>Use {@link Field#newBuilder()} to construct a {@code Builder}.
      */
     public static final class Builder {
-      // This constructor should never be called directly (except from 'create').
-      private Builder() {}
+      // This constructor should only be called directly from 'create' and 'clone'.
+      private Builder() {
+        result = new Field();
+      }
 
       private static Builder create() {
         Builder builder = new Builder();
-        builder.result = new Field();
         return builder;
       }
 
       private Field result;
 
-      /**
-       * Build the field. After {@code build()} has been called, the {@code Builder} is no longer
-       * usable. Calling any other method will result in undefined behavior and can cause a {@code
-       * NullPointerException} to be thrown.
-       */
-      public Field build() {
+      @Override
+      public Builder clone() {
+        Field copy = new Field();
         if (result.varint == null) {
-          result.varint = Collections.emptyList();
+          copy.varint = null;
         } else {
-          result.varint = Collections.unmodifiableList(result.varint);
+          copy.varint = new ArrayList<>(result.varint);
         }
         if (result.fixed32 == null) {
-          result.fixed32 = Collections.emptyList();
+          copy.fixed32 = null;
         } else {
-          result.fixed32 = Collections.unmodifiableList(result.fixed32);
+          copy.fixed32 = new ArrayList<>(result.fixed32);
         }
         if (result.fixed64 == null) {
-          result.fixed64 = Collections.emptyList();
+          copy.fixed64 = null;
         } else {
-          result.fixed64 = Collections.unmodifiableList(result.fixed64);
+          copy.fixed64 = new ArrayList<>(result.fixed64);
         }
         if (result.lengthDelimited == null) {
-          result.lengthDelimited = Collections.emptyList();
+          copy.lengthDelimited = null;
         } else {
-          result.lengthDelimited = Collections.unmodifiableList(result.lengthDelimited);
+          copy.lengthDelimited = new ArrayList<>(result.lengthDelimited);
         }
         if (result.group == null) {
-          result.group = Collections.emptyList();
+          copy.group = null;
         } else {
-          result.group = Collections.unmodifiableList(result.group);
+          copy.group = new ArrayList<>(result.group);
         }
 
-        final Field returnMe = result;
-        result = null;
-        return returnMe;
+        Builder clone = new Builder();
+        clone.result = copy;
+        return clone;
+      }
+
+      /**
+       * Build the field.
+       */
+      public Field build() {
+        Field built = new Field();
+        if (result.varint == null) {
+          built.varint = Collections.emptyList();
+        } else {
+          built.varint = Collections.unmodifiableList(new ArrayList<>(result.varint));
+        }
+        if (result.fixed32 == null) {
+          built.fixed32 = Collections.emptyList();
+        } else {
+          built.fixed32 = Collections.unmodifiableList(new ArrayList<>(result.fixed32));
+        }
+        if (result.fixed64 == null) {
+          built.fixed64 = Collections.emptyList();
+        } else {
+          built.fixed64 = Collections.unmodifiableList(new ArrayList<>(result.fixed64));
+        }
+        if (result.lengthDelimited == null) {
+          built.lengthDelimited = Collections.emptyList();
+        } else {
+          built.lengthDelimited = Collections.unmodifiableList(
+              new ArrayList<>(result.lengthDelimited));
+        }
+        if (result.group == null) {
+          built.group = Collections.emptyList();
+        } else {
+          built.group = Collections.unmodifiableList(new ArrayList<>(result.group));
+        }
+
+        return built;
       }
 
       /** Discard the field's contents. */
@@ -970,7 +973,7 @@
        * Merge the values in {@code other} into this field. For each list of values, {@code other}'s
        * values are append to the ones in this field.
        */
-      public Builder mergeFrom(final Field other) {
+      public Builder mergeFrom(Field other) {
         if (!other.varint.isEmpty()) {
           if (result.varint == null) {
             result.varint = new ArrayList<Long>();
@@ -985,19 +988,19 @@
         }
         if (!other.fixed64.isEmpty()) {
           if (result.fixed64 == null) {
-            result.fixed64 = new ArrayList<Long>();
+            result.fixed64 = new ArrayList<>();
           }
           result.fixed64.addAll(other.fixed64);
         }
         if (!other.lengthDelimited.isEmpty()) {
           if (result.lengthDelimited == null) {
-            result.lengthDelimited = new ArrayList<ByteString>();
+            result.lengthDelimited = new ArrayList<>();
           }
           result.lengthDelimited.addAll(other.lengthDelimited);
         }
         if (!other.group.isEmpty()) {
           if (result.group == null) {
-            result.group = new ArrayList<UnknownFieldSet>();
+            result.group = new ArrayList<>();
           }
           result.group.addAll(other.group);
         }
@@ -1005,45 +1008,45 @@
       }
 
       /** Add a varint value. */
-      public Builder addVarint(final long value) {
+      public Builder addVarint(long value) {
         if (result.varint == null) {
-          result.varint = new ArrayList<Long>();
+          result.varint = new ArrayList<>();
         }
         result.varint.add(value);
         return this;
       }
 
       /** Add a fixed32 value. */
-      public Builder addFixed32(final int value) {
+      public Builder addFixed32(int value) {
         if (result.fixed32 == null) {
-          result.fixed32 = new ArrayList<Integer>();
+          result.fixed32 = new ArrayList<>();
         }
         result.fixed32.add(value);
         return this;
       }
 
       /** Add a fixed64 value. */
-      public Builder addFixed64(final long value) {
+      public Builder addFixed64(long value) {
         if (result.fixed64 == null) {
-          result.fixed64 = new ArrayList<Long>();
+          result.fixed64 = new ArrayList<>();
         }
         result.fixed64.add(value);
         return this;
       }
 
       /** Add a length-delimited value. */
-      public Builder addLengthDelimited(final ByteString value) {
+      public Builder addLengthDelimited(ByteString value) {
         if (result.lengthDelimited == null) {
-          result.lengthDelimited = new ArrayList<ByteString>();
+          result.lengthDelimited = new ArrayList<>();
         }
         result.lengthDelimited.add(value);
         return this;
       }
 
       /** Add an embedded group. */
-      public Builder addGroup(final UnknownFieldSet value) {
+      public Builder addGroup(UnknownFieldSet value) {
         if (result.group == null) {
-          result.group = new ArrayList<UnknownFieldSet>();
+          result.group = new ArrayList<>();
         }
         result.group.add(value);
         return this;
diff --git a/java/core/src/main/java/com/google/protobuf/Utf8.java b/java/core/src/main/java/com/google/protobuf/Utf8.java
index 104ab09..7c9133e 100644
--- a/java/core/src/main/java/com/google/protobuf/Utf8.java
+++ b/java/core/src/main/java/com/google/protobuf/Utf8.java
@@ -1371,29 +1371,39 @@
             String.format("buffer length=%d, index=%d, size=%d", bytes.length, index, size));
       }
 
-      int offset = index;
-      final int limit = offset + size;
+      int offset = index + unsafeEstimateConsecutiveAscii(bytes, index, size);
+      final int limit = index + size;
 
-      // The longest possible resulting String is the same as the number of input bytes, when it is
-      // all ASCII. For other cases, this over-allocates and we will truncate in the end.
-      char[] resultArr = new char[size];
-      int resultPos = 0;
-
-      // Optimize for 100% ASCII (Hotspot loves small simple top-level loops like this).
-      // This simple loop stops when we encounter a byte >= 0x80 (i.e. non-ASCII).
+      // get an "exact" consecutive ASCII
       while (offset < limit) {
         byte b = UnsafeUtil.getByte(bytes, offset);
-        if (!DecodeUtil.isOneByte(b)) {
+        if (b < 0) {
           break;
         }
         offset++;
-        DecodeUtil.handleOneByte(b, resultArr, resultPos++);
+      }
+
+      if (offset == limit) {
+        // The entire byte sequence is ASCII.  Don't bother copying to a char[], JVMs using
+        // compact strings will just turn it back into the same byte[].
+        return new String(bytes, index, size, Internal.US_ASCII);
+      }
+
+      // It's not all ASCII, at this point.  This may over-allocate, but we will truncate in the
+      // end.
+      char[] resultArr = new char[size];
+      int resultPos = 0;
+
+      // Copy over the initial run of ASCII.
+      for (int i = index; i < offset; i++) {
+        DecodeUtil.handleOneByte(UnsafeUtil.getByte(bytes, i), resultArr, resultPos++);
       }
 
       while (offset < limit) {
         byte byte1 = UnsafeUtil.getByte(bytes, offset++);
         if (DecodeUtil.isOneByte(byte1)) {
           DecodeUtil.handleOneByte(byte1, resultArr, resultPos++);
+
           // It's common for there to be multiple ASCII characters in a run mixed in, so add an
           // extra optimized loop to take care of these runs.
           while (offset < limit) {
@@ -1656,7 +1666,17 @@
         return 0;
       }
 
-      for (int i = 0; i < maxChars; i++) {
+      int i;
+      for (i = 0; i + 8 <= maxChars; i += 8) {
+        if ((UnsafeUtil.getLong(bytes, UnsafeUtil.BYTE_ARRAY_BASE_OFFSET + offset)
+                & ASCII_MASK_LONG)
+            != 0L) {
+          break;
+        }
+        offset += 8;
+      }
+
+      for (; i < maxChars; i++) {
         if (UnsafeUtil.getByte(bytes, offset++) < 0) {
           return i;
         }
@@ -1676,9 +1696,9 @@
       }
 
       // Read bytes until 8-byte aligned so that we can read longs in the loop below.
-      // We do this by ANDing the address with 7 to determine the number of bytes that need to
-      // be read before we're 8-byte aligned.
-      final int unaligned = 8 - ((int) address & 7);
+      // This is equivalent to (8-address) mod 8, the number of bytes we need to read before we're
+      // 8-byte aligned.
+      final int unaligned = (int) (-address & 7);
       for (int j = unaligned; j > 0; j--) {
         if (UnsafeUtil.getByte(address++) < 0) {
           return unaligned - j;
diff --git a/java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java b/java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java
index 458529c..800623a 100644
--- a/java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java
+++ b/java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java
@@ -49,7 +49,7 @@
 @RunWith(JUnit4.class)
 public class CheckUtf8Test {
 
-  private static final String UTF8_BYTE_STRING_TEXT = "some text";
+  private static final String UTF8_BYTE_STRING_TEXT = "some text π \uD83D\uDE00";
   private static final ByteString UTF8_BYTE_STRING = ByteString.copyFromUtf8(UTF8_BYTE_STRING_TEXT);
   private static final ByteString NON_UTF8_BYTE_STRING =
       ByteString.copyFrom(new byte[] {(byte) 0x80}); // A lone continuation byte.
diff --git a/java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java b/java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java
index 359d4d7..5a345aa 100644
--- a/java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java
+++ b/java/core/src/test/java/com/google/protobuf/DecodeUtf8Test.java
@@ -1,3 +1,33 @@
+// 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.
+
 package com.google.protobuf;
 
 import com.google.protobuf.Utf8.Processor;
@@ -28,12 +58,13 @@
 
   public void testOneByte() throws Exception {
     int valid = 0;
+    ByteBuffer buffer = ByteBuffer.allocateDirect(1);
     for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
-      ByteString bs = ByteString.copyFrom(new byte[] { (byte) i });
-      if (!bs.isValidUtf8()) {
-        assertInvalid(bs.toByteArray());
-      } else {
+      ByteString bs = ByteString.copyFrom(new byte[] {(byte) i});
+      if (bs.isValidUtf8()) {
         valid++;
+      } else {
+        assertInvalid(bs.toByteArray(), buffer);
       }
     }
     assertEquals(IsValidUtf8TestUtil.EXPECTED_ONE_BYTE_ROUNDTRIPPABLE_COUNT, valid);
@@ -41,13 +72,14 @@
 
   public void testTwoBytes() throws Exception {
     int valid = 0;
+    ByteBuffer buffer = ByteBuffer.allocateDirect(2);
     for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
       for (int j = Byte.MIN_VALUE; j <= Byte.MAX_VALUE; j++) {
-        ByteString bs = ByteString.copyFrom(new byte[]{(byte) i, (byte) j});
-        if (!bs.isValidUtf8()) {
-          assertInvalid(bs.toByteArray());
-        } else {
+        ByteString bs = ByteString.copyFrom(new byte[] {(byte) i, (byte) j});
+        if (bs.isValidUtf8()) {
           valid++;
+        } else {
+          assertInvalid(bs.toByteArray(), buffer);
         }
       }
     }
@@ -55,34 +87,30 @@
   }
 
   public void testThreeBytes() throws Exception {
-    // Travis' OOM killer doesn't like this test
-    if (System.getenv("TRAVIS") == null) {
-      int count = 0;
-      int valid = 0;
-      for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
-        for (int j = Byte.MIN_VALUE; j <= Byte.MAX_VALUE; j++) {
-          for (int k = Byte.MIN_VALUE; k <= Byte.MAX_VALUE; k++) {
-            byte[] bytes = new byte[]{(byte) i, (byte) j, (byte) k};
-            ByteString bs = ByteString.copyFrom(bytes);
-            if (!bs.isValidUtf8()) {
-              assertInvalid(bytes);
-            } else {
-              valid++;
-            }
-            count++;
-            if (count % 1000000L == 0) {
-              logger.info("Processed " + (count / 1000000L) + " million characters");
-            }
+    int count = 0;
+    int valid = 0;
+    ByteBuffer buffer = ByteBuffer.allocateDirect(3);
+    for (int i = Byte.MIN_VALUE; i <= Byte.MAX_VALUE; i++) {
+      for (int j = Byte.MIN_VALUE; j <= Byte.MAX_VALUE; j++) {
+        for (int k = Byte.MIN_VALUE; k <= Byte.MAX_VALUE; k++) {
+          byte[] bytes = new byte[] {(byte) i, (byte) j, (byte) k};
+          ByteString bs = ByteString.copyFrom(bytes);
+          if (bs.isValidUtf8()) {
+            valid++;
+          } else {
+            assertInvalid(bytes, buffer);
+          }
+          count++;
+          if (count % 1000000L == 0) {
+            logger.info("Processed " + (count / 1000000L) + " million characters");
           }
         }
       }
-      assertEquals(IsValidUtf8TestUtil.EXPECTED_THREE_BYTE_ROUNDTRIPPABLE_COUNT, valid);
     }
+    assertEquals(IsValidUtf8TestUtil.EXPECTED_THREE_BYTE_ROUNDTRIPPABLE_COUNT, valid);
   }
 
-  /**
-   * Tests that round tripping of a sample of four byte permutations work.
-   */
+  /** Tests that round tripping of a sample of four byte permutations work. */
   public void testInvalid_4BytesSamples() throws Exception {
     // Bad trailing bytes
     assertInvalid(0xF0, 0xA4, 0xAD, 0x7F);
@@ -99,8 +127,7 @@
     // German
     assertRoundTrips("Quizdeltagerne spiste jordb\u00e6r med fl\u00f8de, mens cirkusklovnen");
     // Japanese
-    assertRoundTrips(
-        "\u3044\u308d\u306f\u306b\u307b\u3078\u3068\u3061\u308a\u306c\u308b\u3092");
+    assertRoundTrips("\u3044\u308d\u306f\u306b\u307b\u3078\u3068\u3061\u308a\u306c\u308b\u3092");
     // Hebrew
     assertRoundTrips(
         "\u05d3\u05d2 \u05e1\u05e7\u05e8\u05df \u05e9\u05d8 \u05d1\u05d9\u05dd "
@@ -115,9 +142,10 @@
     assertRoundTrips(
         "\u8fd4\u56de\u94fe\u4e2d\u7684\u4e0b\u4e00\u4e2a\u4ee3\u7406\u9879\u9009\u62e9\u5668");
     // Chinese with 4-byte chars
-    assertRoundTrips("\uD841\uDF0E\uD841\uDF31\uD841\uDF79\uD843\uDC53\uD843\uDC78"
-        + "\uD843\uDC96\uD843\uDCCF\uD843\uDCD5\uD843\uDD15\uD843\uDD7C\uD843\uDD7F"
-        + "\uD843\uDE0E\uD843\uDE0F\uD843\uDE77\uD843\uDE9D\uD843\uDEA2");
+    assertRoundTrips(
+        "\uD841\uDF0E\uD841\uDF31\uD841\uDF79\uD843\uDC53\uD843\uDC78"
+            + "\uD843\uDC96\uD843\uDCCF\uD843\uDCD5\uD843\uDD15\uD843\uDD7C\uD843\uDD7F"
+            + "\uD843\uDE0E\uD843\uDE0F\uD843\uDE77\uD843\uDE9D\uD843\uDEA2");
     // Mixed
     assertRoundTrips(
         "The quick brown \u3044\u308d\u306f\u306b\u307b\u3078\u8fd4\u56de\u94fe"
@@ -132,7 +160,7 @@
     // Max overlong
     assertInvalid(0xc1, 0xbf);
     assertInvalid(0xe0, 0x9f, 0xbf);
-    assertInvalid(0xf0 ,0x8f, 0xbf, 0xbf);
+    assertInvalid(0xf0, 0x8f, 0xbf, 0xbf);
 
     // null overlong
     assertInvalid(0xc0, 0x80);
@@ -168,7 +196,7 @@
   }
 
   public void testInvalidBufferSlice() throws Exception {
-    byte[] bytes  = "The quick brown fox jumps over the lazy dog".getBytes(Internal.UTF_8);
+    byte[] bytes = "The quick brown fox jumps over the lazy dog".getBytes(Internal.UTF_8);
     assertInvalidSlice(bytes, bytes.length - 3, 4);
     assertInvalidSlice(bytes, bytes.length, 1);
     assertInvalidSlice(bytes, bytes.length + 1, 0);
@@ -180,10 +208,14 @@
     for (int i = 0; i < bytesAsInt.length; i++) {
       bytes[i] = (byte) bytesAsInt[i];
     }
-    assertInvalid(bytes);
+    assertInvalid(bytes, null);
   }
 
-  private void assertInvalid(byte[] bytes) throws Exception {
+  // Attempts to decode the byte array in several ways and asserts that it always generates an
+  // exception. Allocating a direct ByteBuffer is slow, so the caller can optionally provide a
+  // buffer to reuse. If buffer is non-null, it must be a direct-allocated ByteBuffer of the
+  // appropriate size.
+  private void assertInvalid(byte[] bytes, ByteBuffer buffer) throws Exception {
     try {
       UNSAFE_PROCESSOR.decodeUtf8(bytes, 0, bytes.length);
       fail();
@@ -197,37 +229,24 @@
       // Expected.
     }
 
-    ByteBuffer direct = ByteBuffer.allocateDirect(bytes.length);
-    direct.put(bytes);
-    direct.flip();
+    if (buffer == null) {
+      buffer = ByteBuffer.allocateDirect(bytes.length);
+    }
+    buffer.put(bytes);
+    buffer.flip();
     try {
-      UNSAFE_PROCESSOR.decodeUtf8(direct, 0, bytes.length);
+      UNSAFE_PROCESSOR.decodeUtf8(buffer, 0, bytes.length);
       fail();
     } catch (InvalidProtocolBufferException e) {
       // Expected.
     }
     try {
-      SAFE_PROCESSOR.decodeUtf8(direct, 0, bytes.length);
+      SAFE_PROCESSOR.decodeUtf8(buffer, 0, bytes.length);
       fail();
     } catch (InvalidProtocolBufferException e) {
       // Expected.
     }
-
-    ByteBuffer heap = ByteBuffer.allocate(bytes.length);
-    heap.put(bytes);
-    heap.flip();
-    try {
-      UNSAFE_PROCESSOR.decodeUtf8(heap, 0, bytes.length);
-      fail();
-    } catch (InvalidProtocolBufferException e) {
-      // Expected.
-    }
-    try {
-      SAFE_PROCESSOR.decodeUtf8(heap, 0, bytes.length);
-      fail();
-    } catch (InvalidProtocolBufferException e) {
-      // Expected.
-    }
+    buffer.clear();
   }
 
   private void assertInvalidSlice(byte[] bytes, int index, int size) throws Exception {
@@ -286,25 +305,31 @@
     if (size == -1) {
       size = bytes.length;
     }
-    assertDecode(new String(bytes, index, size, Internal.UTF_8),
+    assertDecode(
+        new String(bytes, index, size, Internal.UTF_8),
         UNSAFE_PROCESSOR.decodeUtf8(bytes, index, size));
-    assertDecode(new String(bytes, index, size, Internal.UTF_8),
+    assertDecode(
+        new String(bytes, index, size, Internal.UTF_8),
         SAFE_PROCESSOR.decodeUtf8(bytes, index, size));
 
     ByteBuffer direct = ByteBuffer.allocateDirect(bytes.length);
     direct.put(bytes);
     direct.flip();
-    assertDecode(new String(bytes, index, size, Internal.UTF_8),
+    assertDecode(
+        new String(bytes, index, size, Internal.UTF_8),
         UNSAFE_PROCESSOR.decodeUtf8(direct, index, size));
-    assertDecode(new String(bytes, index, size, Internal.UTF_8),
+    assertDecode(
+        new String(bytes, index, size, Internal.UTF_8),
         SAFE_PROCESSOR.decodeUtf8(direct, index, size));
 
     ByteBuffer heap = ByteBuffer.allocate(bytes.length);
     heap.put(bytes);
     heap.flip();
-    assertDecode(new String(bytes, index, size, Internal.UTF_8),
+    assertDecode(
+        new String(bytes, index, size, Internal.UTF_8),
         UNSAFE_PROCESSOR.decodeUtf8(heap, index, size));
-    assertDecode(new String(bytes, index, size, Internal.UTF_8),
+    assertDecode(
+        new String(bytes, index, size, Internal.UTF_8),
         SAFE_PROCESSOR.decodeUtf8(heap, index, size));
   }
 
@@ -321,5 +346,4 @@
     }
     return codepoints;
   }
-
 }
diff --git a/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java b/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java
index bc84595..064aa3f 100644
--- a/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java
+++ b/java/core/src/test/java/com/google/protobuf/ExtensionRegistryFactoryTest.java
@@ -57,7 +57,7 @@
  * <p>The test mechanism employed here is based on the pattern in {@code
  * com.google.common.util.concurrent.AbstractFutureFallbackAtomicHelperTest}
  *
- * <p> This test is temporarily disabled while we figure out how to fix the class loading used for
+ * <p>This test is temporarily disabled while we figure out how to fix the class loading used for
  * testing lite functionality.
  */
 @SuppressWarnings("JUnit4ClassUsedInJUnit3")
diff --git a/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java b/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
index fbba612..e504766 100644
--- a/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
+++ b/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
@@ -65,6 +65,8 @@
 import protobuf_unittest.UnittestProto.TestUnpackedTypes;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 import java.util.Arrays;
@@ -1748,6 +1750,41 @@
   }
 
   @Test
+  public void testOneofParseFailurePropagatesUnderlyingException() {
+    final byte[] bytes = TestOneof2.newBuilder().setFooInt(123).build().toByteArray();
+    final IOException injectedException = new IOException("oh no");
+    CodedInputStream failingInputStream =
+        CodedInputStream.newInstance(
+            new InputStream() {
+              boolean first = true;
+
+              @Override
+              public int read(byte[] b, int off, int len) throws IOException {
+                if (!first) {
+                  throw injectedException;
+                }
+                first = false;
+                System.arraycopy(bytes, 0, b, off, len);
+                return len;
+              }
+
+              @Override
+              public int read() {
+                throw new UnsupportedOperationException();
+              }
+            },
+            bytes.length - 1);
+    TestOneof2.Builder builder = TestOneof2.newBuilder();
+
+    try {
+      builder.mergeFrom(failingInputStream, ExtensionRegistry.getEmptyRegistry());
+      assertWithMessage("Expected mergeFrom to fail").fail();
+    } catch (IOException e) {
+      assertThat(e).isSameInstanceAs(injectedException);
+    }
+  }
+
+  @Test
   public void testGetRepeatedFieldBuilder() {
     Descriptor descriptor = TestAllTypes.getDescriptor();
 
diff --git a/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java b/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java
index bbbe2cd..46e56a9 100644
--- a/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java
+++ b/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java
@@ -36,6 +36,7 @@
 import static com.google.protobuf.IsValidUtf8TestUtil.EXPECTED_THREE_BYTE_ROUNDTRIPPABLE_COUNT;
 import static com.google.protobuf.IsValidUtf8TestUtil.HEAP_NIO_FACTORY;
 import static com.google.protobuf.IsValidUtf8TestUtil.LITERAL_FACTORY;
+import static com.google.protobuf.IsValidUtf8TestUtil.ROPE_FACTORY;
 import static com.google.protobuf.IsValidUtf8TestUtil.testBytes;
 
 import com.google.protobuf.IsValidUtf8TestUtil.ByteStringFactory;
@@ -61,6 +62,7 @@
     testBytes(LITERAL_FACTORY, 1, EXPECTED_ONE_BYTE_ROUNDTRIPPABLE_COUNT);
     testBytes(HEAP_NIO_FACTORY, 1, EXPECTED_ONE_BYTE_ROUNDTRIPPABLE_COUNT);
     testBytes(DIRECT_NIO_FACTORY, 1, EXPECTED_ONE_BYTE_ROUNDTRIPPABLE_COUNT);
+    testBytes(ROPE_FACTORY, 1, EXPECTED_ONE_BYTE_ROUNDTRIPPABLE_COUNT);
   }
 
   /** Tests that round tripping of all two byte permutations work. */
@@ -69,17 +71,16 @@
     testBytes(LITERAL_FACTORY, 2, IsValidUtf8TestUtil.EXPECTED_TWO_BYTE_ROUNDTRIPPABLE_COUNT);
     testBytes(HEAP_NIO_FACTORY, 2, IsValidUtf8TestUtil.EXPECTED_TWO_BYTE_ROUNDTRIPPABLE_COUNT);
     testBytes(DIRECT_NIO_FACTORY, 2, IsValidUtf8TestUtil.EXPECTED_TWO_BYTE_ROUNDTRIPPABLE_COUNT);
+    testBytes(ROPE_FACTORY, 2, IsValidUtf8TestUtil.EXPECTED_TWO_BYTE_ROUNDTRIPPABLE_COUNT);
   }
 
   /** Tests that round tripping of all three byte permutations work. */
   @Test
   public void testIsValidUtf8_3Bytes() {
-    // Travis' OOM killer doesn't like this test
-    if (System.getenv("TRAVIS") == null) {
-      testBytes(LITERAL_FACTORY, 3, EXPECTED_THREE_BYTE_ROUNDTRIPPABLE_COUNT);
-      testBytes(HEAP_NIO_FACTORY, 3, EXPECTED_THREE_BYTE_ROUNDTRIPPABLE_COUNT);
-      testBytes(DIRECT_NIO_FACTORY, 3, EXPECTED_THREE_BYTE_ROUNDTRIPPABLE_COUNT);
-    }
+    testBytes(LITERAL_FACTORY, 3, EXPECTED_THREE_BYTE_ROUNDTRIPPABLE_COUNT);
+    testBytes(HEAP_NIO_FACTORY, 3, EXPECTED_THREE_BYTE_ROUNDTRIPPABLE_COUNT);
+    testBytes(DIRECT_NIO_FACTORY, 3, EXPECTED_THREE_BYTE_ROUNDTRIPPABLE_COUNT);
+    testBytes(ROPE_FACTORY, 3, EXPECTED_THREE_BYTE_ROUNDTRIPPABLE_COUNT);
   }
 
   /**
@@ -168,12 +169,14 @@
     assertValidUtf8(LITERAL_FACTORY, bytes, false);
     assertValidUtf8(HEAP_NIO_FACTORY, bytes, false);
     assertValidUtf8(DIRECT_NIO_FACTORY, bytes, false);
+    assertValidUtf8(ROPE_FACTORY, bytes, false);
   }
 
   private void assertInvalidUtf8(int... bytes) {
     assertValidUtf8(LITERAL_FACTORY, bytes, true);
     assertValidUtf8(HEAP_NIO_FACTORY, bytes, true);
     assertValidUtf8(DIRECT_NIO_FACTORY, bytes, true);
+    assertValidUtf8(ROPE_FACTORY, bytes, true);
   }
 
   private static ByteString asBytes(String s) {
diff --git a/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java b/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java
index 94a9ffb..f1a6711 100644
--- a/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java
+++ b/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java
@@ -35,16 +35,10 @@
 
 import java.lang.ref.SoftReference;
 import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-import java.nio.charset.CharsetDecoder;
-import java.nio.charset.CharsetEncoder;
-import java.nio.charset.CoderResult;
-import java.nio.charset.CodingErrorAction;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Random;
-import java.util.logging.Logger;
 
 /**
  * Shared testing code for {@link IsValidUtf8Test} and {@link IsValidUtf8FourByteTest}.
@@ -53,8 +47,6 @@
  * @author martinrb@google.com (Martin Buchholz)
  */
 final class IsValidUtf8TestUtil {
-  private static final Logger logger = Logger.getLogger(IsValidUtf8TestUtil.class.getName());
-
   private IsValidUtf8TestUtil() {}
 
   static interface ByteStringFactory {
@@ -102,6 +94,29 @@
         }
       };
 
+  static final ByteStringFactory ROPE_FACTORY =
+      new ByteStringFactory() {
+        // Seed the random number generator with 0 so that the tests are deterministic.
+        private final Random random = new Random(0);
+
+        @Override
+        public ByteString newByteString(byte[] bytes) {
+          // We split the byte array into three pieces (some possibly empty) by choosing two random
+          // cut points i and j.
+          int i = random.nextInt(bytes.length);
+          int j = random.nextInt(bytes.length);
+          if (j < i) {
+            int tmp = i;
+            i = j;
+            j = tmp;
+          }
+          return RopeByteString.newInstanceForTest(
+              ByteString.wrap(bytes, 0, i),
+              RopeByteString.newInstanceForTest(
+                  ByteString.wrap(bytes, i, j - i), ByteString.wrap(bytes, j, bytes.length - j)));
+        }
+      };
+
   // 128 - [chars 0x0000 to 0x007f]
   static final long ONE_BYTE_ROUNDTRIPPABLE_CHARACTERS = 0x007f - 0x0000 + 1;
 
@@ -247,13 +262,11 @@
    */
   static void testBytes(
       ByteStringFactory factory, int numBytes, long expectedCount, long start, long lim) {
-    Random rnd = new Random();
     byte[] bytes = new byte[numBytes];
 
     if (lim == -1) {
       lim = 1L << (numBytes * 8);
     }
-    long count = 0;
     long countRoundTripped = 0;
     for (long byteChar = start; byteChar < lim; byteChar++) {
       long tmpByteChar = byteChar;
@@ -271,166 +284,13 @@
         outputFailure(byteChar, bytes, bytesReencoded);
       }
 
-      // Check agreement with static Utf8 methods.
+      // Check agreement with Utf8.isValidUtf8.
       assertThat(Utf8.isValidUtf8(bytes)).isEqualTo(isRoundTrippable);
-      assertThat(Utf8.isValidUtf8(bytes, 0, numBytes)).isEqualTo(isRoundTrippable);
-
-      try {
-        assertThat(Utf8.decodeUtf8(bytes, 0, numBytes)).isEqualTo(s);
-      } catch (InvalidProtocolBufferException e) {
-        if (isRoundTrippable) {
-          System.out.println("Could not decode utf-8");
-          outputFailure(byteChar, bytes, bytesReencoded);
-        }
-      }
-
-      // Test partial sequences.
-      // Partition numBytes into three segments (not necessarily non-empty).
-      int i = rnd.nextInt(numBytes);
-      int j = rnd.nextInt(numBytes);
-      if (j < i) {
-        int tmp = i;
-        i = j;
-        j = tmp;
-      }
-      int state1 = Utf8.partialIsValidUtf8(Utf8.COMPLETE, bytes, 0, i);
-      int state2 = Utf8.partialIsValidUtf8(state1, bytes, i, j);
-      int state3 = Utf8.partialIsValidUtf8(state2, bytes, j, numBytes);
-      if (isRoundTrippable != (state3 == Utf8.COMPLETE)) {
-        System.out.printf("state=%04x %04x %04x i=%d j=%d%n", state1, state2, state3, i, j);
-        outputFailure(byteChar, bytes, bytesReencoded);
-      }
-      assertThat((state3 == Utf8.COMPLETE)).isEqualTo(isRoundTrippable);
-
-      // Test ropes built out of small partial sequences
-      ByteString rope =
-          RopeByteString.newInstanceForTest(
-              bs.substring(0, i),
-              RopeByteString.newInstanceForTest(bs.substring(i, j), bs.substring(j, numBytes)));
-      assertThat(rope.getClass()).isSameInstanceAs(RopeByteString.class);
-
-      ByteString[] byteStrings = {bs, bs.substring(0, numBytes), rope};
-      for (ByteString x : byteStrings) {
-        assertThat(x.isValidUtf8()).isEqualTo(isRoundTrippable);
-        assertThat(x.partialIsValidUtf8(Utf8.COMPLETE, 0, numBytes)).isEqualTo(state3);
-
-        assertThat(x.partialIsValidUtf8(Utf8.COMPLETE, 0, i)).isEqualTo(state1);
-        assertThat(x.substring(0, i).partialIsValidUtf8(Utf8.COMPLETE, 0, i)).isEqualTo(state1);
-        assertThat(x.partialIsValidUtf8(state1, i, j - i)).isEqualTo(state2);
-        assertThat(x.substring(i, j).partialIsValidUtf8(state1, 0, j - i)).isEqualTo(state2);
-        assertThat(x.partialIsValidUtf8(state2, j, numBytes - j)).isEqualTo(state3);
-        assertThat(x.substring(j, numBytes).partialIsValidUtf8(state2, 0, numBytes - j))
-            .isEqualTo(state3);
-      }
-
-      // ByteString reduplication should not affect its UTF-8 validity.
-      ByteString ropeADope = RopeByteString.newInstanceForTest(bs, bs.substring(0, numBytes));
-      assertThat(ropeADope.isValidUtf8()).isEqualTo(isRoundTrippable);
 
       if (isRoundTrippable) {
         countRoundTripped++;
       }
-      count++;
-      if (byteChar != 0 && byteChar % 1000000L == 0) {
-        logger.info("Processed " + (byteChar / 1000000L) + " million characters");
-      }
     }
-    logger.info("Round tripped " + countRoundTripped + " of " + count);
-    assertThat(countRoundTripped).isEqualTo(expectedCount);
-  }
-
-  /**
-   * Variation of {@link #testBytes} that does less allocation using the low-level encoders/decoders
-   * directly. Checked in because it's useful for debugging when trying to process bytes faster, but
-   * since it doesn't use the actual String class, it's possible for incompatibilities to develop
-   * (although unlikely).
-   *
-   * @param factory the factory for {@link ByteString} instances.
-   * @param numBytes the number of bytes in the byte array
-   * @param expectedCount the expected number of roundtrippable permutations
-   * @param start the starting bytes encoded as a long as big-endian
-   * @param lim the limit of bytes to process encoded as a long as big-endian, or -1 to mean the max
-   *     limit for numBytes
-   */
-  static void testBytesUsingByteBuffers(
-      ByteStringFactory factory, int numBytes, long expectedCount, long start, long lim) {
-    CharsetDecoder decoder =
-        Internal.UTF_8
-            .newDecoder()
-            .onMalformedInput(CodingErrorAction.REPLACE)
-            .onUnmappableCharacter(CodingErrorAction.REPLACE);
-    CharsetEncoder encoder =
-        Internal.UTF_8
-            .newEncoder()
-            .onMalformedInput(CodingErrorAction.REPLACE)
-            .onUnmappableCharacter(CodingErrorAction.REPLACE);
-    byte[] bytes = new byte[numBytes];
-    int maxChars = (int) (decoder.maxCharsPerByte() * numBytes) + 1;
-    char[] charsDecoded = new char[(int) (decoder.maxCharsPerByte() * numBytes) + 1];
-    int maxBytes = (int) (encoder.maxBytesPerChar() * maxChars) + 1;
-    byte[] bytesReencoded = new byte[maxBytes];
-
-    ByteBuffer bb = ByteBuffer.wrap(bytes);
-    CharBuffer cb = CharBuffer.wrap(charsDecoded);
-    ByteBuffer bbReencoded = ByteBuffer.wrap(bytesReencoded);
-    if (lim == -1) {
-      lim = 1L << (numBytes * 8);
-    }
-    long count = 0;
-    long countRoundTripped = 0;
-    for (long byteChar = start; byteChar < lim; byteChar++) {
-      bb.rewind();
-      bb.limit(bytes.length);
-      cb.rewind();
-      cb.limit(charsDecoded.length);
-      bbReencoded.rewind();
-      bbReencoded.limit(bytesReencoded.length);
-      encoder.reset();
-      decoder.reset();
-      long tmpByteChar = byteChar;
-      for (int i = 0; i < bytes.length; i++) {
-        bytes[bytes.length - i - 1] = (byte) tmpByteChar;
-        tmpByteChar = tmpByteChar >> 8;
-      }
-      boolean isRoundTrippable = factory.newByteString(bytes).isValidUtf8();
-      CoderResult result = decoder.decode(bb, cb, true);
-      assertThat(result.isError()).isFalse();
-      result = decoder.flush(cb);
-      assertThat(result.isError()).isFalse();
-
-      int charLen = cb.position();
-      cb.rewind();
-      cb.limit(charLen);
-      result = encoder.encode(cb, bbReencoded, true);
-      assertThat(result.isError()).isFalse();
-      result = encoder.flush(bbReencoded);
-      assertThat(result.isError()).isFalse();
-
-      boolean bytesEqual = true;
-      int bytesLen = bbReencoded.position();
-      if (bytesLen != numBytes) {
-        bytesEqual = false;
-      } else {
-        for (int i = 0; i < numBytes; i++) {
-          if (bytes[i] != bytesReencoded[i]) {
-            bytesEqual = false;
-            break;
-          }
-        }
-      }
-      if (bytesEqual != isRoundTrippable) {
-        outputFailure(byteChar, bytes, bytesReencoded, bytesLen);
-      }
-
-      count++;
-      if (isRoundTrippable) {
-        countRoundTripped++;
-      }
-      if (byteChar != 0 && byteChar % 1000000 == 0) {
-        logger.info("Processed " + (byteChar / 1000000) + " million characters");
-      }
-    }
-    logger.info("Round tripped " + countRoundTripped + " of " + count);
     assertThat(countRoundTripped).isEqualTo(expectedCount);
   }
 
diff --git a/java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java b/java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java
index b143dce..1a767c0 100644
--- a/java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java
+++ b/java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java
@@ -32,6 +32,7 @@
 
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
+import static org.junit.Assert.fail;
 
 import map_lite_test.MapForProto2TestProto.BizarroTestMap;
 import map_lite_test.MapForProto2TestProto.TestMap;
@@ -42,6 +43,7 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -333,8 +335,19 @@
     assertMapValuesSet(destination.build());
   }
 
+    @Test
+  public void testPutChecksNullKey() throws Exception {
+    TestMap.Builder builder = TestMap.newBuilder();
+
+    try {
+      builder.putStringToInt32Field(null, 1);
+      assertWithMessage("expected exception").fail();
+    } catch (NullPointerException expected) {
+    }
+  }
+
   @Test
-  public void testPutChecksNullKeysAndValues() throws Exception {
+  public void testPutChecksNullValues() throws Exception {
     TestMap.Builder builder = TestMap.newBuilder();
 
     try {
@@ -803,4 +816,54 @@
       // expected
     }
   }
+
+  @Test
+  public void testPutAllWithNullStringKey() throws Exception {
+    TestMap.Builder sourceBuilder = TestMap.newBuilder();
+
+    // order preserving map used here to help test rollback
+    Map<Integer, String> data = new LinkedHashMap<>();
+    data.put(7, "foo");
+    data.put(null, "bar");
+    data.put(9, "baz");
+    try {
+      sourceBuilder.putAllInt32ToStringField(data);
+      fail("allowed null string key");
+    } catch (NullPointerException expected) {
+      // Verify rollback of previously added values.
+      // They all go in or none do.
+      assertThat(sourceBuilder.getInt32ToStringFieldMap()).isEmpty();
+    }
+  }
+
+  @Test
+  public void testPutAllWithNullStringValue() throws Exception {
+    TestMap.Builder sourceBuilder = TestMap.newBuilder();
+
+    // order preserving map used here to help test rollback
+    Map<Integer, String> data = new LinkedHashMap<>();
+    data.put(7, "foo");
+    data.put(8, "bar");
+    data.put(9, null);
+    try {
+      sourceBuilder.putAllInt32ToStringField(data);
+      fail("allowed null string value");
+    } catch (NullPointerException expected) {
+      // Verify rollback of previously added values.
+      // They all go in or none do.
+      assertThat(sourceBuilder.getInt32ToStringFieldMap()).isEmpty();
+    }
+  }
+
+  @Test
+  public void testPutNullStringValue() throws Exception {
+    TestMap.Builder sourceBuilder = TestMap.newBuilder();
+
+    try {
+      sourceBuilder.putInt32ToStringField(8, null);
+      fail("allowed null string value");
+    } catch (NullPointerException expected) {
+    }
+  }
+
 }
diff --git a/java/core/src/test/java/com/google/protobuf/MapForProto2Test.java b/java/core/src/test/java/com/google/protobuf/MapForProto2Test.java
index 821b93c..6681724 100644
--- a/java/core/src/test/java/com/google/protobuf/MapForProto2Test.java
+++ b/java/core/src/test/java/com/google/protobuf/MapForProto2Test.java
@@ -32,6 +32,8 @@
 
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 
 import com.google.protobuf.Descriptors.FieldDescriptor;
 import map_test.MapForProto2TestProto.BizarroTestMap;
@@ -49,8 +51,10 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
@@ -481,17 +485,10 @@
   }
 
   @Test
-  public void testPutChecksNullKeysAndValues() throws Exception {
+  public void testPutChecksNullValues() throws Exception {
     TestMap.Builder builder = TestMap.newBuilder();
 
     try {
-      builder.putInt32ToStringField(1, null);
-      assertWithMessage("expected exception").fail();
-    } catch (NullPointerException e) {
-      // expected.
-    }
-
-    try {
       builder.putInt32ToBytesField(1, null);
       assertWithMessage("expected exception").fail();
     } catch (NullPointerException e) {
@@ -521,6 +518,17 @@
   }
 
   @Test
+  public void testPutChecksNullKey() throws Exception {
+    TestMap.Builder builder = TestMap.newBuilder();
+
+    try {
+      builder.putStringToInt32Field(null, 1);
+      assertWithMessage("expected exception").fail();
+    } catch (NullPointerException expected) {
+    }
+  }
+
+  @Test
   public void testSerializeAndParse() throws Exception {
     TestMap.Builder builder = TestMap.newBuilder();
     setMapValuesUsingAccessors(builder);
@@ -1218,4 +1226,54 @@
     assertThat(message.getInt32ToEnumFieldMap()).isEqualTo(message.getInt32ToEnumFieldMap());
     assertThat(message.getInt32ToMessageFieldMap()).isEqualTo(message.getInt32ToMessageFieldMap());
   }
+
+  @Test
+  public void testPutAllWithNullStringValue() throws Exception {
+    TestMap.Builder sourceBuilder = TestMap.newBuilder();
+
+    // order preserving map used here to help test rollback
+    Map<Integer, String> data = new TreeMap<>();
+    data.put(7, "foo");
+    data.put(8, "bar");
+    data.put(9, null);
+    try {
+      sourceBuilder.putAllInt32ToStringField(data);
+      fail("allowed null string value");
+    } catch (NullPointerException expected) {
+      // Verify rollback of previously added values.
+      // They all go in or none do.
+      assertThat(sourceBuilder.getInt32ToStringFieldMap()).isEmpty();
+    }
+  }
+
+  @Test
+  public void testPutAllWithNullStringKey() throws Exception {
+    TestMap.Builder sourceBuilder = TestMap.newBuilder();
+
+    // order preserving map used here to help test rollback
+    Map<Integer, String> data = new LinkedHashMap<>();
+    data.put(7, "foo");
+    data.put(null, "bar");
+    data.put(9, "baz");
+    try {
+      sourceBuilder.putAllInt32ToStringField(data);
+      fail("allowed null string key");
+    } catch (NullPointerException expected) {
+      // Verify rollback of previously added values.
+      // They all go in or none do.
+      assertThat(sourceBuilder.getInt32ToStringFieldMap()).isEmpty();
+    }
+  }
+
+  @Test
+  public void testPutNullStringValue() throws Exception {
+    TestMap.Builder sourceBuilder = TestMap.newBuilder();
+
+    try {
+      sourceBuilder.putInt32ToStringField(8, null);
+      fail("allowed null string value");
+    } catch (NullPointerException expected) {
+      assertNotNull(expected.getMessage());
+    }
+  }
 }
diff --git a/java/core/src/test/java/com/google/protobuf/MapTest.java b/java/core/src/test/java/com/google/protobuf/MapTest.java
index cc7a121..34df945 100644
--- a/java/core/src/test/java/com/google/protobuf/MapTest.java
+++ b/java/core/src/test/java/com/google/protobuf/MapTest.java
@@ -32,6 +32,8 @@
 
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 
 import com.google.protobuf.Descriptors.Descriptor;
 import com.google.protobuf.Descriptors.EnumDescriptor;
@@ -50,6 +52,7 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.TreeMap;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
@@ -465,6 +468,37 @@
   }
 
   @Test
+  public void testPutAllWithNullStringValue() throws Exception {
+    TestMap.Builder sourceBuilder = TestMap.newBuilder();
+
+    // order preserving map used here to help test rollback
+    Map<Integer, String> data = new TreeMap<>();
+    data.put(7, "foo");
+    data.put(8, "bar");
+    data.put(9, null);
+    try {
+      sourceBuilder.putAllInt32ToStringField(data);
+      fail("allowed null string value");
+    } catch (NullPointerException expected) {
+      // Verify rollback of previously added values.
+      // They all go in or none do.
+      assertThat(sourceBuilder.getInt32ToStringFieldMap()).isEmpty();
+    }
+  }
+
+  @Test
+  public void testPutNullStringValue() throws Exception {
+    TestMap.Builder sourceBuilder = TestMap.newBuilder();
+
+    try {
+      sourceBuilder.putInt32ToStringField(8, null);
+      fail("allowed null string value");
+    } catch (NullPointerException expected) {
+      assertNotNull(expected.getMessage());
+    }
+  }
+
+  @Test
   public void testPutAllForUnknownEnumValues() throws Exception {
     TestMap source =
         TestMap.newBuilder()
diff --git a/java/core/src/test/java/com/google/protobuf/MessageTest.java b/java/core/src/test/java/com/google/protobuf/MessageTest.java
index 9c34161..fa36433 100644
--- a/java/core/src/test/java/com/google/protobuf/MessageTest.java
+++ b/java/core/src/test/java/com/google/protobuf/MessageTest.java
@@ -380,4 +380,34 @@
                 result.getDescriptorForType().findFieldByName("repeated_foreign_message")))
         .isEqualTo(2);
   }
+
+  @Test
+  public void testPreservesFloatingPointNegative0() throws Exception {
+    proto3_unittest.UnittestProto3.TestAllTypes message =
+        proto3_unittest.UnittestProto3.TestAllTypes.newBuilder()
+            .setOptionalFloat(-0.0f)
+            .setOptionalDouble(-0.0)
+            .build();
+    assertThat(
+            proto3_unittest.UnittestProto3.TestAllTypes.parseFrom(
+                message.toByteString(), ExtensionRegistry.getEmptyRegistry()))
+        .isEqualTo(message);
+  }
+
+  @Test
+  public void testNegative0FloatingPointEquality() throws Exception {
+    // Like Double#equals and Float#equals, we treat -0.0 as not being equal to +0.0 even though
+    // IEEE 754 mandates that they are equivalent. This test asserts that behavior.
+    proto3_unittest.UnittestProto3.TestAllTypes message1 =
+        proto3_unittest.UnittestProto3.TestAllTypes.newBuilder()
+            .setOptionalFloat(-0.0f)
+            .setOptionalDouble(-0.0)
+            .build();
+    proto3_unittest.UnittestProto3.TestAllTypes message2 =
+        proto3_unittest.UnittestProto3.TestAllTypes.newBuilder()
+            .setOptionalFloat(0.0f)
+            .setOptionalDouble(0.0)
+            .build();
+    assertThat(message1).isNotEqualTo(message2);
+  }
 }
diff --git a/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java b/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java
index 18d90fe..bb95e2a 100644
--- a/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java
+++ b/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderV3Test.java
@@ -184,7 +184,7 @@
   }
 
   private RepeatedFieldBuilderV3<TestAllTypes, TestAllTypes.Builder, TestAllTypesOrBuilder>
-      newRepeatedFieldBuilderV3(GeneratedMessage.BuilderParent parent) {
+      newRepeatedFieldBuilderV3(AbstractMessage.BuilderParent parent) {
     return new RepeatedFieldBuilderV3<TestAllTypes, TestAllTypes.Builder, TestAllTypesOrBuilder>(
         Collections.<TestAllTypes>emptyList(), false, parent, false);
   }
diff --git a/java/core/src/test/java/com/google/protobuf/ServiceTest.java b/java/core/src/test/java/com/google/protobuf/ServiceTest.java
index 8b98661..33ce537 100644
--- a/java/core/src/test/java/com/google/protobuf/ServiceTest.java
+++ b/java/core/src/test/java/com/google/protobuf/ServiceTest.java
@@ -46,9 +46,9 @@
 import protobuf_unittest.no_generic_services_test.UnittestNoGenericServices;
 import java.util.HashSet;
 import java.util.Set;
-import org.easymock.classextension.EasyMock;
+import org.easymock.EasyMock;
 import org.easymock.IArgumentMatcher;
-import org.easymock.classextension.IMocksControl;
+import org.easymock.IMocksControl;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -80,7 +80,7 @@
     BarRequest barRequest = BarRequest.newBuilder().build();
     MockCallback<Message> fooCallback = new MockCallback<Message>();
     MockCallback<Message> barCallback = new MockCallback<Message>();
-    TestService mockService = control.createMock(TestService.class);
+    TestService mockService = EasyMock.createMock(TestService.class);
 
     mockService.foo(
         EasyMock.same(mockController),
@@ -104,7 +104,7 @@
   /** Tests Service.get{Request,Response}Prototype(). */
   @Test
   public void testGetPrototype() throws Exception {
-    TestService mockService = control.createMock(TestService.class);
+    TestService mockService = EasyMock.createMock(TestService.class);
 
     assertThat(mockService.getRequestPrototype(fooDescriptor))
         .isSameInstanceAs(FooRequest.getDefaultInstance());
@@ -316,7 +316,6 @@
     }
 
     @Override
-    @SuppressWarnings("unchecked")
     public boolean matches(Object actual) {
       if (!(actual instanceof RpcCallback)) {
         return false;
diff --git a/java/core/src/test/java/com/google/protobuf/TestUtil.java b/java/core/src/test/java/com/google/protobuf/TestUtil.java
index 936a525..b409268 100644
--- a/java/core/src/test/java/com/google/protobuf/TestUtil.java
+++ b/java/core/src/test/java/com/google/protobuf/TestUtil.java
@@ -3758,7 +3758,9 @@
 
   /** @param filePath The path relative to {@link #getTestDataDir}. */
   public static String readTextFromFile(String filePath) {
-    return readBytesFromFile(filePath).toStringUtf8().replace(System.getProperty("line.separator"), "\n");
+    return readBytesFromFile(filePath)
+        .toStringUtf8()
+        .replace(System.getProperty("line.separator"), "\n");
   }
 
   private static File getTestDataDir() {
@@ -3813,8 +3815,7 @@
 
   private static ByteString readBytesFromResource(String name) {
     try {
-      return ByteString.copyFrom(
-          com.google.common.io.ByteStreams.toByteArray(TestUtil.class.getResourceAsStream(name)));
+      return ByteString.readFrom(TestUtil.class.getResourceAsStream(name));
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
diff --git a/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java b/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java
index 5d0eb62..b624191 100644
--- a/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java
+++ b/java/core/src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java
@@ -41,7 +41,7 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
-/** Test @{link TextFormatParseInfoTree}. */
+/** Test {@link TextFormatParseInfoTree}. */
 @RunWith(JUnit4.class)
 public class TextFormatParseInfoTreeTest {
 
diff --git a/java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java b/java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java
index ed20df5..f85ee6c 100644
--- a/java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java
+++ b/java/core/src/test/java/com/google/protobuf/TextFormatParseLocationTest.java
@@ -37,7 +37,7 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
-/** Test @{link TextFormatParseLocation}. */
+/** Test {@link TextFormatParseLocation}. */
 @RunWith(JUnit4.class)
 public class TextFormatParseLocationTest {
 
diff --git a/java/core/src/test/java/com/google/protobuf/TextFormatTest.java b/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
index 69568e1..f9b7da4 100644
--- a/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
+++ b/java/core/src/test/java/com/google/protobuf/TextFormatTest.java
@@ -34,6 +34,7 @@
 import static com.google.common.truth.Truth.assertWithMessage;
 import static com.google.protobuf.TestUtil.TEST_REQUIRED_INITIALIZED;
 import static com.google.protobuf.TestUtil.TEST_REQUIRED_UNINITIALIZED;
+import static org.junit.Assert.assertThrows;
 
 import com.google.protobuf.DescriptorProtos.DescriptorProto;
 import com.google.protobuf.DescriptorProtos.FieldDescriptorProto;
@@ -41,6 +42,7 @@
 import com.google.protobuf.Descriptors.Descriptor;
 import com.google.protobuf.Descriptors.FieldDescriptor;
 import com.google.protobuf.Descriptors.FileDescriptor;
+import com.google.protobuf.TextFormat.InvalidEscapeSequenceException;
 import com.google.protobuf.TextFormat.Parser.SingularOverwritePolicy;
 import com.google.protobuf.testing.proto.TestProto3Optional;
 import com.google.protobuf.testing.proto.TestProto3Optional.NestedEnum;
@@ -61,6 +63,7 @@
 import java.util.List;
 import java.util.logging.Logger;
 import org.junit.Test;
+import org.junit.function.ThrowingRunnable;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
@@ -596,9 +599,7 @@
                 .setPackage("google.protobuf")
                 .setSyntax("proto3")
                 .addMessageType(
-                    DescriptorProto.newBuilder()
-                        .setName("Any")
-                        .addAllField(Arrays.asList(fields)))
+                    DescriptorProto.newBuilder().setName("Any").addAllField(Arrays.asList(fields)))
                 .build(),
             new FileDescriptor[0]);
     return fileDescriptor.getMessageTypes().get(0);
@@ -874,6 +875,11 @@
   }
 
   // =================================================================
+  @Test
+  public void testEscapeQuestionMark() throws InvalidEscapeSequenceException {
+    assertThat(TextFormat.unescapeText("?")).isEqualTo("?");
+    assertThat(TextFormat.unescapeText("\\?")).isEqualTo("?");
+  }
 
   @Test
   public void testEscape() throws Exception {
@@ -1232,6 +1238,36 @@
   }
 
   @Test
+  public void testPrintFieldValueThrows() throws Exception {
+    assertPrintFieldThrowsClassCastException(5, "repeated_string");
+    assertPrintFieldThrowsClassCastException(5L, "repeated_string");
+    assertPrintFieldThrowsClassCastException(ByteString.EMPTY, "repeated_string");
+    assertPrintFieldThrowsClassCastException(5, "repeated_float");
+    assertPrintFieldThrowsClassCastException(5D, "repeated_float");
+    assertPrintFieldThrowsClassCastException("text", "repeated_float");
+    assertPrintFieldThrowsClassCastException(5, "repeated_double");
+    assertPrintFieldThrowsClassCastException(5F, "repeated_double");
+    assertPrintFieldThrowsClassCastException("text", "repeated_double");
+    assertPrintFieldThrowsClassCastException(123L, "repeated_int32");
+    assertPrintFieldThrowsClassCastException(123, "repeated_int64");
+    assertPrintFieldThrowsClassCastException(1, "repeated_bytes");
+  }
+
+  private void assertPrintFieldThrowsClassCastException(final Object value, String fieldName)
+      throws Exception {
+    final StringBuilder stringBuilder = new StringBuilder();
+    final FieldDescriptor fieldDescriptor = TestAllTypes.getDescriptor().findFieldByName(fieldName);
+    assertThrows(
+        ClassCastException.class,
+        new ThrowingRunnable() {
+          @Override
+          public void run() throws Throwable {
+            TextFormat.printer().printFieldValue(fieldDescriptor, value, stringBuilder);
+          }
+        });
+  }
+
+  @Test
   public void testShortDebugString() {
     assertThat(
             TextFormat.shortDebugString(
@@ -1779,4 +1815,15 @@
             + "}\n";
     assertThat(TextFormat.printer().printToString(message)).isEqualTo(text);
   }
+
+  @Test
+  public void testPreservesFloatingPointNegative0() throws Exception {
+    proto3_unittest.UnittestProto3.TestAllTypes message =
+        proto3_unittest.UnittestProto3.TestAllTypes.newBuilder()
+            .setOptionalFloat(-0.0f)
+            .setOptionalDouble(-0.0)
+            .build();
+    assertThat(TextFormat.printer().printToString(message))
+        .isEqualTo("optional_float: -0.0\noptional_double: -0.0\n");
+  }
 }
diff --git a/java/core/src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.java b/java/core/src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.java
new file mode 100644
index 0000000..6ce0fc7
--- /dev/null
+++ b/java/core/src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.java
@@ -0,0 +1,78 @@
+// 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.
+
+package com.google.protobuf;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class UnknownFieldSetPerformanceTest {
+
+  private static byte[] generateBytes(int length) {
+    assertThat(length % 4).isEqualTo(0);
+    byte[] input = new byte[length];
+    for (int i = 0; i < length; i += 4) {
+        input[i] =     (byte) 0x08; // field 1, wiretype 0
+        input[i + 1] = (byte) 0x08; // field 1, payload 8
+        input[i + 2] = (byte) 0x20; // field 4, wiretype 0
+        input[i + 3] = (byte) 0x20; // field 4, payload 32
+    }
+    return input;
+  }
+
+  @Test
+  // This is a performance test. Failure here is a timeout.
+  public void testAlternatingFieldNumbers() throws IOException {
+    byte[] input = generateBytes(800000);
+    InputStream in = new ByteArrayInputStream(input);
+    UnknownFieldSet.Builder builder = UnknownFieldSet.newBuilder();
+    CodedInputStream codedInput = CodedInputStream.newInstance(in);
+    builder.mergeFrom(codedInput);
+  }
+
+  @Test
+  // This is a performance test. Failure here is a timeout.
+  public void testAddField() {
+    UnknownFieldSet.Builder builder = UnknownFieldSet.newBuilder();
+    for (int i = 1; i <= 100000; i++) {
+      UnknownFieldSet.Field field = UnknownFieldSet.Field.newBuilder().addFixed32(i).build();
+      builder.addField(i, field);
+    }
+    UnknownFieldSet fieldSet = builder.build();
+    assertThat(fieldSet.getField(100000).getFixed32List().get(0)).isEqualTo(100000);
+  }
+}
diff --git a/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java b/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java
index 1e5bc96..fbc3bb8 100644
--- a/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java
+++ b/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java
@@ -42,7 +42,9 @@
 import protobuf_unittest.UnittestProto.TestPackedExtensions;
 import protobuf_unittest.UnittestProto.TestPackedTypes;
 import proto3_unittest.UnittestProto3;
+import java.util.List;
 import java.util.Map;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -61,7 +63,7 @@
     unknownFields = emptyMessage.getUnknownFields();
   }
 
-  UnknownFieldSet.Field getField(String name) {
+  private UnknownFieldSet.Field getField(String name) {
     Descriptors.FieldDescriptor field = descriptor.findFieldByName(name);
     assertThat(field).isNotNull();
     return unknownFields.getField(field.getNumber());
@@ -101,6 +103,174 @@
   // =================================================================
 
   @Test
+  public void testFieldBuildersAreReusable() {
+    UnknownFieldSet.Field.Builder fieldBuilder = UnknownFieldSet.Field.newBuilder();
+    fieldBuilder.addFixed32(10);
+    UnknownFieldSet.Field first = fieldBuilder.build();
+    UnknownFieldSet.Field second = fieldBuilder.build();
+    fieldBuilder.addFixed32(11);
+    UnknownFieldSet.Field third = fieldBuilder.build();
+
+    assertThat(first).isEqualTo(second);
+    assertThat(first).isNotEqualTo(third);
+  }
+
+  @Test
+  public void testClone() {
+    UnknownFieldSet.Builder unknownSetBuilder = UnknownFieldSet.newBuilder();
+    UnknownFieldSet.Field.Builder fieldBuilder = UnknownFieldSet.Field.newBuilder();
+    fieldBuilder.addFixed32(10);
+    unknownSetBuilder.addField(8, fieldBuilder.build());
+    // necessary to call clone twice to expose the bug
+    UnknownFieldSet.Builder clone1 = unknownSetBuilder.clone();
+    UnknownFieldSet.Builder clone2 = unknownSetBuilder.clone(); // failure is a NullPointerException
+    assertThat(clone1).isNotSameInstanceAs(clone2);
+  }
+
+  @Test
+  public void testClone_lengthDelimited() {
+    UnknownFieldSet.Builder destUnknownFieldSet =
+        UnknownFieldSet.newBuilder()
+            .addField(997, UnknownFieldSet.Field.newBuilder().addVarint(99).build())
+            .addField(
+                999,
+                UnknownFieldSet.Field.newBuilder()
+                    .addLengthDelimited(ByteString.copyFromUtf8("some data"))
+                    .addLengthDelimited(ByteString.copyFromUtf8("some more data"))
+                    .build());
+    UnknownFieldSet clone = destUnknownFieldSet.clone().build();
+    assertThat(clone.getField(997)).isNotNull();
+    UnknownFieldSet.Field field999 = clone.getField(999);
+    List<ByteString> lengthDelimited = field999.getLengthDelimitedList();
+    assertThat(lengthDelimited.get(0).toStringUtf8()).isEqualTo("some data");
+    assertThat(lengthDelimited.get(1).toStringUtf8()).isEqualTo("some more data");
+
+    UnknownFieldSet clone2 = destUnknownFieldSet.clone().build();
+    assertThat(clone2.getField(997)).isNotNull();
+    UnknownFieldSet.Field secondField = clone2.getField(999);
+    List<ByteString> lengthDelimited2 = secondField.getLengthDelimitedList();
+    assertThat(lengthDelimited2.get(0).toStringUtf8()).isEqualTo("some data");
+    assertThat(lengthDelimited2.get(1).toStringUtf8()).isEqualTo("some more data");
+  }
+
+  @Test
+  public void testReuse() {
+    UnknownFieldSet.Builder builder =
+        UnknownFieldSet.newBuilder()
+            .addField(997, UnknownFieldSet.Field.newBuilder().addVarint(99).build())
+            .addField(
+                999,
+                UnknownFieldSet.Field.newBuilder()
+                    .addLengthDelimited(ByteString.copyFromUtf8("some data"))
+                    .addLengthDelimited(ByteString.copyFromUtf8("some more data"))
+                    .build());
+
+    UnknownFieldSet fieldSet1 = builder.build();
+    UnknownFieldSet fieldSet2 = builder.build();
+    builder.addField(1000, UnknownFieldSet.Field.newBuilder().addVarint(-90).build());
+    UnknownFieldSet fieldSet3 = builder.build();
+
+    assertThat(fieldSet1).isEqualTo(fieldSet2);
+    assertThat(fieldSet1).isNotEqualTo(fieldSet3);
+  }
+
+  @Test
+  @SuppressWarnings("ModifiedButNotUsed")
+  public void testAddField_zero() {
+    UnknownFieldSet.Field field = getField("optional_int32");
+    try {
+      UnknownFieldSet.newBuilder().addField(0, field);
+      Assert.fail();
+    } catch (IllegalArgumentException expected) {
+      assertThat(expected).hasMessageThat().isEqualTo("0 is not a valid field number.");
+    }
+  }
+
+  @Test
+  @SuppressWarnings("ModifiedButNotUsed")
+  public void testAddField_negative() {
+    UnknownFieldSet.Field field = getField("optional_int32");
+    try {
+      UnknownFieldSet.newBuilder().addField(-2, field);
+      Assert.fail();
+    } catch (IllegalArgumentException expected) {
+      assertThat(expected).hasMessageThat().isEqualTo("-2 is not a valid field number.");
+    }
+  }
+
+  @Test
+  @SuppressWarnings("ModifiedButNotUsed")
+  public void testClearField_negative() {
+    try {
+      UnknownFieldSet.newBuilder().clearField(-28);
+      Assert.fail();
+    } catch (IllegalArgumentException expected) {
+      assertThat(expected).hasMessageThat().isEqualTo("-28 is not a valid field number.");
+    }
+  }
+
+  @Test
+  @SuppressWarnings("ModifiedButNotUsed")
+  public void testMergeField_negative() {
+    UnknownFieldSet.Field field = getField("optional_int32");
+    try {
+      UnknownFieldSet.newBuilder().mergeField(-2, field);
+      Assert.fail();
+    } catch (IllegalArgumentException expected) {
+      assertThat(expected).hasMessageThat().isEqualTo("-2 is not a valid field number.");
+    }
+  }
+
+  @Test
+  @SuppressWarnings("ModifiedButNotUsed")
+  public void testMergeVarintField_negative() {
+    try {
+      UnknownFieldSet.newBuilder().mergeVarintField(-2, 78);
+      Assert.fail();
+    } catch (IllegalArgumentException expected) {
+      assertThat(expected).hasMessageThat().isEqualTo("-2 is not a valid field number.");
+    }
+  }
+
+  @Test
+  @SuppressWarnings("ModifiedButNotUsed")
+  public void testHasField_negative() {
+    assertThat(UnknownFieldSet.newBuilder().hasField(-2)).isFalse();
+  }
+
+  @Test
+  @SuppressWarnings("ModifiedButNotUsed")
+  public void testMergeLengthDelimitedField_negative() {
+    ByteString byteString = ByteString.copyFromUtf8("some data");
+    try {
+      UnknownFieldSet.newBuilder().mergeLengthDelimitedField(-2, byteString);
+      Assert.fail();
+    } catch (IllegalArgumentException expected) {
+      assertThat(expected).hasMessageThat().isEqualTo("-2 is not a valid field number.");
+    }
+  }
+
+  @Test
+  public void testAddField() {
+    UnknownFieldSet.Field field = getField("optional_int32");
+    UnknownFieldSet fieldSet = UnknownFieldSet.newBuilder().addField(1, field).build();
+    assertThat(fieldSet.getField(1)).isEqualTo(field);
+  }
+
+  @Test
+  public void testAddField_withReplacement() {
+    UnknownFieldSet.Field first = UnknownFieldSet.Field.newBuilder().addFixed32(56).build();
+    UnknownFieldSet.Field second = UnknownFieldSet.Field.newBuilder().addFixed32(25).build();
+    UnknownFieldSet fieldSet = UnknownFieldSet.newBuilder()
+        .addField(1, first)
+        .addField(1, second)
+        .build();
+    List<Integer> list = fieldSet.getField(1).getFixed32List();
+    assertThat(list).hasSize(1);
+    assertThat(list.get(0)).isEqualTo(25);
+  }
+
+  @Test
   public void testVarint() throws Exception {
     UnknownFieldSet.Field field = getField("optional_int32");
     assertThat(field.getVarintList()).hasSize(1);
@@ -186,6 +356,16 @@
   }
 
   @Test
+  public void testAsMap() throws Exception {
+    UnknownFieldSet.Builder builder = UnknownFieldSet.newBuilder().mergeFrom(unknownFields);
+    Map<Integer, UnknownFieldSet.Field> mapFromBuilder = builder.asMap();
+    assertThat(mapFromBuilder).isNotEmpty();
+    UnknownFieldSet fields = builder.build();
+    Map<Integer, UnknownFieldSet.Field> mapFromFieldSet = fields.asMap();
+    assertThat(mapFromFieldSet).containsExactlyEntriesIn(mapFromBuilder);
+  }
+
+  @Test
   public void testClear() throws Exception {
     UnknownFieldSet fields = UnknownFieldSet.newBuilder().mergeFrom(unknownFields).clear().build();
     assertThat(fields.asMap()).isEmpty();
diff --git a/java/core/src/test/java/com/google/protobuf/Utf8Utils.java b/java/core/src/test/java/com/google/protobuf/Utf8Utils.java
index dbd3d39..6b03186 100644
--- a/java/core/src/test/java/com/google/protobuf/Utf8Utils.java
+++ b/java/core/src/test/java/com/google/protobuf/Utf8Utils.java
@@ -171,20 +171,19 @@
           codePoint = rnd.nextInt(distribution[3]);
           if (codePoint < distribution[0]) {
             // 1 bytes
-            sb.append(0x7F);
+            sb.append((char) 0x7F);
           } else if (codePoint < distribution[1]) {
             // 2 bytes
-            sb.append(0x7FF);
+            sb.append((char) 0x7FF);
           } else if (codePoint < distribution[2]) {
             // 3 bytes
-            sb.append(MIN_SURROGATE - 1);
+            sb.append((char) (MIN_SURROGATE - 1));
           } else {
             // 4 bytes
             sb.append(MIN_HIGH_SURROGATE);
             sb.append(MIN_LOW_SURROGATE);
           }
         } while (Utf8Utils.isSurrogate(codePoint));
-        sb.appendCodePoint(codePoint);
       }
       strings[i] = sb.toString();
     }
diff --git a/java/kotlin-lite/pom.xml b/java/kotlin-lite/pom.xml
index 0720766..977959b 100644
--- a/java/kotlin-lite/pom.xml
+++ b/java/kotlin-lite/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.protobuf</groupId>
     <artifactId>protobuf-parent</artifactId>
-    <version>3.18.1</version>
+    <version>3.19.4</version>
   </parent>
 
   <artifactId>protobuf-kotlin-lite</artifactId>
@@ -36,11 +36,6 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.easymock</groupId>
-      <artifactId>easymockclassextension</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
       <scope>test</scope>
diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml
index ad25304..286af32 100644
--- a/java/kotlin/pom.xml
+++ b/java/kotlin/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.protobuf</groupId>
     <artifactId>protobuf-parent</artifactId>
-    <version>3.18.1</version>
+    <version>3.19.4</version>
   </parent>
 
   <artifactId>protobuf-kotlin</artifactId>
@@ -35,11 +35,6 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.easymock</groupId>
-      <artifactId>easymockclassextension</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
       <scope>test</scope>
diff --git a/java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt b/java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt
index d8982eb..206c19f 100644
--- a/java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt
+++ b/java/kotlin/src/main/kotlin/com/google/protobuf/ExtensionList.kt
@@ -34,14 +34,14 @@
 import com.google.protobuf.MessageLite
 
 /**
- * Implementation for ExtensionList and ExtensionListLite.  Like [DslList], represents an
- * unmodifiable view of a repeated proto field -- in this case, an extension field -- but
- * supports querying the extension.
+ * Implementation for ExtensionList and ExtensionListLite. Like [DslList], represents an
+ * unmodifiable view of a repeated proto field -- in this case, an extension field -- but supports
+ * querying the extension.
  */
-class ExtensionList<E, M : MessageLite> @OnlyForUseByGeneratedProtoCode constructor(
-  val extension: ExtensionLite<M, List<E>>,
-  private val delegate: List<E>
-) : List<E> by delegate {
+class ExtensionList<E, M : MessageLite>
+@OnlyForUseByGeneratedProtoCode
+constructor(val extension: ExtensionLite<M, List<E>>, private val delegate: List<E>) :
+  List<E> by delegate {
   override fun iterator(): Iterator<E> = UnmodifiableIterator(delegate.iterator())
 
   override fun listIterator(): ListIterator<E> = UnmodifiableListIterator(delegate.listIterator())
diff --git a/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt b/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt
index 65f0324..f3cbf2d 100644
--- a/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt
+++ b/java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt
@@ -75,119 +75,110 @@
   @Test
   fun testSetters() {
     assertThat(
-      testAllTypes {
-        optionalInt32 = 101
-        optionalInt64 = 102
-        optionalUint32 = 103
-        optionalUint64 = 104
-        optionalSint32 = 105
-        optionalSint64 = 106
-        optionalFixed32 = 107
-        optionalFixed64 = 108
-        optionalSfixed32 = 109
-        optionalSfixed64 = 110
-        optionalFloat = 111.0f
-        optionalDouble = 112.0
-        optionalBool = true
-        optionalString = "115"
-        optionalBytes = toBytes("116")
-        optionalGroup =
-          TestAllTypesKt.optionalGroup { a = 117 }
-        optionalNestedMessage = nestedMessage { bb = 118 }
-        optionalForeignMessage = foreignMessage { c = 119 }
-        optionalImportMessage =
-          ImportMessage.newBuilder().setD(120).build()
-        optionalPublicImportMessage =
-          PublicImportMessage.newBuilder().setE(126).build()
-        optionalLazyMessage = nestedMessage { bb = 127 }
-        optionalNestedEnum = NestedEnum.BAZ
-        optionalForeignEnum = ForeignEnum.FOREIGN_BAZ
-        optionalImportEnum = ImportEnum.IMPORT_BAZ
-        optionalStringPiece = "124"
-        optionalCord = "125"
-        repeatedInt32.add(201)
-        repeatedInt64.add(202)
-        repeatedUint32.add(203)
-        repeatedUint64.add(204)
-        repeatedSint32.add(205)
-        repeatedSint64.add(206)
-        repeatedFixed32.add(207)
-        repeatedFixed64.add(208)
-        repeatedSfixed32.add(209)
-        repeatedSfixed64.add(210)
-        repeatedFloat.add(211f)
-        repeatedDouble.add(212.0)
-        repeatedBool.add(true)
-        repeatedString.add("215")
-        repeatedBytes.add(toBytes("216"))
-        repeatedGroup.add(TestAllTypesKt.repeatedGroup { a = 217 })
-        repeatedNestedMessage.add(nestedMessage { bb = 218 })
-        repeatedForeignMessage.add(foreignMessage { c = 219 })
-        repeatedImportMessage.add(
-          ImportMessage.newBuilder().setD(220).build()
-        )
-        repeatedLazyMessage.add(nestedMessage { bb = 227 })
-        repeatedNestedEnum.add(NestedEnum.BAR)
-        repeatedForeignEnum.add(ForeignEnum.FOREIGN_BAR)
-        repeatedImportEnum.add(ImportEnum.IMPORT_BAR)
-        repeatedStringPiece.add("224")
-        repeatedCord.add("225")
-        repeatedInt32 += 301
-        repeatedInt64 += 302
-        repeatedUint32 += 303
-        repeatedUint64 += 304
-        repeatedSint32 += 305
-        repeatedSint64 += 306
-        repeatedFixed32 += 307
-        repeatedFixed64 += 308
-        repeatedSfixed32 += 309
-        repeatedSfixed64 += 310
-        repeatedFloat += 311f
-        repeatedDouble += 312.0
-        repeatedBool += false
-        repeatedString += "315"
-        repeatedBytes += toBytes("316")
-        repeatedGroup += TestAllTypesKt.repeatedGroup { a = 317 }
-        repeatedNestedMessage += nestedMessage { bb = 318 }
-        repeatedForeignMessage += foreignMessage { c = 319 }
-        repeatedImportMessage +=
-          ImportMessage.newBuilder().setD(320).build()
-        repeatedLazyMessage +=
-          TestAllTypesKt.nestedMessage { bb = 327 }
-        repeatedNestedEnum += NestedEnum.BAZ
-        repeatedForeignEnum += ForeignEnum.FOREIGN_BAZ
-        repeatedImportEnum += ImportEnum.IMPORT_BAZ
-        repeatedStringPiece += "324"
-        repeatedCord += "325"
-        defaultInt32 = 401
-        defaultInt64 = 402
-        defaultUint32 = 403
-        defaultUint64 = 404
-        defaultSint32 = 405
-        defaultSint64 = 406
-        defaultFixed32 = 407
-        defaultFixed64 = 408
-        defaultSfixed32 = 409
-        defaultSfixed64 = 410
-        defaultFloat = 411f
-        defaultDouble = 412.0
-        defaultBool = false
-        defaultString = "415"
-        defaultBytes = toBytes("416")
-        defaultNestedEnum = NestedEnum.FOO
-        defaultForeignEnum = ForeignEnum.FOREIGN_FOO
-        defaultImportEnum = ImportEnum.IMPORT_FOO
-        defaultStringPiece = "424"
-        defaultCord = "425"
-        oneofUint32 = 601
-        oneofNestedMessage =
-          TestAllTypesKt.nestedMessage { bb = 602 }
-        oneofString = "603"
-        oneofBytes = toBytes("604")
-      }
-    ).isEqualTo(
-      TestUtil.getAllSetBuilder().build()
-    )
+        testAllTypes {
+          optionalInt32 = 101
+          optionalInt64 = 102
+          optionalUint32 = 103
+          optionalUint64 = 104
+          optionalSint32 = 105
+          optionalSint64 = 106
+          optionalFixed32 = 107
+          optionalFixed64 = 108
+          optionalSfixed32 = 109
+          optionalSfixed64 = 110
+          optionalFloat = 111.0f
+          optionalDouble = 112.0
+          optionalBool = true
+          optionalString = "115"
+          optionalBytes = toBytes("116")
+          optionalGroup = TestAllTypesKt.optionalGroup { a = 117 }
+          optionalNestedMessage = nestedMessage { bb = 118 }
+          optionalForeignMessage = foreignMessage { c = 119 }
+          optionalImportMessage = ImportMessage.newBuilder().setD(120).build()
+          optionalPublicImportMessage = PublicImportMessage.newBuilder().setE(126).build()
+          optionalLazyMessage = nestedMessage { bb = 127 }
+          optionalNestedEnum = NestedEnum.BAZ
+          optionalForeignEnum = ForeignEnum.FOREIGN_BAZ
+          optionalImportEnum = ImportEnum.IMPORT_BAZ
+          optionalStringPiece = "124"
+          optionalCord = "125"
+          repeatedInt32.add(201)
+          repeatedInt64.add(202)
+          repeatedUint32.add(203)
+          repeatedUint64.add(204)
+          repeatedSint32.add(205)
+          repeatedSint64.add(206)
+          repeatedFixed32.add(207)
+          repeatedFixed64.add(208)
+          repeatedSfixed32.add(209)
+          repeatedSfixed64.add(210)
+          repeatedFloat.add(211f)
+          repeatedDouble.add(212.0)
+          repeatedBool.add(true)
+          repeatedString.add("215")
+          repeatedBytes.add(toBytes("216"))
+          repeatedGroup.add(TestAllTypesKt.repeatedGroup { a = 217 })
+          repeatedNestedMessage.add(nestedMessage { bb = 218 })
+          repeatedForeignMessage.add(foreignMessage { c = 219 })
+          repeatedImportMessage.add(ImportMessage.newBuilder().setD(220).build())
+          repeatedLazyMessage.add(nestedMessage { bb = 227 })
+          repeatedNestedEnum.add(NestedEnum.BAR)
+          repeatedForeignEnum.add(ForeignEnum.FOREIGN_BAR)
+          repeatedImportEnum.add(ImportEnum.IMPORT_BAR)
+          repeatedStringPiece.add("224")
+          repeatedCord.add("225")
+          repeatedInt32 += 301
+          repeatedInt64 += 302
+          repeatedUint32 += 303
+          repeatedUint64 += 304
+          repeatedSint32 += 305
+          repeatedSint64 += 306
+          repeatedFixed32 += 307
+          repeatedFixed64 += 308
+          repeatedSfixed32 += 309
+          repeatedSfixed64 += 310
+          repeatedFloat += 311f
+          repeatedDouble += 312.0
+          repeatedBool += false
+          repeatedString += "315"
+          repeatedBytes += toBytes("316")
+          repeatedGroup += TestAllTypesKt.repeatedGroup { a = 317 }
+          repeatedNestedMessage += nestedMessage { bb = 318 }
+          repeatedForeignMessage += foreignMessage { c = 319 }
+          repeatedImportMessage += ImportMessage.newBuilder().setD(320).build()
+          repeatedLazyMessage += TestAllTypesKt.nestedMessage { bb = 327 }
+          repeatedNestedEnum += NestedEnum.BAZ
+          repeatedForeignEnum += ForeignEnum.FOREIGN_BAZ
+          repeatedImportEnum += ImportEnum.IMPORT_BAZ
+          repeatedStringPiece += "324"
+          repeatedCord += "325"
+          defaultInt32 = 401
+          defaultInt64 = 402
+          defaultUint32 = 403
+          defaultUint64 = 404
+          defaultSint32 = 405
+          defaultSint64 = 406
+          defaultFixed32 = 407
+          defaultFixed64 = 408
+          defaultSfixed32 = 409
+          defaultSfixed64 = 410
+          defaultFloat = 411f
+          defaultDouble = 412.0
+          defaultBool = false
+          defaultString = "415"
+          defaultBytes = toBytes("416")
+          defaultNestedEnum = NestedEnum.FOO
+          defaultForeignEnum = ForeignEnum.FOREIGN_FOO
+          defaultImportEnum = ImportEnum.IMPORT_FOO
+          defaultStringPiece = "424"
+          defaultCord = "425"
+          oneofUint32 = 601
+          oneofNestedMessage = TestAllTypesKt.nestedMessage { bb = 602 }
+          oneofString = "603"
+          oneofBytes = toBytes("604")
+        }
+      )
+      .isEqualTo(TestUtil.getAllSetBuilder().build())
   }
 
   @Test
@@ -238,76 +229,66 @@
       assertThat(repeatedString).isEqualTo(listOf("5", "2", "3", "4"))
 
       repeatedGroup.addAll(
-        listOf(
-          TestAllTypesKt.repeatedGroup { a = 1 },
-          TestAllTypesKt.repeatedGroup { a = 2 }
-        )
+        listOf(TestAllTypesKt.repeatedGroup { a = 1 }, TestAllTypesKt.repeatedGroup { a = 2 })
       )
-      assertThat(repeatedGroup).isEqualTo(
-        listOf(
-          TestAllTypesKt.repeatedGroup { a = 1 },
-          TestAllTypesKt.repeatedGroup { a = 2 }
+      assertThat(repeatedGroup)
+        .isEqualTo(
+          listOf(TestAllTypesKt.repeatedGroup { a = 1 }, TestAllTypesKt.repeatedGroup { a = 2 })
         )
-      )
       repeatedGroup +=
-        listOf(
-          TestAllTypesKt.repeatedGroup { a = 3 },
-          TestAllTypesKt.repeatedGroup { a = 4 }
+        listOf(TestAllTypesKt.repeatedGroup { a = 3 }, TestAllTypesKt.repeatedGroup { a = 4 })
+      assertThat(repeatedGroup)
+        .isEqualTo(
+          listOf(
+            TestAllTypesKt.repeatedGroup { a = 1 },
+            TestAllTypesKt.repeatedGroup { a = 2 },
+            TestAllTypesKt.repeatedGroup { a = 3 },
+            TestAllTypesKt.repeatedGroup { a = 4 }
+          )
         )
-      assertThat(repeatedGroup).isEqualTo(
-        listOf(
-          TestAllTypesKt.repeatedGroup { a = 1 },
-          TestAllTypesKt.repeatedGroup { a = 2 },
-          TestAllTypesKt.repeatedGroup { a = 3 },
-          TestAllTypesKt.repeatedGroup { a = 4 }
-        )
-      )
       repeatedGroup[0] = TestAllTypesKt.repeatedGroup { a = 5 }
-      assertThat(repeatedGroup).isEqualTo(
-        listOf(
-          TestAllTypesKt.repeatedGroup { a = 5 },
-          TestAllTypesKt.repeatedGroup { a = 2 },
-          TestAllTypesKt.repeatedGroup { a = 3 },
-          TestAllTypesKt.repeatedGroup { a = 4 }
+      assertThat(repeatedGroup)
+        .isEqualTo(
+          listOf(
+            TestAllTypesKt.repeatedGroup { a = 5 },
+            TestAllTypesKt.repeatedGroup { a = 2 },
+            TestAllTypesKt.repeatedGroup { a = 3 },
+            TestAllTypesKt.repeatedGroup { a = 4 }
+          )
         )
-      )
 
       repeatedNestedMessage.addAll(listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 }))
-      assertThat(repeatedNestedMessage).isEqualTo(
-        listOf(
-          nestedMessage { bb = 1 },
-          nestedMessage { bb = 2 }
-        )
-      )
+      assertThat(repeatedNestedMessage)
+        .isEqualTo(listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 }))
       repeatedNestedMessage += listOf(nestedMessage { bb = 3 }, nestedMessage { bb = 4 })
-      assertThat(repeatedNestedMessage).isEqualTo(
-        listOf(
-          nestedMessage { bb = 1 },
-          nestedMessage { bb = 2 },
-          nestedMessage { bb = 3 },
-          nestedMessage { bb = 4 }
+      assertThat(repeatedNestedMessage)
+        .isEqualTo(
+          listOf(
+            nestedMessage { bb = 1 },
+            nestedMessage { bb = 2 },
+            nestedMessage { bb = 3 },
+            nestedMessage { bb = 4 }
+          )
         )
-      )
       repeatedNestedMessage[0] = nestedMessage { bb = 5 }
-      assertThat(repeatedNestedMessage).isEqualTo(
-        listOf(
-          nestedMessage { bb = 5 },
-          nestedMessage { bb = 2 },
-          nestedMessage { bb = 3 },
-          nestedMessage { bb = 4 }
+      assertThat(repeatedNestedMessage)
+        .isEqualTo(
+          listOf(
+            nestedMessage { bb = 5 },
+            nestedMessage { bb = 2 },
+            nestedMessage { bb = 3 },
+            nestedMessage { bb = 4 }
+          )
         )
-      )
 
       repeatedNestedEnum.addAll(listOf(NestedEnum.FOO, NestedEnum.BAR))
       assertThat(repeatedNestedEnum).isEqualTo(listOf(NestedEnum.FOO, NestedEnum.BAR))
       repeatedNestedEnum += listOf(NestedEnum.BAZ, NestedEnum.FOO)
-      assertThat(repeatedNestedEnum).isEqualTo(
-        listOf(NestedEnum.FOO, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO)
-      )
+      assertThat(repeatedNestedEnum)
+        .isEqualTo(listOf(NestedEnum.FOO, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO))
       repeatedNestedEnum[0] = NestedEnum.BAR
-      assertThat(repeatedNestedEnum).isEqualTo(
-        listOf(NestedEnum.BAR, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO)
-      )
+      assertThat(repeatedNestedEnum)
+        .isEqualTo(listOf(NestedEnum.BAR, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO))
     }
   }
 
@@ -380,160 +361,151 @@
       optionalInt32 = 101
       optionalString = "115"
     }
-    val modifiedMessage = message.copy {
-      optionalInt32 = 201
-    }
+    val modifiedMessage = message.copy { optionalInt32 = 201 }
 
-    assertThat(message).isEqualTo(
-      TestAllTypes.newBuilder()
-        .setOptionalInt32(101)
-        .setOptionalString("115")
-        .build()
-    )
-    assertThat(modifiedMessage).isEqualTo(
-      TestAllTypes.newBuilder()
-        .setOptionalInt32(201)
-        .setOptionalString("115")
-        .build()
-    )
+    assertThat(message)
+      .isEqualTo(TestAllTypes.newBuilder().setOptionalInt32(101).setOptionalString("115").build())
+    assertThat(modifiedMessage)
+      .isEqualTo(TestAllTypes.newBuilder().setOptionalInt32(201).setOptionalString("115").build())
   }
 
   @Test
   fun testOneof() {
     val message = testAllTypes {
       oneofString = "foo"
-      assertThat(oneofFieldCase)
-        .isEqualTo(TestAllTypes.OneofFieldCase.ONEOF_STRING)
+      assertThat(oneofFieldCase).isEqualTo(TestAllTypes.OneofFieldCase.ONEOF_STRING)
       assertThat(oneofString).isEqualTo("foo")
       clearOneofField()
       assertThat(hasOneofUint32()).isFalse()
-      assertThat(oneofFieldCase)
-        .isEqualTo(TestAllTypes.OneofFieldCase.ONEOFFIELD_NOT_SET)
+      assertThat(oneofFieldCase).isEqualTo(TestAllTypes.OneofFieldCase.ONEOFFIELD_NOT_SET)
       oneofUint32 = 5
     }
 
-    assertThat(message.getOneofFieldCase())
-      .isEqualTo(TestAllTypes.OneofFieldCase.ONEOF_UINT32)
+    assertThat(message.getOneofFieldCase()).isEqualTo(TestAllTypes.OneofFieldCase.ONEOF_UINT32)
     assertThat(message.getOneofUint32()).isEqualTo(5)
   }
 
   @Test
   fun testExtensionsSet() {
     assertThat(
-      testAllExtensions {
-        this[UnittestProto.optionalInt32Extension] = 101
-        this[UnittestProto.optionalInt64Extension] = 102L
-        this[UnittestProto.optionalUint32Extension] = 103
-        this[UnittestProto.optionalUint64Extension] = 104L
-        this[UnittestProto.optionalSint32Extension] = 105
-        this[UnittestProto.optionalSint64Extension] = 106L
-        this[UnittestProto.optionalFixed32Extension] = 107
-        this[UnittestProto.optionalFixed64Extension] = 108L
-        this[UnittestProto.optionalSfixed32Extension] = 109
-        this[UnittestProto.optionalSfixed64Extension] = 110L
-        this[UnittestProto.optionalFloatExtension] = 111F
-        this[UnittestProto.optionalDoubleExtension] = 112.0
-        this[UnittestProto.optionalBoolExtension] = true
-        this[UnittestProto.optionalStringExtension] = "115"
-        this[UnittestProto.optionalBytesExtension] = toBytes("116")
-        this[UnittestProto.optionalGroupExtension] = optionalGroupExtension { a = 117 }
-        this[UnittestProto.optionalNestedMessageExtension] =
-          TestAllTypesKt.nestedMessage { bb = 118 }
-        this[UnittestProto.optionalForeignMessageExtension] = foreignMessage { c = 119 }
-        this[UnittestProto.optionalImportMessageExtension] =
-          ImportMessage.newBuilder().setD(120).build()
-        this[UnittestProto.optionalPublicImportMessageExtension] =
-          PublicImportMessage.newBuilder().setE(126).build()
-        this[UnittestProto.optionalLazyMessageExtension] = TestAllTypesKt.nestedMessage { bb = 127 }
-        this[UnittestProto.optionalNestedEnumExtension] = NestedEnum.BAZ
-        this[UnittestProto.optionalForeignEnumExtension] = ForeignEnum.FOREIGN_BAZ
-        this[UnittestProto.optionalImportEnumExtension] = ImportEnum.IMPORT_BAZ
-        this[UnittestProto.optionalStringPieceExtension] = "124"
-        this[UnittestProto.optionalCordExtension] = "125"
-        this[UnittestProto.repeatedInt32Extension].add(201)
-        this[UnittestProto.repeatedInt64Extension].add(202L)
-        this[UnittestProto.repeatedUint32Extension].add(203)
-        this[UnittestProto.repeatedUint64Extension].add(204L)
-        this[UnittestProto.repeatedSint32Extension].add(205)
-        this[UnittestProto.repeatedSint64Extension].add(206L)
-        this[UnittestProto.repeatedFixed32Extension].add(207)
-        this[UnittestProto.repeatedFixed64Extension].add(208L)
-        this[UnittestProto.repeatedSfixed32Extension].add(209)
-        this[UnittestProto.repeatedSfixed64Extension].add(210L)
-        this[UnittestProto.repeatedFloatExtension].add(211F)
-        this[UnittestProto.repeatedDoubleExtension].add(212.0)
-        this[UnittestProto.repeatedBoolExtension].add(true)
-        this[UnittestProto.repeatedStringExtension].add("215")
-        this[UnittestProto.repeatedBytesExtension].add(toBytes("216"))
-        this[UnittestProto.repeatedGroupExtension].add(repeatedGroupExtension { a = 217 })
-        this[UnittestProto.repeatedNestedMessageExtension]
-          .add(TestAllTypesKt.nestedMessage { bb = 218 })
-        this[UnittestProto.repeatedForeignMessageExtension].add(foreignMessage { c = 219 })
-        this[UnittestProto.repeatedImportMessageExtension]
-          .add(ImportMessage.newBuilder().setD(220).build())
-        this[UnittestProto.repeatedLazyMessageExtension]
-          .add(TestAllTypesKt.nestedMessage { bb = 227 })
-        this[UnittestProto.repeatedNestedEnumExtension].add(NestedEnum.BAR)
-        this[UnittestProto.repeatedForeignEnumExtension].add(ForeignEnum.FOREIGN_BAR)
-        this[UnittestProto.repeatedImportEnumExtension].add(ImportEnum.IMPORT_BAR)
-        this[UnittestProto.repeatedStringPieceExtension].add("224")
-        this[UnittestProto.repeatedCordExtension].add("225")
-        this[UnittestProto.repeatedInt32Extension] += 301
-        this[UnittestProto.repeatedInt64Extension] += 302L
-        this[UnittestProto.repeatedUint32Extension] += 303
-        this[UnittestProto.repeatedUint64Extension] += 304L
-        this[UnittestProto.repeatedSint32Extension] += 305
-        this[UnittestProto.repeatedSint64Extension] += 306L
-        this[UnittestProto.repeatedFixed32Extension] += 307
-        this[UnittestProto.repeatedFixed64Extension] += 308L
-        this[UnittestProto.repeatedSfixed32Extension] += 309
-        this[UnittestProto.repeatedSfixed64Extension] += 310L
-        this[UnittestProto.repeatedFloatExtension] += 311F
-        this[UnittestProto.repeatedDoubleExtension] += 312.0
-        this[UnittestProto.repeatedBoolExtension] += false
-        this[UnittestProto.repeatedStringExtension] += "315"
-        this[UnittestProto.repeatedBytesExtension] += toBytes("316")
-        this[UnittestProto.repeatedGroupExtension] += repeatedGroupExtension { a = 317 }
-        this[UnittestProto.repeatedNestedMessageExtension] +=
-	  TestAllTypesKt.nestedMessage { bb = 318 }
-        this[UnittestProto.repeatedForeignMessageExtension] += foreignMessage { c = 319 }
-        this[UnittestProto.repeatedImportMessageExtension] +=
-          ImportMessage.newBuilder().setD(320).build()
-        this[UnittestProto.repeatedLazyMessageExtension] +=
-	  TestAllTypesKt.nestedMessage { bb = 327 }
-        this[UnittestProto.repeatedNestedEnumExtension] += NestedEnum.BAZ
-        this[UnittestProto.repeatedForeignEnumExtension] += ForeignEnum.FOREIGN_BAZ
-        this[UnittestProto.repeatedImportEnumExtension] += ImportEnum.IMPORT_BAZ
-        this[UnittestProto.repeatedStringPieceExtension] += "324"
-        this[UnittestProto.repeatedCordExtension] += "325"
-        this[UnittestProto.defaultInt32Extension] = 401
-        this[UnittestProto.defaultInt64Extension] = 402L
-        this[UnittestProto.defaultUint32Extension] = 403
-        this[UnittestProto.defaultUint64Extension] = 404L
-        this[UnittestProto.defaultSint32Extension] = 405
-        this[UnittestProto.defaultSint64Extension] = 406L
-        this[UnittestProto.defaultFixed32Extension] = 407
-        this[UnittestProto.defaultFixed64Extension] = 408L
-        this[UnittestProto.defaultSfixed32Extension] = 409
-        this[UnittestProto.defaultSfixed64Extension] = 410L
-        this[UnittestProto.defaultFloatExtension] = 411F
-        this[UnittestProto.defaultDoubleExtension] = 412.0
-        this[UnittestProto.defaultBoolExtension] = false
-        this[UnittestProto.defaultStringExtension] = "415"
-        this[UnittestProto.defaultBytesExtension] = toBytes("416")
-        this[UnittestProto.defaultNestedEnumExtension] = NestedEnum.FOO
-        this[UnittestProto.defaultForeignEnumExtension] = ForeignEnum.FOREIGN_FOO
-        this[UnittestProto.defaultImportEnumExtension] = ImportEnum.IMPORT_FOO
-        this[UnittestProto.defaultStringPieceExtension] = "424"
-        this[UnittestProto.defaultCordExtension] = "425"
-        this[UnittestProto.oneofUint32Extension] = 601
-        this[UnittestProto.oneofNestedMessageExtension] = TestAllTypesKt.nestedMessage { bb = 602 }
-        this[UnittestProto.oneofStringExtension] = "603"
-        this[UnittestProto.oneofBytesExtension] = toBytes("604")
-      }
-    ).isEqualTo(
-      TestUtil.getAllExtensionsSet()
-    )
+        testAllExtensions {
+          this[UnittestProto.optionalInt32Extension] = 101
+          this[UnittestProto.optionalInt64Extension] = 102L
+          this[UnittestProto.optionalUint32Extension] = 103
+          this[UnittestProto.optionalUint64Extension] = 104L
+          this[UnittestProto.optionalSint32Extension] = 105
+          this[UnittestProto.optionalSint64Extension] = 106L
+          this[UnittestProto.optionalFixed32Extension] = 107
+          this[UnittestProto.optionalFixed64Extension] = 108L
+          this[UnittestProto.optionalSfixed32Extension] = 109
+          this[UnittestProto.optionalSfixed64Extension] = 110L
+          this[UnittestProto.optionalFloatExtension] = 111F
+          this[UnittestProto.optionalDoubleExtension] = 112.0
+          this[UnittestProto.optionalBoolExtension] = true
+          this[UnittestProto.optionalStringExtension] = "115"
+          this[UnittestProto.optionalBytesExtension] = toBytes("116")
+          this[UnittestProto.optionalGroupExtension] = optionalGroupExtension { a = 117 }
+          this[UnittestProto.optionalNestedMessageExtension] =
+            TestAllTypesKt.nestedMessage { bb = 118 }
+          this[UnittestProto.optionalForeignMessageExtension] = foreignMessage { c = 119 }
+          this[UnittestProto.optionalImportMessageExtension] =
+            ImportMessage.newBuilder().setD(120).build()
+          this[UnittestProto.optionalPublicImportMessageExtension] =
+            PublicImportMessage.newBuilder().setE(126).build()
+          this[UnittestProto.optionalLazyMessageExtension] =
+            TestAllTypesKt.nestedMessage { bb = 127 }
+          this[UnittestProto.optionalNestedEnumExtension] = NestedEnum.BAZ
+          this[UnittestProto.optionalForeignEnumExtension] = ForeignEnum.FOREIGN_BAZ
+          this[UnittestProto.optionalImportEnumExtension] = ImportEnum.IMPORT_BAZ
+          this[UnittestProto.optionalStringPieceExtension] = "124"
+          this[UnittestProto.optionalCordExtension] = "125"
+          this[UnittestProto.repeatedInt32Extension].add(201)
+          this[UnittestProto.repeatedInt64Extension].add(202L)
+          this[UnittestProto.repeatedUint32Extension].add(203)
+          this[UnittestProto.repeatedUint64Extension].add(204L)
+          this[UnittestProto.repeatedSint32Extension].add(205)
+          this[UnittestProto.repeatedSint64Extension].add(206L)
+          this[UnittestProto.repeatedFixed32Extension].add(207)
+          this[UnittestProto.repeatedFixed64Extension].add(208L)
+          this[UnittestProto.repeatedSfixed32Extension].add(209)
+          this[UnittestProto.repeatedSfixed64Extension].add(210L)
+          this[UnittestProto.repeatedFloatExtension].add(211F)
+          this[UnittestProto.repeatedDoubleExtension].add(212.0)
+          this[UnittestProto.repeatedBoolExtension].add(true)
+          this[UnittestProto.repeatedStringExtension].add("215")
+          this[UnittestProto.repeatedBytesExtension].add(toBytes("216"))
+          this[UnittestProto.repeatedGroupExtension].add(repeatedGroupExtension { a = 217 })
+          this[UnittestProto.repeatedNestedMessageExtension].add(
+            TestAllTypesKt.nestedMessage { bb = 218 }
+          )
+          this[UnittestProto.repeatedForeignMessageExtension].add(foreignMessage { c = 219 })
+          this[UnittestProto.repeatedImportMessageExtension].add(
+            ImportMessage.newBuilder().setD(220).build()
+          )
+          this[UnittestProto.repeatedLazyMessageExtension].add(
+            TestAllTypesKt.nestedMessage { bb = 227 }
+          )
+          this[UnittestProto.repeatedNestedEnumExtension].add(NestedEnum.BAR)
+          this[UnittestProto.repeatedForeignEnumExtension].add(ForeignEnum.FOREIGN_BAR)
+          this[UnittestProto.repeatedImportEnumExtension].add(ImportEnum.IMPORT_BAR)
+          this[UnittestProto.repeatedStringPieceExtension].add("224")
+          this[UnittestProto.repeatedCordExtension].add("225")
+          this[UnittestProto.repeatedInt32Extension] += 301
+          this[UnittestProto.repeatedInt64Extension] += 302L
+          this[UnittestProto.repeatedUint32Extension] += 303
+          this[UnittestProto.repeatedUint64Extension] += 304L
+          this[UnittestProto.repeatedSint32Extension] += 305
+          this[UnittestProto.repeatedSint64Extension] += 306L
+          this[UnittestProto.repeatedFixed32Extension] += 307
+          this[UnittestProto.repeatedFixed64Extension] += 308L
+          this[UnittestProto.repeatedSfixed32Extension] += 309
+          this[UnittestProto.repeatedSfixed64Extension] += 310L
+          this[UnittestProto.repeatedFloatExtension] += 311F
+          this[UnittestProto.repeatedDoubleExtension] += 312.0
+          this[UnittestProto.repeatedBoolExtension] += false
+          this[UnittestProto.repeatedStringExtension] += "315"
+          this[UnittestProto.repeatedBytesExtension] += toBytes("316")
+          this[UnittestProto.repeatedGroupExtension] += repeatedGroupExtension { a = 317 }
+          this[UnittestProto.repeatedNestedMessageExtension] +=
+            TestAllTypesKt.nestedMessage { bb = 318 }
+          this[UnittestProto.repeatedForeignMessageExtension] += foreignMessage { c = 319 }
+          this[UnittestProto.repeatedImportMessageExtension] +=
+            ImportMessage.newBuilder().setD(320).build()
+          this[UnittestProto.repeatedLazyMessageExtension] +=
+            TestAllTypesKt.nestedMessage { bb = 327 }
+          this[UnittestProto.repeatedNestedEnumExtension] += NestedEnum.BAZ
+          this[UnittestProto.repeatedForeignEnumExtension] += ForeignEnum.FOREIGN_BAZ
+          this[UnittestProto.repeatedImportEnumExtension] += ImportEnum.IMPORT_BAZ
+          this[UnittestProto.repeatedStringPieceExtension] += "324"
+          this[UnittestProto.repeatedCordExtension] += "325"
+          this[UnittestProto.defaultInt32Extension] = 401
+          this[UnittestProto.defaultInt64Extension] = 402L
+          this[UnittestProto.defaultUint32Extension] = 403
+          this[UnittestProto.defaultUint64Extension] = 404L
+          this[UnittestProto.defaultSint32Extension] = 405
+          this[UnittestProto.defaultSint64Extension] = 406L
+          this[UnittestProto.defaultFixed32Extension] = 407
+          this[UnittestProto.defaultFixed64Extension] = 408L
+          this[UnittestProto.defaultSfixed32Extension] = 409
+          this[UnittestProto.defaultSfixed64Extension] = 410L
+          this[UnittestProto.defaultFloatExtension] = 411F
+          this[UnittestProto.defaultDoubleExtension] = 412.0
+          this[UnittestProto.defaultBoolExtension] = false
+          this[UnittestProto.defaultStringExtension] = "415"
+          this[UnittestProto.defaultBytesExtension] = toBytes("416")
+          this[UnittestProto.defaultNestedEnumExtension] = NestedEnum.FOO
+          this[UnittestProto.defaultForeignEnumExtension] = ForeignEnum.FOREIGN_FOO
+          this[UnittestProto.defaultImportEnumExtension] = ImportEnum.IMPORT_FOO
+          this[UnittestProto.defaultStringPieceExtension] = "424"
+          this[UnittestProto.defaultCordExtension] = "425"
+          this[UnittestProto.oneofUint32Extension] = 601
+          this[UnittestProto.oneofNestedMessageExtension] =
+            TestAllTypesKt.nestedMessage { bb = 602 }
+          this[UnittestProto.oneofStringExtension] = "603"
+          this[UnittestProto.oneofBytesExtension] = toBytes("604")
+        }
+      )
+      .isEqualTo(TestUtil.getAllExtensionsSet())
   }
 
   @Test
@@ -546,8 +518,7 @@
       this[UnittestProto.optionalGroupExtension] = optionalGroupExtension { a = 117 }
       assertThat(this[UnittestProto.optionalGroupExtension])
         .isEqualTo(optionalGroupExtension { a = 117 })
-      this[UnittestProto.optionalNestedMessageExtension] =
-        TestAllTypesKt.nestedMessage { bb = 118 }
+      this[UnittestProto.optionalNestedMessageExtension] = TestAllTypesKt.nestedMessage { bb = 118 }
       assertThat(this[UnittestProto.optionalNestedMessageExtension])
         .isEqualTo(TestAllTypesKt.nestedMessage { bb = 118 })
       this[UnittestProto.optionalNestedEnumExtension] = NestedEnum.BAZ
@@ -577,74 +548,65 @@
       assertThat(this[UnittestProto.repeatedStringExtension]).isEqualTo(listOf("5", "2", "3", "4"))
 
       this[UnittestProto.repeatedGroupExtension].addAll(
-        listOf(
-          repeatedGroupExtension { a = 1 },
-          repeatedGroupExtension { a = 2 }
-        )
+        listOf(repeatedGroupExtension { a = 1 }, repeatedGroupExtension { a = 2 })
       )
-      assertThat(this[UnittestProto.repeatedGroupExtension]).isEqualTo(
-        listOf(
-          repeatedGroupExtension { a = 1 },
-          repeatedGroupExtension { a = 2 }
-        )
-      )
+      assertThat(this[UnittestProto.repeatedGroupExtension])
+        .isEqualTo(listOf(repeatedGroupExtension { a = 1 }, repeatedGroupExtension { a = 2 }))
       this[UnittestProto.repeatedGroupExtension] +=
-        listOf(
-          repeatedGroupExtension { a = 3 },
-          repeatedGroupExtension { a = 4 }
+        listOf(repeatedGroupExtension { a = 3 }, repeatedGroupExtension { a = 4 })
+      assertThat(this[UnittestProto.repeatedGroupExtension])
+        .isEqualTo(
+          listOf(
+            repeatedGroupExtension { a = 1 },
+            repeatedGroupExtension { a = 2 },
+            repeatedGroupExtension { a = 3 },
+            repeatedGroupExtension { a = 4 }
+          )
         )
-      assertThat(this[UnittestProto.repeatedGroupExtension]).isEqualTo(
-        listOf(
-          repeatedGroupExtension { a = 1 },
-          repeatedGroupExtension { a = 2 },
-          repeatedGroupExtension { a = 3 },
-          repeatedGroupExtension { a = 4 }
-        )
-      )
       this[UnittestProto.repeatedGroupExtension][0] = repeatedGroupExtension { a = 5 }
-      assertThat(this[UnittestProto.repeatedGroupExtension]).isEqualTo(
-        listOf(
-          repeatedGroupExtension { a = 5 },
-          repeatedGroupExtension { a = 2 },
-          repeatedGroupExtension { a = 3 },
-          repeatedGroupExtension { a = 4 }
+      assertThat(this[UnittestProto.repeatedGroupExtension])
+        .isEqualTo(
+          listOf(
+            repeatedGroupExtension { a = 5 },
+            repeatedGroupExtension { a = 2 },
+            repeatedGroupExtension { a = 3 },
+            repeatedGroupExtension { a = 4 }
+          )
         )
-      )
 
       this[UnittestProto.repeatedNestedMessageExtension].addAll(
         listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 })
       )
-      assertThat(this[UnittestProto.repeatedNestedMessageExtension]).isEqualTo(
-        listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 })
-      )
+      assertThat(this[UnittestProto.repeatedNestedMessageExtension])
+        .isEqualTo(listOf(nestedMessage { bb = 1 }, nestedMessage { bb = 2 }))
       this[UnittestProto.repeatedNestedMessageExtension] +=
         listOf(nestedMessage { bb = 3 }, nestedMessage { bb = 4 })
-      assertThat(this[UnittestProto.repeatedNestedMessageExtension]).isEqualTo(
-        listOf(
-          nestedMessage { bb = 1 },
-          nestedMessage { bb = 2 },
-          nestedMessage { bb = 3 },
-          nestedMessage { bb = 4 }
+      assertThat(this[UnittestProto.repeatedNestedMessageExtension])
+        .isEqualTo(
+          listOf(
+            nestedMessage { bb = 1 },
+            nestedMessage { bb = 2 },
+            nestedMessage { bb = 3 },
+            nestedMessage { bb = 4 }
+          )
         )
-      )
       this[UnittestProto.repeatedNestedMessageExtension][0] = nestedMessage { bb = 5 }
-      assertThat(this[UnittestProto.repeatedNestedMessageExtension]).isEqualTo(
-        listOf(
-          nestedMessage { bb = 5 },
-          nestedMessage { bb = 2 },
-          nestedMessage { bb = 3 },
-          nestedMessage { bb = 4 }
+      assertThat(this[UnittestProto.repeatedNestedMessageExtension])
+        .isEqualTo(
+          listOf(
+            nestedMessage { bb = 5 },
+            nestedMessage { bb = 2 },
+            nestedMessage { bb = 3 },
+            nestedMessage { bb = 4 }
+          )
         )
-      )
 
-      this[UnittestProto.repeatedNestedEnumExtension]
-        .addAll(listOf(NestedEnum.FOO, NestedEnum.BAR))
+      this[UnittestProto.repeatedNestedEnumExtension].addAll(listOf(NestedEnum.FOO, NestedEnum.BAR))
       assertThat(this[UnittestProto.repeatedNestedEnumExtension])
         .isEqualTo(listOf(NestedEnum.FOO, NestedEnum.BAR))
       this[UnittestProto.repeatedNestedEnumExtension] += listOf(NestedEnum.BAZ, NestedEnum.FOO)
-      assertThat(this[UnittestProto.repeatedNestedEnumExtension]).isEqualTo(
-        listOf(NestedEnum.FOO, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO)
-      )
+      assertThat(this[UnittestProto.repeatedNestedEnumExtension])
+        .isEqualTo(listOf(NestedEnum.FOO, NestedEnum.BAR, NestedEnum.BAZ, NestedEnum.FOO))
     }
   }
 
@@ -669,8 +631,7 @@
       this[UnittestProto.optionalStringExtension] = "115"
       assertThat(contains(UnittestProto.optionalStringExtension)).isTrue()
       assertThat(contains(UnittestProto.optionalGroupExtension)).isFalse()
-      this[UnittestProto.optionalNestedMessageExtension] =
-        TestAllTypesKt.nestedMessage { bb = 118 }
+      this[UnittestProto.optionalNestedMessageExtension] = TestAllTypesKt.nestedMessage { bb = 118 }
       assertThat(contains(UnittestProto.optionalNestedMessageExtension)).isTrue()
       assertThat(contains(UnittestProto.optionalNestedEnumExtension)).isFalse()
       this[UnittestProto.defaultInt32Extension] = 401
@@ -694,8 +655,7 @@
       clear(UnittestProto.optionalGroupExtension)
       assertThat(contains(UnittestProto.optionalGroupExtension)).isFalse()
 
-      this[UnittestProto.optionalNestedMessageExtension] =
-        TestAllTypesKt.nestedMessage { bb = 118 }
+      this[UnittestProto.optionalNestedMessageExtension] = TestAllTypesKt.nestedMessage { bb = 118 }
       clear(UnittestProto.optionalNestedMessageExtension)
       assertThat(contains(UnittestProto.optionalNestedMessageExtension)).isFalse()
 
@@ -711,80 +671,66 @@
 
   @Test
   fun testEmptyMessages() {
-    assertThat(
-      testEmptyMessage {}
-    ).isEqualTo(
-      TestEmptyMessage.newBuilder().build()
-    )
+    assertThat(testEmptyMessage {}).isEqualTo(TestEmptyMessage.newBuilder().build())
 
-    assertThat(
-      testEmptyMessageWithExtensions {}
-    ).isEqualTo(
-      TestEmptyMessageWithExtensions.newBuilder().build()
-    )
+    assertThat(testEmptyMessageWithExtensions {})
+      .isEqualTo(TestEmptyMessageWithExtensions.newBuilder().build())
   }
 
   @Test
   fun testMapSetters() {
     val intMap = testIntIntMap { m[1] = 2 }
-    assertThat(intMap).isEqualTo(
-      TestIntIntMap.newBuilder().putM(1, 2).build()
-    )
+    assertThat(intMap).isEqualTo(TestIntIntMap.newBuilder().putM(1, 2).build())
 
     assertThat(
-      testMaps {
-        mInt32[1] = intMap
-        mInt64[1L] = intMap
-        mUint32[1] = intMap
-        mUint64[1L] = intMap
-        mSint32[1] = intMap
-        mSint64[1L] = intMap
-        mFixed32[1] = intMap
-        mFixed64[1L] = intMap
-        mSfixed32[1] = intMap
-        mSfixed64[1] = intMap
-        mBool[true] = intMap
-        mString["1"] = intMap
-      }
-    ).isEqualTo(
-      TestMaps.newBuilder()
-        .putMInt32(1, intMap)
-        .putMInt64(1L, intMap)
-        .putMUint32(1, intMap)
-        .putMUint64(1L, intMap)
-        .putMSint32(1, intMap)
-        .putMSint64(1L, intMap)
-        .putMFixed32(1, intMap)
-        .putMFixed64(1L, intMap)
-        .putMSfixed32(1, intMap)
-        .putMSfixed64(1L, intMap)
-        .putMBool(true, intMap)
-        .putMString("1", intMap)
-        .build()
-    )
+        testMaps {
+          mInt32[1] = intMap
+          mInt64[1L] = intMap
+          mUint32[1] = intMap
+          mUint64[1L] = intMap
+          mSint32[1] = intMap
+          mSint64[1L] = intMap
+          mFixed32[1] = intMap
+          mFixed64[1L] = intMap
+          mSfixed32[1] = intMap
+          mSfixed64[1] = intMap
+          mBool[true] = intMap
+          mString["1"] = intMap
+        }
+      )
+      .isEqualTo(
+        TestMaps.newBuilder()
+          .putMInt32(1, intMap)
+          .putMInt64(1L, intMap)
+          .putMUint32(1, intMap)
+          .putMUint64(1L, intMap)
+          .putMSint32(1, intMap)
+          .putMSint64(1L, intMap)
+          .putMFixed32(1, intMap)
+          .putMFixed64(1L, intMap)
+          .putMSfixed32(1, intMap)
+          .putMSfixed64(1L, intMap)
+          .putMBool(true, intMap)
+          .putMString("1", intMap)
+          .build()
+      )
 
-    assertThat(
-      testEnumMap {
-        knownMapField[1] = Proto2MapEnum.PROTO2_MAP_ENUM_FOO
-      }
-    ).isEqualTo(
-      TestEnumMap.newBuilder()
-        .putKnownMapField(1, Proto2MapEnum.PROTO2_MAP_ENUM_FOO)
-        .build()
-    )
+    assertThat(testEnumMap { knownMapField[1] = Proto2MapEnum.PROTO2_MAP_ENUM_FOO })
+      .isEqualTo(
+        TestEnumMap.newBuilder().putKnownMapField(1, Proto2MapEnum.PROTO2_MAP_ENUM_FOO).build()
+      )
   }
 
   @Test
   fun testMapGettersAndSetters() {
-    val intMap =
-      testIntIntMap {
-        m.put(1, 2)
-        assertThat(m).isEqualTo(mapOf(1 to 2))
-        m[3] = 4
-        assertThat(m).isEqualTo(mapOf(1 to 2, 3 to 4))
-        m.putAll(mapOf(5 to 6, 7 to 8))
-        assertThat(m).isEqualTo(mapOf(1 to 2, 3 to 4, 5 to 6, 7 to 8))
-      }
+    val intMap = testIntIntMap {
+      m.put(1, 2)
+      assertThat(m).isEqualTo(mapOf(1 to 2))
+      m[3] = 4
+      assertThat(m).isEqualTo(mapOf(1 to 2, 3 to 4))
+      m.putAll(mapOf(5 to 6, 7 to 8))
+      assertThat(m).isEqualTo(mapOf(1 to 2, 3 to 4, 5 to 6, 7 to 8))
+    }
 
     testMaps {
       mInt32.put(1, intMap)
@@ -799,40 +745,40 @@
       mString["2"] = intMap
       assertThat(mString).isEqualTo(mapOf("1" to intMap, "2" to intMap))
       mString.putAll(mapOf("3" to intMap, "4" to intMap))
-      assertThat(mString).isEqualTo(
-        mapOf("1" to intMap, "2" to intMap, "3" to intMap, "4" to intMap)
-      )
+      assertThat(mString)
+        .isEqualTo(mapOf("1" to intMap, "2" to intMap, "3" to intMap, "4" to intMap))
     }
 
     testEnumMap {
       knownMapField.put(1, Proto2MapEnum.PROTO2_MAP_ENUM_FOO)
       assertThat(knownMapField).isEqualTo(mapOf(1 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO))
       knownMapField[2] = Proto2MapEnum.PROTO2_MAP_ENUM_BAR
-      assertThat(knownMapField).isEqualTo(
-        mapOf(1 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO, 2 to Proto2MapEnum.PROTO2_MAP_ENUM_BAR)
-      )
+      assertThat(knownMapField)
+        .isEqualTo(
+          mapOf(1 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO, 2 to Proto2MapEnum.PROTO2_MAP_ENUM_BAR)
+        )
       knownMapField.putAll(
         mapOf(3 to Proto2MapEnum.PROTO2_MAP_ENUM_BAZ, 4 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO)
       )
-      assertThat(knownMapField).isEqualTo(
-        mapOf(
-          1 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO,
-          2 to Proto2MapEnum.PROTO2_MAP_ENUM_BAR,
-          3 to Proto2MapEnum.PROTO2_MAP_ENUM_BAZ,
-          4 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO
+      assertThat(knownMapField)
+        .isEqualTo(
+          mapOf(
+            1 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO,
+            2 to Proto2MapEnum.PROTO2_MAP_ENUM_BAR,
+            3 to Proto2MapEnum.PROTO2_MAP_ENUM_BAZ,
+            4 to Proto2MapEnum.PROTO2_MAP_ENUM_FOO
+          )
         )
-      )
     }
   }
 
   @Test
   fun testMapRemove() {
-    val intMap =
-      testIntIntMap {
-        m.putAll(mapOf(1 to 2, 3 to 4))
-        m.remove(1)
-        assertThat(m).isEqualTo(mapOf(3 to 4))
-      }
+    val intMap = testIntIntMap {
+      m.putAll(mapOf(1 to 2, 3 to 4))
+      m.remove(1)
+      assertThat(m).isEqualTo(mapOf(3 to 4))
+    }
 
     testMaps {
       mInt32.putAll(mapOf(1 to intMap, 2 to intMap))
@@ -855,12 +801,11 @@
 
   @Test
   fun testMapClear() {
-    val intMap =
-      testIntIntMap {
-        m.putAll(mapOf(1 to 2, 3 to 4))
-        m.clear()
-        assertThat(m.isEmpty()).isTrue()
-      }
+    val intMap = testIntIntMap {
+      m.putAll(mapOf(1 to 2, 3 to 4))
+      m.clear()
+      assertThat(m.isEmpty()).isTrue()
+    }
 
     testMaps {
       mInt32.putAll(mapOf(1 to intMap, 2 to intMap))
@@ -884,56 +829,57 @@
   @Test
   fun testEvilNames() {
     assertThat(
-      evilNamesProto2 {
-        initialized = true
-        hasFoo = true
-        bar = "foo"
-        isInitialized = true
-        fooBar = "foo"
-        aLLCAPS += "foo"
-        aLLCAPSMAP[1] = true
-        hasUnderbarPrecedingNumeric1Foo = true
-        hasUnderbarPrecedingNumeric42Bar = true
-        hasUnderbarPrecedingNumeric123Foo42BarBaz = true
-        extension += "foo"
-        class_ += 1
-        int = 1.0
-        long = true
-        boolean = 1L
-        sealed = "foo"
-        interface_ = 1F
-        in_ = 1
-        object_ = "foo"
-        cachedSize_ = "foo"
-        serializedSize_ = true
-        by = "foo"
-      }
-    ).isEqualTo(
-      EvilNamesProto2.newBuilder()
-        .setInitialized(true)
-        .setHasFoo(true)
-        .setBar("foo")
-        .setIsInitialized(true)
-        .setFooBar("foo")
-        .addALLCAPS("foo")
-        .putALLCAPSMAP(1, true)
-        .setHasUnderbarPrecedingNumeric1Foo(true)
-        .setHasUnderbarPrecedingNumeric42Bar(true)
-        .setHasUnderbarPrecedingNumeric123Foo42BarBaz(true)
-        .addExtension("foo")
-        .addClass_(1)
-        .setInt(1.0)
-        .setLong(true)
-        .setBoolean(1L)
-        .setSealed("foo")
-        .setInterface(1F)
-        .setIn(1)
-        .setObject("foo")
-        .setCachedSize_("foo")
-        .setSerializedSize_(true)
-        .setBy("foo")
-        .build()
-    )
+        evilNamesProto2 {
+          initialized = true
+          hasFoo = true
+          bar = "foo"
+          isInitialized = true
+          fooBar = "foo"
+          aLLCAPS += "foo"
+          aLLCAPSMAP[1] = true
+          hasUnderbarPrecedingNumeric1Foo = true
+          hasUnderbarPrecedingNumeric42Bar = true
+          hasUnderbarPrecedingNumeric123Foo42BarBaz = true
+          extension += "foo"
+          class_ += 1
+          int = 1.0
+          long = true
+          boolean = 1L
+          sealed = "foo"
+          interface_ = 1F
+          in_ = 1
+          object_ = "foo"
+          cachedSize_ = "foo"
+          serializedSize_ = true
+          by = "foo"
+        }
+      )
+      .isEqualTo(
+        EvilNamesProto2.newBuilder()
+          .setInitialized(true)
+          .setHasFoo(true)
+          .setBar("foo")
+          .setIsInitialized(true)
+          .setFooBar("foo")
+          .addALLCAPS("foo")
+          .putALLCAPSMAP(1, true)
+          .setHasUnderbarPrecedingNumeric1Foo(true)
+          .setHasUnderbarPrecedingNumeric42Bar(true)
+          .setHasUnderbarPrecedingNumeric123Foo42BarBaz(true)
+          .addExtension("foo")
+          .addClass_(1)
+          .setInt(1.0)
+          .setLong(true)
+          .setBoolean(1L)
+          .setSealed("foo")
+          .setInterface(1F)
+          .setIn(1)
+          .setObject("foo")
+          .setCachedSize_("foo")
+          .setSerializedSize_(true)
+          .setBy("foo")
+          .build()
+      )
 
     assertThat(interface_ {}).isEqualTo(Interface.newBuilder().build())
   }
diff --git a/java/lite.md b/java/lite.md
index f248ff6..755a1a6 100644
--- a/java/lite.md
+++ b/java/lite.md
@@ -30,7 +30,7 @@
 <dependency>
   <groupId>com.google.protobuf</groupId>
   <artifactId>protobuf-javalite</artifactId>
-  <version>3.9.1</version>
+  <version>3.19.4</version>
 </dependency>
 ```
 
diff --git a/java/lite/BUILD b/java/lite/BUILD
index 7089f95..17e9667 100644
--- a/java/lite/BUILD
+++ b/java/lite/BUILD
@@ -3,8 +3,15 @@
 load("//:internal.bzl", "conformance_test")
 load("//java/internal:testing.bzl", "junit_tests")
 
-exports_files(["lite.awk"], visibility = ["//java/core:__pkg__"])
-exports_files(["pom_template.xml"], visibility = ["//java/core:__pkg__"])
+exports_files(
+    ["lite.awk"],
+    visibility = ["//java/core:__pkg__"],
+)
+
+exports_files(
+    ["pom_template.xml"],
+    visibility = ["//java/core:__pkg__"],
+)
 
 alias(
     name = "lite",
@@ -22,8 +29,8 @@
 test_suite(
     name = "tests",
     tests = [
-        "lite_build_test",
         "conformance_test",
+        "lite_build_test",
         "lite_tests",
         "//java/core:lite_tests",
     ],
@@ -38,21 +45,21 @@
 
 conformance_test(
     name = "conformance_test",
-    testee = "//:conformance_java_lite",
     failure_list = "//:conformance/failure_list_java_lite.txt",
+    testee = "//:conformance_java_lite",
     text_format_failure_list = "//:conformance/text_format_failure_list_java_lite.txt",
 )
 
 junit_tests(
     name = "lite_tests",
-    srcs = glob(["src/test/**/*.java"]),
     size = "small",
+    srcs = glob(["src/test/**/*.java"]),
     deps = [
         ":lite",
-        "//external:junit",
-        "//external:truth",
         "//java/core:generic_test_protos_java_proto_lite",
         "//java/core:java_test_protos_java_proto_lite",
         "//java/core:test_util_lite",
+        "@maven//:com_google_truth_truth",
+        "@maven//:junit_junit",
     ],
 )
diff --git a/java/lite/pom.xml b/java/lite/pom.xml
index 0990fcf..901ae67 100644
--- a/java/lite/pom.xml
+++ b/java/lite/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.protobuf</groupId>
     <artifactId>protobuf-parent</artifactId>
-    <version>3.18.1</version>
+    <version>3.19.4</version>
   </parent>
 
   <artifactId>protobuf-javalite</artifactId>
@@ -28,11 +28,6 @@
       <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.easymock</groupId>
-      <artifactId>easymockclassextension</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava</artifactId>
       <scope>test</scope>
@@ -104,6 +99,8 @@
                     <include>ByteBufferWriter.java</include>
                     <include>ByteOutput.java</include>
                     <include>ByteString.java</include>
+                    <include>CanIgnoreReturnValue.java</include>
+                    <include>CheckReturnValue.java</include>
                     <include>CodedInputStream.java</include>
                     <include>CodedInputStreamReader.java</include>
                     <include>CodedOutputStream.java</include>
@@ -235,6 +232,7 @@
                     <exclude>TypeRegistryTest.java</exclude>
                     <exclude>UnknownEnumValueTest.java</exclude>
                     <exclude>UnknownFieldSetLiteTest.java</exclude>
+                    <exclude>UnknownFieldSetPerformanceTest.java</exclude>
                     <exclude>UnknownFieldSetTest.java</exclude>
                     <exclude>WellKnownTypesTest.java</exclude>
                     <exclude>WireFormatTest.java</exclude>
diff --git a/java/lite/src/test/java/com/google/protobuf/LiteTest.java b/java/lite/src/test/java/com/google/protobuf/LiteTest.java
index 7cbc764..b097211 100644
--- a/java/lite/src/test/java/com/google/protobuf/LiteTest.java
+++ b/java/lite/src/test/java/com/google/protobuf/LiteTest.java
@@ -55,6 +55,7 @@
 import map_lite_test.MapTestProto.TestMap.MessageValue;
 import protobuf_unittest.NestedExtensionLite;
 import protobuf_unittest.NonNestedExtensionLite;
+import protobuf_unittest.UnittestProto.TestOneof2;
 import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Bar;
 import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.BarPrime;
 import protobuf_unittest.lite_equals_and_hash.LiteEqualsAndHash.Foo;
@@ -1430,6 +1431,41 @@
   }
 
   @Test
+  public void testMergeFrom_failureWhenReadingValue_propagatesOriginalException() {
+    final byte[] bytes = TestOneof2.newBuilder().setFooInt(123).build().toByteArray();
+    final IOException injectedException = new IOException("oh no");
+    CodedInputStream failingInputStream =
+        CodedInputStream.newInstance(
+            new InputStream() {
+              boolean first = true;
+
+              @Override
+              public int read(byte[] b, int off, int len) throws IOException {
+                if (!first) {
+                  throw injectedException;
+                }
+                first = false;
+                System.arraycopy(bytes, 0, b, off, len);
+                return len;
+              }
+
+              @Override
+              public int read() {
+                throw new UnsupportedOperationException();
+              }
+            },
+            bytes.length - 1);
+    TestOneof2.Builder builder = TestOneof2.newBuilder();
+
+    try {
+      builder.mergeFrom(failingInputStream, ExtensionRegistryLite.getEmptyRegistry());
+      assertWithMessage("Expected mergeFrom to fail").fail();
+    } catch (IOException e) {
+      assertThat(e).isSameInstanceAs(injectedException);
+    }
+  }
+
+  @Test
   public void testToStringDefaultInstance() throws Exception {
     assertToStringEquals("", TestAllTypesLite.getDefaultInstance());
   }
@@ -2716,6 +2752,36 @@
         .isTrue();
   }
 
+  @Test
+  public void testPreservesFloatingPointNegative0() throws Exception {
+    proto3_unittest.UnittestProto3.TestAllTypes message =
+        proto3_unittest.UnittestProto3.TestAllTypes.newBuilder()
+            .setOptionalFloat(-0.0f)
+            .setOptionalDouble(-0.0)
+            .build();
+    assertThat(
+            proto3_unittest.UnittestProto3.TestAllTypes.parseFrom(
+                message.toByteString(), ExtensionRegistryLite.getEmptyRegistry()))
+        .isEqualTo(message);
+  }
+
+  @Test
+  public void testNegative0FloatingPointEquality() throws Exception {
+    // Like Double#equals and Float#equals, we treat -0.0 as not being equal to +0.0 even though
+    // IEEE 754 mandates that they are equivalent. This test asserts that behavior.
+    proto3_unittest.UnittestProto3.TestAllTypes message1 =
+        proto3_unittest.UnittestProto3.TestAllTypes.newBuilder()
+            .setOptionalFloat(-0.0f)
+            .setOptionalDouble(-0.0)
+            .build();
+    proto3_unittest.UnittestProto3.TestAllTypes message2 =
+        proto3_unittest.UnittestProto3.TestAllTypes.newBuilder()
+            .setOptionalFloat(0.0f)
+            .setOptionalDouble(0.0)
+            .build();
+    assertThat(message1).isNotEqualTo(message2);
+  }
+
   private String encodeHex(ByteString bytes) {
     String hexDigits = "0123456789abcdef";
     StringBuilder stringBuilder = new StringBuilder(bytes.size() * 2);
diff --git a/java/pom.xml b/java/pom.xml
index d1464dd..a616121 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -4,7 +4,7 @@
 
   <groupId>com.google.protobuf</groupId>
   <artifactId>protobuf-parent</artifactId>
-  <version>3.18.1</version>
+  <version>3.19.4</version>
   <packaging>pom</packaging>
 
   <name>Protocol Buffers [Parent]</name>
@@ -81,13 +81,7 @@
       <dependency>
         <groupId>org.easymock</groupId>
         <artifactId>easymock</artifactId>
-        <version>2.2</version>
-        <scope>test</scope>
-      </dependency>
-      <dependency>
-        <groupId>org.easymock</groupId>
-        <artifactId>easymockclassextension</artifactId>
-        <version>2.2.1</version>
+        <version>3.2</version>
         <scope>test</scope>
       </dependency>
       <dependency>
@@ -164,7 +158,28 @@
         </plugin>
         <plugin>
           <artifactId>maven-antrun-plugin</artifactId>
-          <version>1.8</version>
+          <version>3.0.0</version>
+        </plugin>
+        <plugin>
+          <groupId>org.codehaus.mojo</groupId>
+          <artifactId>animal-sniffer-maven-plugin</artifactId>
+          <version>1.20</version>
+          <configuration>
+            <signature>
+              <groupId>net.sf.androidscents.signature</groupId>
+              <artifactId>android-api-level-14</artifactId>
+              <version>4.0_r4</version>
+            </signature>
+          </configuration>
+          <executions>
+            <execution>
+              <id>android</id>
+              <phase>test</phase>
+              <goals>
+                <goal>check</goal>
+              </goals>
+            </execution>
+          </executions>
         </plugin>
       </plugins>
     </pluginManagement>
diff --git a/java/util/BUILD b/java/util/BUILD
index bd773ee..ee6ddea 100644
--- a/java/util/BUILD
+++ b/java/util/BUILD
@@ -11,31 +11,34 @@
     ]),
     visibility = ["//visibility:public"],
     deps = [
-        "//external:error_prone_annotations",
-        "//external:gson",
-        "//external:guava",
         "//java/core",
         "//java/lite",
+        "@maven//:com_google_code_findbugs_jsr305",
+        "@maven//:com_google_code_gson_gson",
+        "@maven//:com_google_errorprone_error_prone_annotations",
+        "@maven//:com_google_guava_guava",
+        "@maven//:com_google_j2objc_j2objc_annotations",
     ],
 )
+
 # Bazel users, don't depend on this target, use :util.
 java_export(
     name = "util_mvn",
     maven_coordinates = "com.google.protobuf:protobuf-java-util:%s" % PROTOBUF_VERSION,
     pom_template = "pom_template.xml",
-    runtime_deps = [":util"],
     visibility = ["//java:__pkg__"],
+    runtime_deps = [":util"],
 )
 
 filegroup(
     name = "release",
-    visibility = ["//java:__pkg__"],
     srcs = [
-        ":util_mvn-pom",
-        ":util_mvn-maven-source",
         ":util_mvn-docs",
+        ":util_mvn-maven-source",
+        ":util_mvn-pom",
         ":util_mvn-project",
-    ]
+    ],
+    visibility = ["//java:__pkg__"],
 )
 
 proto_library(
@@ -58,15 +61,15 @@
 
 junit_tests(
     name = "tests",
-    srcs = glob(["src/test/java/**/*.java"]),
     package_name = "com.google.protobuf.util",
+    srcs = glob(["src/test/java/**/*.java"]),
     deps = [
         ":test_protos_java_proto",
         ":util",
-        "//external:guava",
-        "//external:junit",
-        "//external:truth",
         "//java/core",
         "//java/core:generic_test_protos_java_proto",
+        "@maven//:com_google_guava_guava",
+        "@maven//:com_google_truth_truth",
+        "@maven//:junit_junit",
     ],
 )
diff --git a/java/util/pom.xml b/java/util/pom.xml
index 83d8d7b..2c5e292 100644
--- a/java/util/pom.xml
+++ b/java/util/pom.xml
@@ -4,7 +4,7 @@
   <parent>
     <groupId>com.google.protobuf</groupId>
     <artifactId>protobuf-parent</artifactId>
-    <version>3.18.1</version>
+    <version>3.19.4</version>
   </parent>
 
   <artifactId>protobuf-java-util</artifactId>
@@ -28,6 +28,16 @@
       <version>2.5.1</version>
     </dependency>
     <dependency>
+      <groupId>com.google.j2objc</groupId>
+      <artifactId>j2objc-annotations</artifactId>
+      <version>1.3</version>
+    </dependency>
+    <dependency>
+      <groupId>com.google.code.findbugs</groupId>
+      <artifactId>jsr305</artifactId>
+      <version>3.0.2</version>
+    </dependency>
+    <dependency>
       <groupId>com.google.guava</groupId>
       <artifactId>guava-testlib</artifactId>
       <scope>test</scope>
@@ -44,10 +54,7 @@
     <dependency>
       <groupId>org.easymock</groupId>
       <artifactId>easymock</artifactId>
-    </dependency>
-    <dependency>
-      <groupId>org.easymock</groupId>
-      <artifactId>easymockclassextension</artifactId>
+      <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>com.google.truth</groupId>
diff --git a/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java b/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java
index 2de2bd1..9f36494 100644
--- a/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java
+++ b/java/util/src/main/java/com/google/protobuf/util/FieldMaskUtil.java
@@ -46,6 +46,7 @@
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
+import javax.annotation.Nullable;
 
 /**
  * Utility helper functions to work with {@link com.google.protobuf.FieldMask}.
@@ -230,10 +231,8 @@
     return isValid(descriptor, path);
   }
 
-  /**
-   * Checks whether paths in a given fields mask are valid.
-   */
-  public static boolean isValid(Descriptor descriptor, String path) {
+  /** Checks whether paths in a given fields mask are valid. */
+  public static boolean isValid(@Nullable Descriptor descriptor, String path) {
     String[] parts = path.split(FIELD_SEPARATOR_REGEX);
     if (parts.length == 0) {
       return false;
@@ -400,19 +399,12 @@
   }
 
   /**
-   * Returns the result of merging the given proto with the given mask and a default instance.
-   */
-  public static <P extends Message> P trim(FieldMask mask, P source) {
-   return trim(mask, source, new MergeOptions());
-  }
-
-   /**
-   * Returns the result of merging the given proto with the given mask and a default instance.
+   * Returns the result of keeping only the masked fields of the given proto.
    */
   @SuppressWarnings("unchecked")
-  public static <P extends Message> P trim(FieldMask mask, P source, MergeOptions options) {
-    Message.Builder destination = source.newBuilderForType();
-    merge(mask, source, destination, options);
+  public static <P extends Message> P trim(FieldMask mask, P source) {
+   Message.Builder destination = source.newBuilderForType();
+    merge(mask, source, destination);
     return (P) destination.build();
   }
 }
diff --git a/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java b/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
index 2383da6..ddfbc9e 100644
--- a/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
+++ b/java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
@@ -88,6 +88,7 @@
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.logging.Logger;
+import javax.annotation.Nullable;
 
 /**
  * Utility classes to convert protobuf messages to/from JSON format. The JSON
@@ -521,10 +522,12 @@
      * Find a type by its full name. Returns null if it cannot be found in this {@link
      * TypeRegistry}.
      */
+    @Nullable
     public Descriptor find(String name) {
       return types.get(name);
     }
 
+    @Nullable
     Descriptor getDescriptorForTypeUrl(String typeUrl) throws InvalidProtocolBufferException {
       return find(getTypeName(typeUrl));
     }
@@ -546,7 +549,7 @@
        */
       @CanIgnoreReturnValue
       public Builder add(Descriptor messageType) {
-        if (types == null) {
+        if (built) {
           throw new IllegalStateException("A TypeRegistry.Builder can only be used once.");
         }
         addFile(messageType.getFile());
@@ -559,7 +562,7 @@
        */
       @CanIgnoreReturnValue
       public Builder add(Iterable<Descriptor> messageTypes) {
-        if (types == null) {
+        if (built) {
           throw new IllegalStateException("A TypeRegistry.Builder can only be used once.");
         }
         for (Descriptor type : messageTypes) {
@@ -573,10 +576,8 @@
        * one Builder.
        */
       public TypeRegistry build() {
-        TypeRegistry result = new TypeRegistry(types);
-        // Make sure the built {@link TypeRegistry} is immutable.
-        types = null;
-        return result;
+        built = true;
+        return new TypeRegistry(types);
       }
 
       private void addFile(FileDescriptor file) {
@@ -607,6 +608,7 @@
 
       private final Set<String> files = new HashSet<String>();
       private Map<String, Descriptor> types = new HashMap<String, Descriptor>();
+      private boolean built = false;
     }
   }
 
@@ -984,7 +986,7 @@
     }
 
     /** Prints a regular message with an optional type URL. */
-    private void print(MessageOrBuilder message, String typeUrl) throws IOException {
+    private void print(MessageOrBuilder message, @Nullable String typeUrl) throws IOException {
       generator.print("{" + blankOrNewLine);
       generator.indent();
 
@@ -1340,7 +1342,9 @@
         throw e;
       } catch (Exception e) {
         // We convert all exceptions from JSON parsing to our own exceptions.
-        throw new InvalidProtocolBufferException(e.getMessage());
+        InvalidProtocolBufferException toThrow = new InvalidProtocolBufferException(e.getMessage());
+        toThrow.initCause(e);
+        throw toThrow;
       }
     }
 
@@ -1558,7 +1562,7 @@
       try {
         Timestamp value = Timestamps.parse(json.getAsString());
         builder.mergeFrom(value.toByteString());
-      } catch (ParseException e) {
+      } catch (ParseException | UnsupportedOperationException e) {
         throw new InvalidProtocolBufferException("Failed to parse timestamp: " + json);
       }
     }
@@ -1568,7 +1572,7 @@
       try {
         Duration value = Durations.parse(json.getAsString());
         builder.mergeFrom(value.toByteString());
-      } catch (ParseException e) {
+      } catch (ParseException | UnsupportedOperationException e) {
         throw new InvalidProtocolBufferException("Failed to parse duration: " + json);
       }
     }
@@ -1899,6 +1903,7 @@
       }
     }
 
+    @Nullable
     private EnumValueDescriptor parseEnum(EnumDescriptor enumDescriptor, JsonElement json)
         throws InvalidProtocolBufferException {
       String value = json.getAsString();
@@ -1926,6 +1931,7 @@
       return result;
     }
 
+    @Nullable
     private Object parseFieldValue(FieldDescriptor field, JsonElement json, Message.Builder builder)
         throws InvalidProtocolBufferException {
       if (json instanceof JsonNull) {
diff --git a/java/util/src/main/java/com/google/protobuf/util/Timestamps.java b/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
index 8461f67..c9276a0 100644
--- a/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
+++ b/java/util/src/main/java/com/google/protobuf/util/Timestamps.java
@@ -38,6 +38,7 @@
 
 import com.google.errorprone.annotations.CanIgnoreReturnValue;
 import com.google.errorprone.annotations.CompileTimeConstant;
+import com.google.j2objc.annotations.J2ObjCIncompatible;
 import com.google.protobuf.Duration;
 import com.google.protobuf.Timestamp;
 import java.io.Serializable;
@@ -329,6 +330,27 @@
   }
 
   /**
+   * Create a Timestamp from a java.util.Date. If the java.util.Date is a java.sql.Timestamp,
+   * full nanonsecond precision is retained.
+   *
+   * @throws IllegalArgumentException if the year is before 1 CE or after 9999 CE
+   */
+  @SuppressWarnings("GoodTime") // this is a legacy conversion API
+  @J2ObjCIncompatible
+  public static Timestamp fromDate(Date date) {
+    if (date instanceof java.sql.Timestamp) {
+      java.sql.Timestamp sqlTimestamp = (java.sql.Timestamp) date;
+      long integralSeconds = sqlTimestamp.getTime() / 1000L; // truncate the fractional seconds
+      return Timestamp.newBuilder()
+          .setSeconds(integralSeconds)
+          .setNanos(sqlTimestamp.getNanos())
+          .build();
+    } else {
+      return fromMillis(date.getTime());
+    }
+  }
+
+  /**
    * Convert a Timestamp to the number of milliseconds elapsed from the epoch.
    *
    * <p>The result will be rounded down to the nearest millisecond. E.g., if the timestamp
diff --git a/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java b/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java
index 367fe52..79fa376 100644
--- a/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java
+++ b/java/util/src/test/java/com/google/protobuf/util/FieldMaskUtilTest.java
@@ -288,4 +288,28 @@
     FieldMaskUtil.merge(FieldMaskUtil.fromString("payload"), source, builder);
     assertThat(builder.getPayload().getOptionalInt32()).isEqualTo(1234);
   }
+
+  @Test
+  public void testTrim() throws Exception {
+    NestedTestAllTypes source =
+        NestedTestAllTypes.newBuilder()
+            .setPayload(
+                TestAllTypes.newBuilder()
+                    .setOptionalInt32(1234)
+                    .setOptionalString("1234")
+                    .setOptionalBool(true))
+            .build();
+    FieldMask mask =
+        FieldMaskUtil.fromStringList(
+            ImmutableList.of("payload.optional_int32", "payload.optional_string"));
+
+    NestedTestAllTypes actual = FieldMaskUtil.trim(mask, source);
+
+    assertThat(actual)
+        .isEqualTo(
+            NestedTestAllTypes.newBuilder()
+                .setPayload(
+                    TestAllTypes.newBuilder().setOptionalInt32(1234).setOptionalString("1234"))
+                .build());
+  }
 }
diff --git a/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java b/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
index fc61a28..f00bbb1 100644
--- a/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
+++ b/java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
@@ -822,6 +822,21 @@
   }
 
   @Test
+  public void testTimestampMergeError() throws Exception {
+    final String incorrectTimestampString = "{\"seconds\":1800,\"nanos\":0}";
+    try {
+      TestTimestamp.Builder builder = TestTimestamp.newBuilder();
+      mergeFromJson(String.format("{\"timestamp_value\": %s}", incorrectTimestampString), builder);
+      assertWithMessage("expected exception").fail();
+    } catch (InvalidProtocolBufferException e) {
+      // Exception expected.
+      assertThat(e)
+          .hasMessageThat()
+          .isEqualTo("Failed to parse timestamp: " + incorrectTimestampString);
+    }
+  }
+
+  @Test
   public void testDuration() throws Exception {
     TestDuration message =
         TestDuration.newBuilder().setDurationValue(Durations.parse("12345s")).build();
@@ -831,6 +846,21 @@
   }
 
   @Test
+  public void testDurationMergeError() throws Exception {
+    final String incorrectDurationString = "{\"seconds\":10,\"nanos\":500}";
+    try {
+      TestDuration.Builder builder = TestDuration.newBuilder();
+      mergeFromJson(String.format("{\"duration_value\": %s}", incorrectDurationString), builder);
+      assertWithMessage("expected exception").fail();
+    } catch (InvalidProtocolBufferException e) {
+      // Exception expected.
+      assertThat(e)
+          .hasMessageThat()
+          .isEqualTo("Failed to parse duration: " + incorrectDurationString);
+    }
+  }
+
+  @Test
   public void testFieldMask() throws Exception {
     TestFieldMask message =
         TestFieldMask.newBuilder()
@@ -1857,4 +1887,12 @@
                 .print(message))
         .isEqualTo("{\n" + "  \"optionalBool\": false\n" + "}");
   }
+
+  @Test
+  public void testPreservesFloatingPointNegative0() throws Exception {
+    TestAllTypes message =
+        TestAllTypes.newBuilder().setOptionalFloat(-0.0f).setOptionalDouble(-0.0).build();
+    assertThat(JsonFormat.printer().print(message))
+        .isEqualTo("{\n  \"optionalFloat\": -0.0,\n  \"optionalDouble\": -0.0\n}");
+  }
 }
diff --git a/js/binary/utils.js b/js/binary/utils.js
index 4d74331..d281027 100644
--- a/js/binary/utils.js
+++ b/js/binary/utils.js
@@ -202,7 +202,11 @@
 
   exp = Math.floor(Math.log(value) / Math.LN2);
   mant = value * Math.pow(2, -exp);
-  mant = Math.round(mant * jspb.BinaryConstants.TWO_TO_23) & 0x7FFFFF;
+  mant = Math.round(mant * jspb.BinaryConstants.TWO_TO_23);
+  if (mant >= 0x1000000) {
+    ++exp;
+  }
+  mant = mant & 0x7FFFFF;
 
   jspb.utils.split64High = 0;
   jspb.utils.split64Low = ((sign << 31) | ((exp + 127) << 23) | mant) >>> 0;
diff --git a/js/binary/utils_test.js b/js/binary/utils_test.js
index 9f735d3..70585db 100644
--- a/js/binary/utils_test.js
+++ b/js/binary/utils_test.js
@@ -391,6 +391,11 @@
     // Pi.
     test(f32_pi, 0x40490fdb);
 
+    // corner cases
+    test(0.9999999762949594, 0x3f800000);
+    test(7.99999999999999, 0x41000000);
+    test(Math.sin(30 * Math.PI / 180), 0x3f000000);  // sin(30 degrees)
+
     // Various positive values.
     var cursor = f32_eps * 10;
     while (cursor != Infinity) {
diff --git a/js/commonjs/export.js b/js/commonjs/export.js
index a9932e9..2025d9a 100644
--- a/js/commonjs/export.js
+++ b/js/commonjs/export.js
@@ -15,15 +15,17 @@
 goog.require('jspb.Message');
 goog.require('jspb.Map');
 
-exports.Map = jspb.Map;
-exports.Message = jspb.Message;
-exports.BinaryReader = jspb.BinaryReader;
-exports.BinaryWriter = jspb.BinaryWriter;
-exports.ExtensionFieldInfo = jspb.ExtensionFieldInfo;
-exports.ExtensionFieldBinaryInfo = jspb.ExtensionFieldBinaryInfo;
+if ( typeof exports === 'object' ) {
+  exports.Map = jspb.Map;
+  exports.Message = jspb.Message;
+  exports.BinaryReader = jspb.BinaryReader;
+  exports.BinaryWriter = jspb.BinaryWriter;
+  exports.ExtensionFieldInfo = jspb.ExtensionFieldInfo;
+  exports.ExtensionFieldBinaryInfo = jspb.ExtensionFieldBinaryInfo;
 
-// These are used by generated code but should not be used directly by clients.
-exports.exportSymbol = goog.exportSymbol;
-exports.inherits = goog.inherits;
-exports.object = {extend: goog.object.extend};
-exports.typeOf = goog.typeOf;
+  // These are used by generated code but should not be used directly by clients.
+  exports.exportSymbol = goog.exportSymbol;
+  exports.inherits = goog.inherits;
+  exports.object = {extend: goog.object.extend};
+  exports.typeOf = goog.typeOf;
+}
\ No newline at end of file
diff --git a/js/gulpfile.js b/js/gulpfile.js
index dea5f41..00a6d64 100644
--- a/js/gulpfile.js
+++ b/js/gulpfile.js
@@ -145,55 +145,50 @@
   return [
     'node_modules/.bin/google-closure-compiler',
     `--js=${closureLib}/closure/goog/**.js`,
-    `--js=${closureLib}/third_party/closure/goog/**.js`,
-    '--js=map.js',
-    '--js=message.js',
-    '--js=binary/arith.js',
-    '--js=binary/constants.js',
-    '--js=binary/decoder.js',
-    '--js=binary/encoder.js',
-    '--js=binary/reader.js',
-    '--js=binary/utils.js',
-    '--js=binary/writer.js',
-    `--js=${exportsFile}`,
-    `--entry_point=${exportsFile}`,
-    `> ${outputFile}`
+    `--js=${closureLib}/third_party/closure/goog/**.js`, '--js=map.js',
+    '--js=message.js', '--js=binary/arith.js', '--js=binary/constants.js',
+    '--js=binary/decoder.js', '--js=binary/encoder.js', '--js=binary/reader.js',
+    '--js=binary/utils.js', '--js=binary/writer.js', `--js=${exportsFile}`,
+    `--entry_point=${exportsFile}`, `> ${outputFile}`
   ].join(' ');
 }
 
 gulp.task('dist', gulp.series(['genproto_wellknowntypes'], function(cb) {
   // TODO(haberman): minify this more aggressively.
   // Will require proper externs/exports.
-  exec(getClosureCompilerCommand('commonjs/export.js', 'google-protobuf.js'),
-       function (err, stdout, stderr) {
-    console.log(stdout);
-    console.log(stderr);
-    cb(err);
-  });
+  exec(
+      getClosureCompilerCommand('commonjs/export.js', 'google-protobuf.js'),
+      function(err, stdout, stderr) {
+        console.log(stdout);
+        console.log(stderr);
+        cb(err);
+      });
 }));
 
-gulp.task('commonjs_asserts', function (cb) {
-  exec('mkdir -p commonjs_out/test_node_modules && ' +
-       getClosureCompilerCommand(
-           'commonjs/export_asserts.js',
-           'commonjs_out/test_node_modules/closure_asserts_commonjs.js'),
-       function (err, stdout, stderr) {
-    console.log(stdout);
-    console.log(stderr);
-    cb(err);
-  });
+gulp.task('commonjs_asserts', function(cb) {
+  exec(
+      'mkdir -p commonjs_out/test_node_modules && ' +
+          getClosureCompilerCommand(
+              'commonjs/export_asserts.js',
+              'commonjs_out/test_node_modules/closure_asserts_commonjs.js'),
+      function(err, stdout, stderr) {
+        console.log(stdout);
+        console.log(stderr);
+        cb(err);
+      });
 });
 
-gulp.task('commonjs_testdeps', function (cb) {
-  exec('mkdir -p commonjs_out/test_node_modules && ' +
-       getClosureCompilerCommand(
-           'commonjs/export_testdeps.js',
-           'commonjs_out/test_node_modules/testdeps_commonjs.js'),
-       function (err, stdout, stderr) {
-    console.log(stdout);
-    console.log(stderr);
-    cb(err);
-  });
+gulp.task('commonjs_testdeps', function(cb) {
+  exec(
+      'mkdir -p commonjs_out/test_node_modules && ' +
+          getClosureCompilerCommand(
+              'commonjs/export_testdeps.js',
+              'commonjs_out/test_node_modules/testdeps_commonjs.js'),
+      function(err, stdout, stderr) {
+        console.log(stdout);
+        console.log(stderr);
+        cb(err);
+      });
 });
 
 gulp.task(
diff --git a/js/package.json b/js/package.json
index 33f3009..f7e8a3f 100644
--- a/js/package.json
+++ b/js/package.json
@@ -1,6 +1,6 @@
 {
   "name": "google-protobuf",
-  "version": "3.18.1",
+  "version": "3.19.4",
   "description": "Protocol Buffers for JavaScript",
   "main": "google-protobuf.js",
   "files": [
diff --git a/kokoro/linux/64-bit/Dockerfile b/kokoro/linux/64-bit/Dockerfile
index 3a279e6..189d0cf 100644
--- a/kokoro/linux/64-bit/Dockerfile
+++ b/kokoro/linux/64-bit/Dockerfile
@@ -60,8 +60,6 @@
   nunit \
   # -- For all Java builds -- \
   maven \
-  # -- For java_jdk6 -- \
-  #   oops! not in jessie. too old? openjdk-6-jdk \
   # -- For java_jdk7 -- \
   openjdk-7-jdk \
   # -- For java_oracle7 -- \
diff --git a/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh b/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh
index 70a0d7c..aca08bd 100755
--- a/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh
+++ b/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_linux_aarch64.sh
@@ -12,11 +12,14 @@
   DOCKER_TTY_ARGS=
 fi
 
+# Pin the dockcross image since newer versions of the image break the build
+PINNED_DOCKCROSS_IMAGE_VERSION=dockcross/linux-arm64:20210625-795dd4d
+
 # running dockcross image without any arguments generates a wrapper
 # scripts that can be used to run commands under the dockcross image
 # easily.
 # See https://github.com/dockcross/dockcross#usage for details
-docker run $DOCKER_TTY_ARGS --rm dockcross/linux-arm64 >dockcross-linux-arm64.sh
+docker run $DOCKER_TTY_ARGS --rm $PINNED_DOCKCROSS_IMAGE_VERSION >dockcross-linux-arm64.sh
 chmod +x dockcross-linux-arm64.sh
 
 # the wrapper script has CRLF line endings and bash doesn't like that
@@ -30,4 +33,4 @@
 # * the processes in the container run under the same UID and GID as the host process so unlike
 #   vanilla "docker run" invocations, the workspace doesn't get polluted with files
 #   owned by root.
-./dockcross-linux-arm64.sh "$@"
+./dockcross-linux-arm64.sh --image $PINNED_DOCKCROSS_IMAGE_VERSION -- "$@"
diff --git a/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh b/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh
index 115478b..ba34fa7 100755
--- a/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh
+++ b/kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh
@@ -12,11 +12,14 @@
   DOCKER_TTY_ARGS=
 fi
 
+# Pin the dockcross image since newer versions of the image break the build
+PINNED_DOCKCROSS_IMAGE_VERSION=dockcross/manylinux2014-aarch64:20210803-41e5c69
+
 # running dockcross image without any arguments generates a wrapper
 # scripts that can be used to run commands under the dockcross image
 # easily.
 # See https://github.com/dockcross/dockcross#usage for details
-docker run $DOCKER_TTY_ARGS --rm dockcross/manylinux2014-aarch64 >dockcross-manylinux2014-aarch64.sh
+docker run $DOCKER_TTY_ARGS --rm $PINNED_DOCKCROSS_IMAGE_VERSION >dockcross-manylinux2014-aarch64.sh
 chmod +x dockcross-manylinux2014-aarch64.sh
 
 # the wrapper script has CRLF line endings and bash doesn't like that
@@ -30,4 +33,4 @@
 # * the processes in the container run under the same UID and GID as the host process so unlike
 #   vanilla "docker run" invocations, the workspace doesn't get polluted with files
 #   owned by root.
-./dockcross-manylinux2014-aarch64.sh "$@"
+./dockcross-manylinux2014-aarch64.sh --image $PINNED_DOCKCROSS_IMAGE_VERSION -- "$@"
diff --git a/kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh b/kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh
index 527fc48..5026d04 100755
--- a/kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh
+++ b/kokoro/linux/aarch64/python_run_tests_with_qemu_aarch64.sh
@@ -7,7 +7,7 @@
 cd python
 
 PYTHON="/opt/python/cp38-cp38/bin/python"
-${PYTHON} -m pip install --user six pytest auditwheel
+${PYTHON} -m pip install --user pytest auditwheel
 
 # check that we are really using aarch64 python
 (${PYTHON} -c 'import sysconfig; print(sysconfig.get_platform())' | grep -q "linux-aarch64") || (echo "Wrong python platform, needs to be aarch64 python."; exit 1)
diff --git a/kokoro/linux/bazel/build.sh b/kokoro/linux/bazel/build.sh
index 1b4fb8d..d0d4b3e 100755
--- a/kokoro/linux/bazel/build.sh
+++ b/kokoro/linux/bazel/build.sh
@@ -22,9 +22,11 @@
 
 git submodule update --init --recursive
 
+#  Disabled for now, re-enable if appropriate.
+#  //:build_files_updated_unittest \
+
 trap print_test_logs EXIT
 bazel test -k --copt=-Werror --host_copt=-Werror \
-  //:build_files_updated_unittest \
   //java:tests \
   //:protoc \
   //:protobuf \
@@ -33,5 +35,13 @@
   @com_google_protobuf//:cc_proto_blacklist_test
 trap - EXIT
 
-cd examples
+pushd examples
 bazel build //...
+popd
+
+# Verify that we can build successfully from generated tar files.
+./autogen.sh && ./configure && make -j$(nproc) dist
+DIST=`ls *.tar.gz`
+tar -xf $DIST
+cd ${DIST//.tar.gz}
+bazel build //:protobuf //:protobuf_java
diff --git a/kokoro/linux/benchmark/build.sh b/kokoro/linux/benchmark/build.sh
index f078280..dee7c47 100755
--- a/kokoro/linux/benchmark/build.sh
+++ b/kokoro/linux/benchmark/build.sh
@@ -1,5 +1,18 @@
 #!/bin/bash
-
+#
+# Change to repo root
 cd $(dirname $0)/../../..
 
+set -ex
+
+# Install openJDK 11 (required by the java benchmarks)
+sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 78BD65473CB3BD13
+sudo add-apt-repository ppa:openjdk-r/ppa
+sudo apt-get update
+sudo apt-get install -y openjdk-11-jdk-headless
+
+# use java 11
+sudo update-java-alternatives --set /usr/lib/jvm/java-1.11.0-openjdk-amd64
+java -version
+
 ./tests.sh benchmark
diff --git a/kokoro/linux/benchmark/run.sh b/kokoro/linux/benchmark/run.sh
index 4276d62..acd8737 100755
--- a/kokoro/linux/benchmark/run.sh
+++ b/kokoro/linux/benchmark/run.sh
@@ -8,15 +8,9 @@
 export OUTPUT_DIR=testoutput
 repo_root="$(pwd)"
 
-# tcmalloc
-if [ ! -f gperftools/.libs/libtcmalloc.so ]; then
-  git clone https://github.com/gperftools/gperftools.git
-  pushd gperftools
-  ./autogen.sh
-  ./configure
-  make -j8
-  popd
-fi
+# TODO(jtattermusch): Add back support for benchmarking with tcmalloc for C++ and python.
+# This feature was removed since it used to use tcmalloc from https://github.com/gperftools/gperftools.git
+# which is very outdated. See https://github.com/protocolbuffers/protobuf/issues/8725.
 
 # download datasets for benchmark
 pushd benchmarks
@@ -29,8 +23,10 @@
 ./configure CXXFLAGS="-fPIC -O2"
 make -j8
 pushd python
-python setup.py build --cpp_implementation
-pip install . --user
+virtualenv -p python3 env
+source env/bin/activate
+python3 setup.py build --cpp_implementation
+pip3 install --install-option="--cpp_implementation" .
 popd
 
 # build and run Python benchmark
@@ -45,10 +41,10 @@
 ./python-pure-python-benchmark --json --behavior_prefix="pure-python-benchmark" $datasets  >> tmp/python_result.json
 echo "," >> "tmp/python_result.json"
 echo "benchmarking python cpp reflection..."
-env LD_PRELOAD="${repo_root}/gperftools/.libs/libtcmalloc.so" LD_LIBRARY_PATH="${repo_root}/src/.libs" ./python-cpp-reflection-benchmark --json --behavior_prefix="cpp-reflection-benchmark" $datasets  >> tmp/python_result.json
+env LD_LIBRARY_PATH="${repo_root}/src/.libs" ./python-cpp-reflection-benchmark --json --behavior_prefix="cpp-reflection-benchmark" $datasets  >> tmp/python_result.json
 echo "," >> "tmp/python_result.json"
 echo "benchmarking python cpp generated code..."
-env LD_PRELOAD="${repo_root}/gperftools/.libs/libtcmalloc.so" LD_LIBRARY_PATH="${repo_root}/src/.libs" ./python-cpp-generated-code-benchmark --json --behavior_prefix="cpp-generated-code-benchmark" $datasets >> tmp/python_result.json
+env LD_LIBRARY_PATH="${repo_root}/src/.libs" ./python-cpp-generated-code-benchmark --json --behavior_prefix="cpp-generated-code-benchmark" $datasets >> tmp/python_result.json
 echo "]" >> "tmp/python_result.json"
 popd
 
@@ -56,7 +52,6 @@
 ./configure
 make clean && make -j8
 
-# build Java protobuf
 pushd java
 mvn package -B -Dmaven.test.skip=true
 popd
@@ -68,7 +63,7 @@
 # TODO(jtattermusch): find a less clumsy way of protecting python_result.json contents
 mv tmp/python_result.json . && make clean && make -j8 cpp-benchmark && mv python_result.json tmp
 echo "benchmarking cpp..."
-env LD_PRELOAD="${repo_root}/gperftools/.libs/libtcmalloc.so" ./cpp-benchmark --benchmark_min_time=5.0 --benchmark_out_format=json --benchmark_out="tmp/cpp_result.json" $datasets
+env ./cpp-benchmark --benchmark_min_time=5.0 --benchmark_out_format=json --benchmark_out="tmp/cpp_result.json" $datasets
 
 # TODO(jtattermusch): add benchmarks for https://github.com/protocolbuffers/protobuf-go.
 # The original benchmarks for https://github.com/golang/protobuf were removed
@@ -77,15 +72,16 @@
 # * the https://github.com/golang/protobuf implementation has been superseded by
 #   https://github.com/protocolbuffers/protobuf-go
 
-# build and run java benchmark
+# build and run java benchmark (java 11 is required)
 make java-benchmark
 echo "benchmarking java..."
 ./java-benchmark -Cresults.file.options.file="tmp/java_result.json" $datasets
 
+# TODO(jtattermusch): re-enable JS benchmarks once https://github.com/protocolbuffers/protobuf/issues/8747 is fixed.
 # build and run js benchmark
-make js-benchmark
-echo "benchmarking js..."
-./js-benchmark $datasets  --json_output=$(pwd)/tmp/node_result.json
+# make js-benchmark
+# echo "benchmarking js..."
+# ./js-benchmark $datasets  --json_output=$(pwd)/tmp/node_result.json
 
 # TODO(jtattermusch): add php-c-benchmark. Currently its build is broken.
 
@@ -93,12 +89,11 @@
 cat tmp/cpp_result.json
 cat tmp/java_result.json
 cat tmp/python_result.json
-cat tmp/node_result.json
 
 # print the postprocessed results to the build job log
 # TODO(jtattermusch): re-enable uploading results to bigquery (it is currently broken)
 make python_add_init
-env LD_LIBRARY_PATH="${repo_root}/src/.libs" python -m util.result_parser \
-	-cpp="../tmp/cpp_result.json" -java="../tmp/java_result.json" -python="../tmp/python_result.json" -node="../tmp/node_result.json"
+env LD_LIBRARY_PATH="${repo_root}/src/.libs" python3 -m util.result_parser \
+	-cpp="../tmp/cpp_result.json" -java="../tmp/java_result.json" -python="../tmp/python_result.json"
 popd
 
diff --git a/kokoro/linux/dockerfile/test/python27/Dockerfile b/kokoro/linux/dockerfile/test/python310/Dockerfile
similarity index 95%
rename from kokoro/linux/dockerfile/test/python27/Dockerfile
rename to kokoro/linux/dockerfile/test/python310/Dockerfile
index 6b0eaf7..e16e93b 100644
--- a/kokoro/linux/dockerfile/test/python27/Dockerfile
+++ b/kokoro/linux/dockerfile/test/python310/Dockerfile
@@ -1,4 +1,4 @@
-FROM python:2.7-buster
+FROM python:3.10-buster
 
 # Install dependencies.  We start with the basic ones require to build protoc
 # and the C++ build
diff --git a/kokoro/linux/dockerfile/test/ruby/Dockerfile b/kokoro/linux/dockerfile/test/ruby/Dockerfile
index b73bf84..8362870 100644
--- a/kokoro/linux/dockerfile/test/ruby/Dockerfile
+++ b/kokoro/linux/dockerfile/test/ruby/Dockerfile
@@ -1,4 +1,4 @@
-FROM debian:jessie
+FROM debian:stretch
 
 # Install dependencies.  We start with the basic ones require to build protoc
 # and the C++ build
@@ -20,20 +20,23 @@
   parallel \
   time \
   wget \
+  # Java dependencies
+  maven \
+  openjdk-8-jdk \
   && apt-get clean
 
 # Install rvm
-RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys \
+RUN gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys \
     409B6B1796C275462A1703113804BB82D39DC0E3 \
     7D2BAF1CF37B13E2069D6956105BD0E739499BDB
-RUN \curl -sSL https://get.rvm.io | bash -s master
+RUN \curl -sSL https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer | bash -s master
 
-RUN /bin/bash -l -c "rvm install 2.3.8"
-RUN /bin/bash -l -c "rvm install 2.4.5"
 RUN /bin/bash -l -c "rvm install 2.5.1"
 RUN /bin/bash -l -c "rvm install 2.6.0"
 RUN /bin/bash -l -c "rvm install 2.7.0"
 RUN /bin/bash -l -c "rvm install 3.0.0"
+RUN /bin/bash -l -c "rvm install jruby-9.2.19.0"
+RUN /bin/bash -l -c "rvm install jruby-9.3.0.0"
 
 RUN /bin/bash -l -c "echo 'gem: --no-ri --no-rdoc' > ~/.gemrc"
 RUN /bin/bash -l -c "echo 'export PATH=/usr/local/rvm/bin:$PATH' >> ~/.bashrc"
diff --git a/kokoro/linux/ruby24/build.sh b/kokoro/linux/jruby92/build.sh
similarity index 95%
copy from kokoro/linux/ruby24/build.sh
copy to kokoro/linux/jruby92/build.sh
index 68585aa..5820115 100755
--- a/kokoro/linux/ruby24/build.sh
+++ b/kokoro/linux/jruby92/build.sh
@@ -14,5 +14,5 @@
 export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/ruby
 export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
 export OUTPUT_DIR=testoutput
-export TEST_SET="ruby24"
+export TEST_SET="jruby92"
 ./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/ruby24/continuous.cfg b/kokoro/linux/jruby92/continuous.cfg
similarity index 76%
copy from kokoro/linux/ruby24/continuous.cfg
copy to kokoro/linux/jruby92/continuous.cfg
index a1ccfc0..3339584 100644
--- a/kokoro/linux/ruby24/continuous.cfg
+++ b/kokoro/linux/jruby92/continuous.cfg
@@ -1,7 +1,7 @@
 # Config file for running tests in Kokoro
 
 # Location of the build script in repository
-build_file: "protobuf/kokoro/linux/ruby24/build.sh"
+build_file: "protobuf/kokoro/linux/jruby92/build.sh"
 timeout_mins: 120
 
 action {
diff --git a/kokoro/linux/ruby24/continuous.cfg b/kokoro/linux/jruby92/presubmit.cfg
similarity index 76%
copy from kokoro/linux/ruby24/continuous.cfg
copy to kokoro/linux/jruby92/presubmit.cfg
index a1ccfc0..3339584 100644
--- a/kokoro/linux/ruby24/continuous.cfg
+++ b/kokoro/linux/jruby92/presubmit.cfg
@@ -1,7 +1,7 @@
 # Config file for running tests in Kokoro
 
 # Location of the build script in repository
-build_file: "protobuf/kokoro/linux/ruby24/build.sh"
+build_file: "protobuf/kokoro/linux/jruby92/build.sh"
 timeout_mins: 120
 
 action {
diff --git a/kokoro/linux/ruby24/build.sh b/kokoro/linux/jruby93/build.sh
similarity index 95%
rename from kokoro/linux/ruby24/build.sh
rename to kokoro/linux/jruby93/build.sh
index 68585aa..24c54d0 100755
--- a/kokoro/linux/ruby24/build.sh
+++ b/kokoro/linux/jruby93/build.sh
@@ -14,5 +14,5 @@
 export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/ruby
 export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
 export OUTPUT_DIR=testoutput
-export TEST_SET="ruby24"
+export TEST_SET="jruby93"
 ./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/ruby24/continuous.cfg b/kokoro/linux/jruby93/continuous.cfg
similarity index 76%
rename from kokoro/linux/ruby24/continuous.cfg
rename to kokoro/linux/jruby93/continuous.cfg
index a1ccfc0..706d848 100644
--- a/kokoro/linux/ruby24/continuous.cfg
+++ b/kokoro/linux/jruby93/continuous.cfg
@@ -1,7 +1,7 @@
 # Config file for running tests in Kokoro
 
 # Location of the build script in repository
-build_file: "protobuf/kokoro/linux/ruby24/build.sh"
+build_file: "protobuf/kokoro/linux/jruby93/build.sh"
 timeout_mins: 120
 
 action {
diff --git a/kokoro/linux/ruby24/continuous.cfg b/kokoro/linux/jruby93/presubmit.cfg
similarity index 76%
copy from kokoro/linux/ruby24/continuous.cfg
copy to kokoro/linux/jruby93/presubmit.cfg
index a1ccfc0..706d848 100644
--- a/kokoro/linux/ruby24/continuous.cfg
+++ b/kokoro/linux/jruby93/presubmit.cfg
@@ -1,7 +1,7 @@
 # Config file for running tests in Kokoro
 
 # Location of the build script in repository
-build_file: "protobuf/kokoro/linux/ruby24/build.sh"
+build_file: "protobuf/kokoro/linux/jruby93/build.sh"
 timeout_mins: 120
 
 action {
diff --git a/kokoro/linux/ruby24/build.sh b/kokoro/linux/python310/build.sh
similarity index 85%
copy from kokoro/linux/ruby24/build.sh
copy to kokoro/linux/python310/build.sh
index 68585aa..0d8a2c9 100755
--- a/kokoro/linux/ruby24/build.sh
+++ b/kokoro/linux/python310/build.sh
@@ -11,8 +11,8 @@
 cd $(dirname $0)/../../..
 
 export DOCKERHUB_ORGANIZATION=protobuftesting
-export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/ruby
+export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/python310
 export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
 export OUTPUT_DIR=testoutput
-export TEST_SET="ruby24"
+export TEST_SET="python310"
 ./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/ruby24/continuous.cfg b/kokoro/linux/python310/continuous.cfg
similarity index 75%
copy from kokoro/linux/ruby24/continuous.cfg
copy to kokoro/linux/python310/continuous.cfg
index a1ccfc0..6ec74d8 100644
--- a/kokoro/linux/ruby24/continuous.cfg
+++ b/kokoro/linux/python310/continuous.cfg
@@ -1,7 +1,7 @@
 # Config file for running tests in Kokoro
 
 # Location of the build script in repository
-build_file: "protobuf/kokoro/linux/ruby24/build.sh"
+build_file: "protobuf/kokoro/linux/python310/build.sh"
 timeout_mins: 120
 
 action {
diff --git a/kokoro/linux/ruby24/continuous.cfg b/kokoro/linux/python310/presubmit.cfg
similarity index 75%
copy from kokoro/linux/ruby24/continuous.cfg
copy to kokoro/linux/python310/presubmit.cfg
index a1ccfc0..6ec74d8 100644
--- a/kokoro/linux/ruby24/continuous.cfg
+++ b/kokoro/linux/python310/presubmit.cfg
@@ -1,7 +1,7 @@
 # Config file for running tests in Kokoro
 
 # Location of the build script in repository
-build_file: "protobuf/kokoro/linux/ruby24/build.sh"
+build_file: "protobuf/kokoro/linux/python310/build.sh"
 timeout_mins: 120
 
 action {
diff --git a/kokoro/linux/ruby24/build.sh b/kokoro/linux/python310_cpp/build.sh
similarity index 84%
copy from kokoro/linux/ruby24/build.sh
copy to kokoro/linux/python310_cpp/build.sh
index 68585aa..2903a2d 100755
--- a/kokoro/linux/ruby24/build.sh
+++ b/kokoro/linux/python310_cpp/build.sh
@@ -11,8 +11,8 @@
 cd $(dirname $0)/../../..
 
 export DOCKERHUB_ORGANIZATION=protobuftesting
-export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/ruby
+export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/python310
 export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
 export OUTPUT_DIR=testoutput
-export TEST_SET="ruby24"
+export TEST_SET="python310_cpp"
 ./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/ruby24/continuous.cfg b/kokoro/linux/python310_cpp/continuous.cfg
similarity index 74%
copy from kokoro/linux/ruby24/continuous.cfg
copy to kokoro/linux/python310_cpp/continuous.cfg
index a1ccfc0..7ec8441 100644
--- a/kokoro/linux/ruby24/continuous.cfg
+++ b/kokoro/linux/python310_cpp/continuous.cfg
@@ -1,7 +1,7 @@
 # Config file for running tests in Kokoro
 
 # Location of the build script in repository
-build_file: "protobuf/kokoro/linux/ruby24/build.sh"
+build_file: "protobuf/kokoro/linux/python310_cpp/build.sh"
 timeout_mins: 120
 
 action {
diff --git a/kokoro/linux/ruby24/continuous.cfg b/kokoro/linux/python310_cpp/presubmit.cfg
similarity index 74%
copy from kokoro/linux/ruby24/continuous.cfg
copy to kokoro/linux/python310_cpp/presubmit.cfg
index a1ccfc0..7ec8441 100644
--- a/kokoro/linux/ruby24/continuous.cfg
+++ b/kokoro/linux/python310_cpp/presubmit.cfg
@@ -1,7 +1,7 @@
 # Config file for running tests in Kokoro
 
 # Location of the build script in repository
-build_file: "protobuf/kokoro/linux/ruby24/build.sh"
+build_file: "protobuf/kokoro/linux/python310_cpp/build.sh"
 timeout_mins: 120
 
 action {
diff --git a/kokoro/linux/ruby23/build.sh b/kokoro/linux/ruby23/build.sh
deleted file mode 100755
index 503a320..0000000
--- a/kokoro/linux/ruby23/build.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-#
-# This is the top-level script we give to Kokoro as the entry point for
-# running the "pull request" project:
-#
-# This script selects a specific Dockerfile (for building a Docker image) and
-# a script to run inside that image.  Then we delegate to the general
-# build_and_run_docker.sh script.
-
-# Change to repo root
-cd $(dirname $0)/../../..
-
-export DOCKERHUB_ORGANIZATION=protobuftesting
-export DOCKERFILE_DIR=kokoro/linux/dockerfile/test/ruby
-export DOCKER_RUN_SCRIPT=kokoro/linux/pull_request_in_docker.sh
-export OUTPUT_DIR=testoutput
-export TEST_SET="ruby23"
-./kokoro/linux/build_and_run_docker.sh
diff --git a/kokoro/linux/ruby23/continuous.cfg b/kokoro/linux/ruby23/continuous.cfg
deleted file mode 100644
index f5c6498..0000000
--- a/kokoro/linux/ruby23/continuous.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/linux/ruby23/build.sh"
-timeout_mins: 120
-
-action {
-  define_artifacts {
-    regex: "**/sponge_log.xml"
-  }
-}
diff --git a/kokoro/linux/ruby23/presubmit.cfg b/kokoro/linux/ruby23/presubmit.cfg
deleted file mode 100644
index f5c6498..0000000
--- a/kokoro/linux/ruby23/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/linux/ruby23/build.sh"
-timeout_mins: 120
-
-action {
-  define_artifacts {
-    regex: "**/sponge_log.xml"
-  }
-}
diff --git a/kokoro/linux/ruby24/presubmit.cfg b/kokoro/linux/ruby24/presubmit.cfg
deleted file mode 100644
index a1ccfc0..0000000
--- a/kokoro/linux/ruby24/presubmit.cfg
+++ /dev/null
@@ -1,11 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/linux/ruby24/build.sh"
-timeout_mins: 120
-
-action {
-  define_artifacts {
-    regex: "**/sponge_log.xml"
-  }
-}
diff --git a/kokoro/macos/prepare_build_macos_rc b/kokoro/macos/prepare_build_macos_rc
index ef428fc..c0017b6 100755
--- a/kokoro/macos/prepare_build_macos_rc
+++ b/kokoro/macos/prepare_build_macos_rc
@@ -33,5 +33,8 @@
   curl -sSL https://rvm.io/mpapis.asc | gpg --import -
   curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -
 
-  curl -sSL https://get.rvm.io | bash -s stable --ruby
+  # Old OpenSSL versions cannot handle the SSL certificate used by
+  # https://get.rvm.io, so as a workaround we download RVM directly from
+  # GitHub. See this issue for details: https://github.com/rvm/rvm/issues/5133
+  curl -sSL https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer | bash -s stable --ruby
 fi
diff --git a/kokoro/macos/ruby23/build.sh b/kokoro/macos/ruby23/build.sh
deleted file mode 100755
index 5a29a99..0000000
--- a/kokoro/macos/ruby23/build.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-#
-# Build file to set up and run tests
-
-# Change to repo root
-cd $(dirname $0)/../../..
-
-# Prepare worker environment to run tests
-KOKORO_INSTALL_RVM=yes
-source kokoro/macos/prepare_build_macos_rc
-
-./tests.sh ruby23
diff --git a/kokoro/macos/ruby23/continuous.cfg b/kokoro/macos/ruby23/continuous.cfg
deleted file mode 100644
index c9b1f61..0000000
--- a/kokoro/macos/ruby23/continuous.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/macos/ruby23/build.sh"
-timeout_mins: 1440
diff --git a/kokoro/macos/ruby23/presubmit.cfg b/kokoro/macos/ruby23/presubmit.cfg
deleted file mode 100644
index c9b1f61..0000000
--- a/kokoro/macos/ruby23/presubmit.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/macos/ruby23/build.sh"
-timeout_mins: 1440
diff --git a/kokoro/macos/ruby24/build.sh b/kokoro/macos/ruby24/build.sh
deleted file mode 100755
index 10ac85f..0000000
--- a/kokoro/macos/ruby24/build.sh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-#
-# Build file to set up and run tests
-
-# Change to repo root
-cd $(dirname $0)/../../..
-
-# Prepare worker environment to run tests
-KOKORO_INSTALL_RVM=yes
-source kokoro/macos/prepare_build_macos_rc
-
-./tests.sh ruby24
diff --git a/kokoro/macos/ruby24/continuous.cfg b/kokoro/macos/ruby24/continuous.cfg
deleted file mode 100644
index fada028..0000000
--- a/kokoro/macos/ruby24/continuous.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/macos/ruby24/build.sh"
-timeout_mins: 1440
diff --git a/kokoro/macos/ruby24/presubmit.cfg b/kokoro/macos/ruby24/presubmit.cfg
deleted file mode 100644
index fada028..0000000
--- a/kokoro/macos/ruby24/presubmit.cfg
+++ /dev/null
@@ -1,5 +0,0 @@
-# Config file for running tests in Kokoro
-
-# Location of the build script in repository
-build_file: "protobuf/kokoro/macos/ruby24/build.sh"
-timeout_mins: 1440
diff --git a/kokoro/release/python/linux/build_artifacts.sh b/kokoro/release/python/linux/build_artifacts.sh
index 2407a30..31da562 100755
--- a/kokoro/release/python/linux/build_artifacts.sh
+++ b/kokoro/release/python/linux/build_artifacts.sh
@@ -61,7 +61,9 @@
 build_artifact_version 3.7
 build_artifact_version 3.8
 build_artifact_version 3.9
+build_artifact_version 3.10
 
 build_crosscompiled_aarch64_artifact_version 3.7
 build_crosscompiled_aarch64_artifact_version 3.8
 build_crosscompiled_aarch64_artifact_version 3.9
+build_crosscompiled_aarch64_artifact_version 3.10
diff --git a/kokoro/release/python/macos/build_artifacts.sh b/kokoro/release/python/macos/build_artifacts.sh
index fbbd650..7564453 100755
--- a/kokoro/release/python/macos/build_artifacts.sh
+++ b/kokoro/release/python/macos/build_artifacts.sh
@@ -55,3 +55,4 @@
 build_artifact_version 3.7
 build_artifact_version 3.8
 build_artifact_version 3.9
+build_artifact_version 3.10
diff --git a/kokoro/release/python/windows/build_artifacts.bat b/kokoro/release/python/windows/build_artifacts.bat
index 5c5df7c..ac466a9 100644
--- a/kokoro/release/python/windows/build_artifacts.bat
+++ b/kokoro/release/python/windows/build_artifacts.bat
@@ -9,7 +9,6 @@
 set REPO_DIR=protobuf
 set BUILD_DLL=OFF
 set UNICODE=ON
-set PB_TEST_DEP="six==1.9"
 set OTHER_TEST_DEP="setuptools==38.5.1"
 set OLD_PATH=C:\Program Files (x86)\MSBuild\14.0\bin\;%PATH%
 
@@ -74,6 +73,16 @@
 SET PYTHON_ARCH=64
 CALL build_single_artifact.bat || goto :error
 
+SET PYTHON=C:\python310_32bit
+SET PYTHON_VERSION=3.10
+SET PYTHON_ARCH=32
+CALL build_single_artifact.bat || goto :error
+
+SET PYTHON=C:\python310
+SET PYTHON_VERSION=3.10
+SET PYTHON_ARCH=64
+CALL build_single_artifact.bat || goto :error
+
 goto :EOF
 
 :error
diff --git a/kokoro/release/python/windows/build_single_artifact.bat b/kokoro/release/python/windows/build_single_artifact.bat
index 920f9c8..8d3cd0c 100644
--- a/kokoro/release/python/windows/build_single_artifact.bat
+++ b/kokoro/release/python/windows/build_single_artifact.bat
@@ -24,6 +24,12 @@
 if %PYTHON%==C:\python39 set generator=Visual Studio 14 Win64
 if %PYTHON%==C:\python39 set vcplatform=x64
 
+if %PYTHON%==C:\python310_32bit set generator=Visual Studio 14
+if %PYTHON%==C:\python310_32bit set vcplatform=Win32
+
+if %PYTHON%==C:\python310 set generator=Visual Studio 14 Win64
+if %PYTHON%==C:\python310 set vcplatform=x64
+
 REM Prepend newly installed Python to the PATH of this build (this cannot be
 REM done from inside the powershell script as it would require to restart
 REM the parent CMD process).
diff --git a/kokoro/release/python/windows/install_python_interpreters.ps1 b/kokoro/release/python/windows/install_python_interpreters.ps1
index b63259a..3f8db95 100644
--- a/kokoro/release/python/windows/install_python_interpreters.ps1
+++ b/kokoro/release/python/windows/install_python_interpreters.ps1
@@ -95,3 +95,20 @@
     PythonInstallerHash = "b61a33dc28f13b561452f3089c87eb63"
 }
 Install-Python @Python39x64Config
+
+# Python 3.10
+$Python310x86Config = @{
+    PythonVersion = "3.10.0"
+    PythonInstaller = "python-3.10.0"
+    PythonInstallPath = "C:\python310_32bit"
+    PythonInstallerHash = "133aa48145032e341ad2a000cd3bff50"
+}
+Install-Python @Python310x86Config
+
+$Python310x64Config = @{
+    PythonVersion = "3.10.0"
+    PythonInstaller = "python-3.10.0-amd64"
+    PythonInstallPath = "C:\python310"
+    PythonInstallerHash = "c3917c08a7fe85db7203da6dcaa99a70"
+}
+Install-Python @Python310x64Config
diff --git a/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh b/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh
index 046b604..98270d1 100755
--- a/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh
+++ b/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh
@@ -60,19 +60,18 @@
 ruby --version | grep 'ruby 2.7.0'
 for v in 3.0.0 2.7.0 ; do
   ccache -c
-  rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin11 MAKE="$MAKE"
+  rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin MAKE="$MAKE"
+  rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=aarch64-darwin MAKE="$MAKE"
 done
 set +x
 rvm use 2.5.0
 set -x
 ruby --version | grep 'ruby 2.5.0'
-for v in 2.6.0 2.5.1 2.4.0 2.3.0; do
+for v in 2.6.0 2.5.1; do
   ccache -c
-  rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin11 MAKE="$MAKE"
+  rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin MAKE="$MAKE"
+  rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=aarch64-darwin MAKE="$MAKE"
 done
 set +x
 rvm use 2.7.0
 set -x
-
-sed 's/x86_64-darwin-11/universal-darwin/' ~/.rake-compiler/config.yml > "$CROSS_RUBY"
-mv "$CROSS_RUBY" ~/.rake-compiler/config.yml
diff --git a/maven_install.json b/maven_install.json
index f934218..6168aa4 100644
--- a/maven_install.json
+++ b/maven_install.json
@@ -1,6 +1,8 @@
 {
     "dependency_tree": {
-        "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": 1033791982,
+        "__AUTOGENERATED_FILE_DO_NOT_MODIFY_THIS_FILE_MANUALLY": "THERE_IS_NO_DATA_ONLY_ZUUL",
+        "__INPUT_ARTIFACTS_HASH": 1907885757,
+        "__RESOLVED_ARTIFACTS_HASH": 375457873,
         "conflict_resolution": {
             "com.google.errorprone:error_prone_annotations:2.3.2": "com.google.errorprone:error_prone_annotations:2.5.1",
             "junit:junit:4.12": "junit:junit:4.13.1"
@@ -202,24 +204,6 @@
                 "url": "https://repo1.maven.org/maven2/org/easymock/easymock/3.2/easymock-3.2.jar"
             },
             {
-                "coord": "org.easymock:easymockclassextension:3.2",
-                "dependencies": [
-                    "org.easymock:easymock:3.2",
-                    "cglib:cglib-nodep:2.2.2",
-                    "org.objenesis:objenesis:1.3"
-                ],
-                "directDependencies": [
-                    "org.easymock:easymock:3.2"
-                ],
-                "file": "v1/https/repo1.maven.org/maven2/org/easymock/easymockclassextension/3.2/easymockclassextension-3.2.jar",
-                "mirror_urls": [
-                    "https://repo1.maven.org/maven2/org/easymock/easymockclassextension/3.2/easymockclassextension-3.2.jar",
-                    "https://repo.maven.apache.org/maven2/org/easymock/easymockclassextension/3.2/easymockclassextension-3.2.jar"
-                ],
-                "sha256": "e2aeb3ecec87d859b2f3072985d4b15873558bcf6410f422db0c0c5194c76c87",
-                "url": "https://repo1.maven.org/maven2/org/easymock/easymockclassextension/3.2/easymockclassextension-3.2.jar"
-            },
-            {
                 "coord": "org.hamcrest:hamcrest-core:1.3",
                 "dependencies": [],
                 "directDependencies": [],
diff --git a/objectivec/DevTools/check_version_stamps.sh b/objectivec/DevTools/check_version_stamps.sh
index 1acbe2a..a3524cb 100755
--- a/objectivec/DevTools/check_version_stamps.sh
+++ b/objectivec/DevTools/check_version_stamps.sh
@@ -25,7 +25,7 @@
   # Collect version from generator sources.
   local GeneratorVersion=$( \
       cat "${GeneratorSrc}" \
-          | sed -n -e "s:const int32 ${ConstantName} = \([0-9]*\);:\1:p"
+          | sed -n -e "s:const int32_t ${ConstantName} = \([0-9]*\);:\1:p"
   )
   if [[ -z "${GeneratorVersion}" ]] ; then
       die "Failed to find ${ConstantName} in the generator source (${GeneratorSrc})."
diff --git a/objectivec/DevTools/full_mac_build.sh b/objectivec/DevTools/full_mac_build.sh
index 9319b55..49b0ff4 100755
--- a/objectivec/DevTools/full_mac_build.sh
+++ b/objectivec/DevTools/full_mac_build.sh
@@ -289,7 +289,7 @@
           -disable-concurrent-destination-testing
       )
       ;;
-    11.* | 12.*)
+    11.* | 12.* | 13.*)
       # Dropped 32bit as Apple doesn't seem support the simulators either.
       XCODEBUILD_TEST_BASE_IOS+=(
           -destination "platform=iOS Simulator,name=iPhone 8,OS=latest" # 64bit
@@ -357,6 +357,11 @@
         -destination "platform=tvOS Simulator,name=Apple TV 4K,OS=latest"
       )
       ;;
+    13.*)
+      XCODEBUILD_TEST_BASE_TVOS+=(
+        -destination "platform=tvOS Simulator,name=Apple TV 4K (2nd generation),OS=latest"
+      )
+      ;;
     * )
       echo ""
       echo "ATTENTION: Time to update the simulator targets for Xcode ${XCODE_VERSION}"
diff --git a/objectivec/GPBStruct.pbobjc.h b/objectivec/GPBStruct.pbobjc.h
index e36df3f..abdd6c8 100644
--- a/objectivec/GPBStruct.pbobjc.h
+++ b/objectivec/GPBStruct.pbobjc.h
@@ -128,8 +128,8 @@
 /**
  * `Value` represents a dynamically typed value which can be either
  * null, a number, a string, a boolean, a recursive struct value, or a
- * list of values. A producer of value is expected to set one of that
- * variants, absence of any variant indicates an error.
+ * list of values. A producer of value is expected to set one of these
+ * variants. Absence of any variant indicates an error.
  *
  * The JSON representation for `Value` is JSON value.
  **/
diff --git a/php/ext/google/protobuf/names.c b/php/ext/google/protobuf/names.c
index 6108ff4..a991888 100644
--- a/php/ext/google/protobuf/names.c
+++ b/php/ext/google/protobuf/names.c
@@ -71,22 +71,22 @@
 /* def name -> classname ******************************************************/
 
 const char *const kReservedNames[] = {
-    "abstract",     "and",        "array",      "as",           "break",
-    "callable",     "case",       "catch",      "class",        "clone",
-    "const",        "continue",   "declare",    "default",      "die",
-    "do",           "echo",       "else",       "elseif",       "empty",
-    "enddeclare",   "endfor",     "endforeach", "endif",        "endswitch",
-    "endwhile",     "eval",       "exit",       "extends",      "final",
-    "finally",      "fn",         "for",        "foreach",      "function",
-    "if",           "implements", "include",    "include_once", "instanceof",
-    "global",       "goto",       "insteadof",  "interface",    "isset",
-    "list",         "match",      "namespace",  "new",          "or",
-    "print",        "private",    "protected",  "public",       "require",
-    "require_once", "return",     "static",     "switch",       "throw",
-    "trait",        "try",        "unset",      "use",          "var",
-    "while",        "xor",        "yield",      "int",          "float",
-    "bool",         "string",     "true",       "false",        "null",
-    "void",         "iterable",   NULL};
+    "abstract",   "and",          "array",      "as",           "break",
+    "callable",   "case",         "catch",      "class",        "clone",
+    "const",      "continue",     "declare",    "default",      "die",
+    "do",         "echo",         "else",       "elseif",       "empty",
+    "enddeclare", "endfor",       "endforeach", "endif",        "endswitch",
+    "endwhile",   "eval",         "exit",       "extends",      "final",
+    "finally",    "fn",           "for",        "foreach",      "function",
+    "if",         "implements",   "include",    "include_once", "instanceof",
+    "global",     "goto",         "insteadof",  "interface",    "isset",
+    "list",       "match",        "namespace",  "new",          "object",
+    "or",         "print",        "private",    "protected",    "public",
+    "require",    "require_once", "return",     "static",       "switch",
+    "throw",      "trait",        "try",        "unset",        "use",
+    "var",        "while",        "xor",        "yield",        "int",
+    "float",      "bool",         "string",     "true",         "false",
+    "null",       "void",         "iterable",   NULL};
 
 bool is_reserved_name(const char* name) {
   int i;
diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml
index f083785..5ef101b 100644
--- a/php/ext/google/protobuf/package.xml
+++ b/php/ext/google/protobuf/package.xml
@@ -10,11 +10,11 @@
   <email>protobuf-opensource@google.com</email>
   <active>yes</active>
  </lead>
- <date>2021-10-04</date>
- <time>13:03:51</time>
+ <date>2022-01-28</date>
+ <time>00:03:40</time>
  <version>
-  <release>3.18.1</release>
-  <api>3.18.1</api>
+  <release>3.19.4</release>
+  <api>3.19.4</api>
  </version>
  <stability>
   <release>stable</release>
@@ -22,7 +22,7 @@
  </stability>
  <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
  <notes>
- * No new changes in 3.18.1
+ * Fixed a data loss bug that could occur when the number of optional fields in a message is an exact multiple of 32. (#9440).
  </notes>
  <contents>
   <dir baseinstalldir="/" name="/">
@@ -1098,5 +1098,110 @@
    <notes>
    </notes>
   </release>
+  <release>
+   <version>
+    <release>3.19.0RC1</release>
+    <api>3.19.0</api>
+   </version>
+   <stability>
+    <release>beta</release>
+    <api>beta</api>
+   </stability>
+   <date>2021-10-15</date>
+   <time>13:38:38</time>
+   <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
+   <notes>
+   </notes>
+  </release>
+  <release>
+   <version>
+    <release>3.19.0RC2</release>
+    <api>3.19.0</api>
+   </version>
+   <stability>
+    <release>beta</release>
+    <api>beta</api>
+   </stability>
+   <date>2021-10-18</date>
+   <time>15:36:35</time>
+   <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
+   <notes>
+   </notes>
+  </release>
+  <release>
+   <version>
+    <release>3.19.0</release>
+    <api>3.19.0</api>
+   </version>
+   <stability>
+    <release>stable</release>
+    <api>stable</api>
+   </stability>
+   <date>2021-10-19</date>
+   <time>11:06:24</time>
+   <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
+   <notes>
+   </notes>
+  </release>
+  <release>
+   <version>
+    <release>3.19.1</release>
+    <api>3.19.1</api>
+   </version>
+   <stability>
+    <release>stable</release>
+    <api>stable</api>
+   </stability>
+   <date>2021-10-28</date>
+   <time>20:01:12</time>
+   <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
+   <notes>
+   </notes>
+  </release>
+  <release>
+   <version>
+    <release>3.19.2</release>
+    <api>3.19.2</api>
+   </version>
+   <stability>
+    <release>stable</release>
+    <api>stable</api>
+   </stability>
+   <date>2022-01-05</date>
+   <time>17:01:38</time>
+   <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
+   <notes>
+   </notes>
+  </release>
+  <release>
+   <version>
+    <release>3.19.3</release>
+    <api>3.19.3</api>
+   </version>
+   <stability>
+    <release>stable</release>
+    <api>stable</api>
+   </stability>
+   <date>2022-01-11</date>
+   <time>00:58:50</time>
+   <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
+   <notes>
+   </notes>
+  </release>
+  <release>
+   <version>
+    <release>3.19.4</release>
+    <api>3.19.4</api>
+   </version>
+   <stability>
+    <release>stable</release>
+    <api>stable</api>
+   </stability>
+   <date>2022-01-28</date>
+   <time>00:03:40</time>
+   <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license>
+   <notes>
+   </notes>
+  </release>
  </changelog>
 </package>
diff --git a/php/ext/google/protobuf/php-upb.c b/php/ext/google/protobuf/php-upb.c
index a668fe0..925faa6 100644
--- a/php/ext/google/protobuf/php-upb.c
+++ b/php/ext/google/protobuf/php-upb.c
@@ -5968,7 +5968,7 @@
   }
 
   /* Account for space used by hasbits. */
-  l->size = div_round_up(hasbit, 8);
+  l->size = div_round_up(hasbit + 1, 8);
 
   /* Allocate non-oneof fields. */
   for (upb_msg_field_begin(&it, m); !upb_msg_field_done(&it);
diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h
index 8b5c8aa..41ae271 100644
--- a/php/ext/google/protobuf/protobuf.h
+++ b/php/ext/google/protobuf/protobuf.h
@@ -91,7 +91,7 @@
   ZEND_ARG_INFO(0, value)
 ZEND_END_ARG_INFO()
 
-#define PHP_PROTOBUF_VERSION "3.18.1"
+#define PHP_PROTOBUF_VERSION "3.19.4"
 
 // ptr -> PHP object cache. This is a weak map that caches lazily-created
 // wrapper objects around upb types:
diff --git a/php/src/Google/Protobuf/Value.php b/php/src/Google/Protobuf/Value.php
index 7bebb99..dcc0bdf 100644
--- a/php/src/Google/Protobuf/Value.php
+++ b/php/src/Google/Protobuf/Value.php
@@ -11,8 +11,8 @@
 /**
  * `Value` represents a dynamically typed value which can be either
  * null, a number, a string, a boolean, a recursive struct value, or a
- * list of values. A producer of value is expected to set one of that
- * variants, absence of any variant indicates an error.
+ * list of values. A producer of value is expected to set one of these
+ * variants. Absence of any variant indicates an error.
  * The JSON representation for `Value` is JSON value.
  *
  * Generated from protobuf message <code>google.protobuf.Value</code>
diff --git a/php/tests/GeneratedClassTest.php b/php/tests/GeneratedClassTest.php
index 837f052..a6101dc 100644
--- a/php/tests/GeneratedClassTest.php
+++ b/php/tests/GeneratedClassTest.php
@@ -9,6 +9,7 @@
 use Bar\TestLegacyMessage;
 use Bar\TestLegacyMessage_NestedEnum;
 use Bar\TestLegacyMessage_NestedMessage;
+use Foo\Test32Fields;
 use Foo\TestEnum;
 use Foo\TestIncludeNamespaceMessage;
 use Foo\TestIncludePrefixMessage;
@@ -1849,4 +1850,13 @@
 
         $this->assertTrue(true);
     }
+
+    public function testIssue9440()
+    {
+        $m = new Test32Fields();
+        $m->setId(8);
+        $this->assertEquals(8, $m->getId());
+        $m->setVersion('1');
+        $this->assertEquals(8, $m->getId());
+    }
 }
diff --git a/php/tests/proto/test.proto b/php/tests/proto/test.proto
index 609b8cf..421292a 100644
--- a/php/tests/proto/test.proto
+++ b/php/tests/proto/test.proto
@@ -306,3 +306,38 @@
     int32 int32_field = 4;
   }
 }
+
+message Test32Fields {
+  optional uint32 id = 1;
+  optional uint32 random_name_a0 = 2;
+  optional uint32 random_name_a1 = 3;
+  optional uint32 random_name_a2 = 4;
+  optional uint32 random_name_a3 = 5;
+  optional uint32 random_name_a4 = 6;
+  optional uint32 random_name_a5 = 7;
+  optional uint32 random_name_a6 = 8;
+  optional uint32 random_name_a7 = 9;
+  optional uint32 random_name_a8 = 10;
+  optional uint32 random_name_a9 = 11;
+  optional uint32 random_name_b0 = 12;
+  optional uint32 random_name_b1 = 13;
+  optional uint32 random_name_b2 = 14;
+  optional uint32 random_name_b3 = 15;
+  optional uint32 random_name_b4 = 16;
+  optional uint32 random_name_b5 = 17;
+  optional uint32 random_name_b6 = 18;
+  optional uint32 random_name_b7 = 19;
+  optional uint32 random_name_b8 = 20;
+  optional uint32 random_name_b9 = 21;
+  optional uint32 random_name_c0 = 22;
+  optional uint32 random_name_c1 = 23;
+  optional uint32 random_name_c2 = 24;
+  optional uint32 random_name_c3 = 25;
+  optional uint32 random_name_c4 = 26;
+  optional uint32 random_name_c5 = 27;
+  optional uint32 random_name_c6 = 28;
+  optional uint32 random_name_c7 = 29;
+  optional uint32 random_name_c8 = 30;
+  optional uint32 random_name_c9 = 31;
+  optional string version = 32;
+}
diff --git a/protobuf-lite.pc.in b/protobuf-lite.pc.in
index 68a2bb4..f92e4ad 100644
--- a/protobuf-lite.pc.in
+++ b/protobuf-lite.pc.in
@@ -6,6 +6,6 @@
 Name: Protocol Buffers
 Description: Google's Data Interchange Format
 Version: @VERSION@
-Libs: -L${libdir} -lprotobuf-lite @PTHREAD_LIBS@
-Cflags: -I${includedir} @PTHREAD_CFLAGS@
+Libs: -L${libdir} -lprotobuf-lite
+Cflags: -I${includedir}
 Conflicts: protobuf
diff --git a/protobuf.pc.in b/protobuf.pc.in
index 055a9d0..e9bef5d 100644
--- a/protobuf.pc.in
+++ b/protobuf.pc.in
@@ -6,8 +6,8 @@
 Name: Protocol Buffers
 Description: Google's Data Interchange Format
 Version: @VERSION@
-Libs: -L${libdir} -lprotobuf @PTHREAD_LIBS@
+Libs: -L${libdir} -lprotobuf
 Libs.private: @LIBS@
 
-Cflags: -I${includedir} @PTHREAD_CFLAGS@
+Cflags: -I${includedir}
 Conflicts: protobuf-lite
diff --git a/protobuf_deps.bzl b/protobuf_deps.bzl
index ec9d8e9..32f38eb 100644
--- a/protobuf_deps.bzl
+++ b/protobuf_deps.bzl
@@ -2,6 +2,17 @@
 
 load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
 
+PROTOBUF_MAVEN_ARTIFACTS = [
+    "com.google.code.findbugs:jsr305:3.0.2",
+    "com.google.code.gson:gson:2.8.6",
+    "com.google.errorprone:error_prone_annotations:2.3.2",
+    "com.google.j2objc:j2objc-annotations:1.3",
+    "com.google.guava:guava:30.1.1-jre",
+    "com.google.truth:truth:1.1.2",
+    "junit:junit:4.12",
+    "org.easymock:easymock:3.2",
+]
+
 def protobuf_deps():
     """Loads common dependencies needed to compile the protobuf library."""
 
@@ -24,14 +35,6 @@
             urls = ["https://github.com/madler/zlib/archive/v1.2.11.tar.gz"],
         )
 
-    if not native.existing_rule("six"):
-        http_archive(
-            name = "six",
-            build_file = "@com_google_protobuf//:third_party/six.BUILD",
-            sha256 = "d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73",
-            urls = ["https://pypi.python.org/packages/source/s/six/six-1.12.0.tar.gz"],
-        )
-
     if not native.existing_rule("rules_cc"):
         http_archive(
             name = "rules_cc",
@@ -59,13 +62,12 @@
     if not native.existing_rule("rules_python"):
         http_archive(
             name = "rules_python",
-            sha256 = "e5470e92a18aa51830db99a4d9c492cc613761d5bdb7131c04bd92b9834380f6",
-            strip_prefix = "rules_python-4b84ad270387a7c439ebdccfd530e2339601ef27",
-            urls = ["https://github.com/bazelbuild/rules_python/archive/4b84ad270387a7c439ebdccfd530e2339601ef27.tar.gz"],
+            sha256 = "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0",
+            urls = ["https://github.com/bazelbuild/rules_python/releases/download/0.1.0/rules_python-0.1.0.tar.gz"],
         )
 
     if not native.existing_rule("rules_jvm_external"):
-       http_archive(
+        http_archive(
             name = "rules_jvm_external",
             sha256 = "f36441aa876c4f6427bfb2d1f2d723b48e9d930b62662bf723ddfb8fc80f0140",
             strip_prefix = "rules_jvm_external-4.1",
diff --git a/protobuf_version.bzl b/protobuf_version.bzl
index 7f6d714..9ae1340 100644
--- a/protobuf_version.bzl
+++ b/protobuf_version.bzl
@@ -1 +1 @@
-PROTOBUF_VERSION = '3.18.1'
+PROTOBUF_VERSION = '3.19.4'
diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml
index c3aa377..dec2e70 100644
--- a/protoc-artifacts/pom.xml
+++ b/protoc-artifacts/pom.xml
@@ -8,7 +8,7 @@
   </parent>
   <groupId>com.google.protobuf</groupId>
   <artifactId>protoc</artifactId>
-  <version>3.18.1</version>
+  <version>3.19.4</version>
   <packaging>pom</packaging>
   <name>Protobuf Compiler</name>
   <description>
diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py
index b8122e8..9319c67 100644
--- a/python/google/protobuf/__init__.py
+++ b/python/google/protobuf/__init__.py
@@ -30,4 +30,4 @@
 
 # Copyright 2007 Google Inc. All Rights Reserved.
 
-__version__ = '3.18.1'
+__version__ = '3.19.4'
diff --git a/python/google/protobuf/descriptor.py b/python/google/protobuf/descriptor.py
index 0f7bd17..61c242f 100644
--- a/python/google/protobuf/descriptor.py
+++ b/python/google/protobuf/descriptor.py
@@ -951,7 +951,7 @@
     public_dependencies (list[FileDescriptor]): A subset of
       :attr:`dependencies`, which were declared as "public".
     message_types_by_name (dict(str, Descriptor)): Mapping from message names
-      to their :class:`Desctiptor`.
+      to their :class:`Descriptor`.
     enum_types_by_name (dict(str, EnumDescriptor)): Mapping from enum names to
       their :class:`EnumDescriptor`.
     extensions_by_name (dict(str, FieldDescriptor)): Mapping from extension
diff --git a/python/google/protobuf/descriptor_pool.py b/python/google/protobuf/descriptor_pool.py
index de9100b..a6955ce 100644
--- a/python/google/protobuf/descriptor_pool.py
+++ b/python/google/protobuf/descriptor_pool.py
@@ -207,13 +207,18 @@
     Args:
       serialized_file_desc_proto (bytes): A bytes string, serialization of the
         :class:`FileDescriptorProto` to add.
+
+    Returns:
+      FileDescriptor: Descriptor for the added file.
     """
 
     # pylint: disable=g-import-not-at-top
     from google.protobuf import descriptor_pb2
     file_desc_proto = descriptor_pb2.FileDescriptorProto.FromString(
         serialized_file_desc_proto)
-    self.Add(file_desc_proto)
+    file_desc = self._ConvertFileProtoToFileDescriptor(file_desc_proto)
+    file_desc.serialized_pb = serialized_file_desc_proto
+    return file_desc
 
   # Add Descriptor to descriptor pool is dreprecated. Please use Add()
   # or AddSerializedFile() to add a FileDescriptorProto instead.
@@ -808,7 +813,6 @@
             self._MakeServiceDescriptor(service_proto, index, scope,
                                         file_proto.package, file_descriptor))
 
-      self.Add(file_proto)
       self._file_descriptors[file_proto.name] = file_descriptor
 
     # Add extensions to the pool
@@ -865,11 +869,17 @@
         for index, extension in enumerate(desc_proto.extension)]
     oneofs = [
         # pylint: disable=g-complex-comprehension
-        descriptor.OneofDescriptor(desc.name, '.'.join((desc_name, desc.name)),
-                                   index, None, [], desc.options,
-                                   # pylint: disable=protected-access
-                                   create_key=descriptor._internal_create_key)
-        for index, desc in enumerate(desc_proto.oneof_decl)]
+        descriptor.OneofDescriptor(
+            desc.name,
+            '.'.join((desc_name, desc.name)),
+            index,
+            None,
+            [],
+            _OptionsOrNone(desc),
+            # pylint: disable=protected-access
+            create_key=descriptor._internal_create_key)
+        for index, desc in enumerate(desc_proto.oneof_decl)
+    ]
     extension_ranges = [(r.start, r.end) for r in desc_proto.extension_range]
     if extension_ranges:
       is_extendable = True
@@ -987,6 +997,11 @@
     else:
       full_name = field_proto.name
 
+    if field_proto.json_name:
+      json_name = field_proto.json_name
+    else:
+      json_name = None
+
     return descriptor.FieldDescriptor(
         name=field_proto.name,
         full_name=full_name,
@@ -1003,6 +1018,7 @@
         is_extension=is_extension,
         extension_scope=None,
         options=_OptionsOrNone(field_proto),
+        json_name=json_name,
         file=file_desc,
         # pylint: disable=protected-access
         create_key=descriptor._internal_create_key)
@@ -1107,6 +1123,8 @@
         field_desc.default_value = b''
       elif field_proto.type == descriptor.FieldDescriptor.TYPE_MESSAGE:
         field_desc.default_value = None
+      elif field_proto.type == descriptor.FieldDescriptor.TYPE_GROUP:
+        field_desc.default_value = None
       else:
         # All other types are of the "int" type.
         field_desc.default_value = 0
diff --git a/python/google/protobuf/internal/__init__.py b/python/google/protobuf/internal/__init__.py
index 7d2e571..e69de29 100644
--- a/python/google/protobuf/internal/__init__.py
+++ b/python/google/protobuf/internal/__init__.py
@@ -1,30 +0,0 @@
-# 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.
-
diff --git a/python/google/protobuf/internal/_parameterized.py b/python/google/protobuf/internal/_parameterized.py
index 287ba68..2229671 100755
--- a/python/google/protobuf/internal/_parameterized.py
+++ b/python/google/protobuf/internal/_parameterized.py
@@ -178,8 +178,8 @@
 
 
 def _NonStringIterable(obj):
-  return (isinstance(obj, collections_abc.Iterable) and not
-          isinstance(obj, str))
+  return (isinstance(obj, collections_abc.Iterable) and
+          not isinstance(obj, str))
 
 
 def _FormatParameterList(testcase_params):
diff --git a/python/google/protobuf/internal/api_implementation.cc b/python/google/protobuf/internal/api_implementation.cc
index 2a7f41d..8023224 100644
--- a/python/google/protobuf/internal/api_implementation.cc
+++ b/python/google/protobuf/internal/api_implementation.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.
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 namespace google {
@@ -77,7 +78,6 @@
     "constants defined in C, such that one can set defaults at compilation\n"
     "(e.g. with blaze flag --copt=-DPYTHON_PROTO2_CPP_IMPL_V2).";
 
-#if PY_MAJOR_VERSION >= 3
 static struct PyModuleDef _module = {PyModuleDef_HEAD_INIT,
                                      kModuleName,
                                      kModuleDocstring,
@@ -87,38 +87,22 @@
                                      NULL,
                                      NULL,
                                      NULL};
-#define INITFUNC PyInit__api_implementation
-#define INITFUNC_ERRORVAL NULL
-#else
-#define INITFUNC init_api_implementation
-#define INITFUNC_ERRORVAL
-#endif
 
 extern "C" {
-PyMODINIT_FUNC INITFUNC() {
-#if PY_MAJOR_VERSION >= 3
+PyMODINIT_FUNC PyInit__api_implementation() {
   PyObject* module = PyModule_Create(&_module);
-#else
-  PyObject* module = Py_InitModule3(const_cast<char*>(kModuleName), NULL,
-                                    const_cast<char*>(kModuleDocstring));
-#endif
   if (module == NULL) {
-    return INITFUNC_ERRORVAL;
+    return NULL;
   }
 
   // Adds the module variable "api_version".
   if (PyModule_AddIntConstant(module, const_cast<char*>(kImplVersionName),
-                              kImplVersion))
-#if PY_MAJOR_VERSION < 3
-    return;
-#else
-  {
+                              kImplVersion)) {
     Py_DECREF(module);
     return NULL;
   }
 
   return module;
-#endif
 }
 }
 
diff --git a/python/google/protobuf/internal/api_implementation.py b/python/google/protobuf/internal/api_implementation.py
index a366731..7fef237 100644
--- a/python/google/protobuf/internal/api_implementation.py
+++ b/python/google/protobuf/internal/api_implementation.py
@@ -41,46 +41,15 @@
   # The compile-time constants in the _api_implementation module can be used to
   # switch to a certain implementation of the Python API at build time.
   _api_version = _api_implementation.api_version
-  _proto_extension_modules_exist_in_build = True
 except ImportError:
   _api_version = -1  # Unspecified by compiler flags.
-  _proto_extension_modules_exist_in_build = False
 
 if _api_version == 1:
   raise ValueError('api_version=1 is no longer supported.')
-if _api_version < 0:  # Still unspecified?
-  try:
-    # The presence of this module in a build allows the proto implementation to
-    # be upgraded merely via build deps rather than a compiler flag or the
-    # runtime environment variable.
-    # pylint: disable=g-import-not-at-top
-    from google.protobuf import _use_fast_cpp_protos
-    # Work around a known issue in the classic bootstrap .par import hook.
-    if not _use_fast_cpp_protos:
-      raise ImportError('_use_fast_cpp_protos import succeeded but was None')
-    del _use_fast_cpp_protos
-    _api_version = 2
-    from google.protobuf import use_pure_python
-    raise RuntimeError(
-        'Conflicting deps on both :use_fast_cpp_protos and :use_pure_python.\n'
-        ' go/build_deps_on_BOTH_use_fast_cpp_protos_AND_use_pure_python\n'
-        'This should be impossible via a link error at build time...')
-  except ImportError:
-    try:
-      # pylint: disable=g-import-not-at-top
-      from google.protobuf import use_pure_python
-      del use_pure_python  # Avoids a pylint error and namespace pollution.
-      _api_version = 0
-    except ImportError:
-      # TODO(b/74017912): It's unsafe to enable :use_fast_cpp_protos by default;
-      # it can cause data loss if you have any Python-only extensions to any
-      # message passed back and forth with C++ code.
-      #
-      # TODO(b/17427486): Once that bug is fixed, we want to make both Python 2
-      # and Python 3 default to `_api_version = 2` (C++ implementation V2).
-      pass
 
-_default_implementation_type = ('python' if _api_version <= 0 else 'cpp')
+
+_default_implementation_type = ('cpp' if _api_version > 0 else 'python')
+
 
 # This environment variable can be used to switch to a certain implementation
 # of the Python API, overriding the compile-time constants in the
@@ -97,21 +66,6 @@
                 'Falling back to the python implementation.')
   _implementation_type = 'python'
 
-# This environment variable can be used to switch between the two
-# 'cpp' implementations, overriding the compile-time constants in the
-# _api_implementation module. Right now only '2' is supported. Any other
-# value will cause an error to be raised.
-_implementation_version_str = os.getenv(
-    'PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION', '2')
-
-if _implementation_version_str != '2':
-  raise ValueError(
-      'unsupported PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION: "' +
-      _implementation_version_str + '" (supported versions: 2)'
-      )
-
-_implementation_version = int(_implementation_version_str)
-
 
 # Detect if serialization should be deterministic by default
 try:
@@ -150,7 +104,7 @@
 
 # See comment on 'Type' above.
 def Version():
-  return _implementation_version
+  return 2
 
 
 # For internal use only
diff --git a/python/google/protobuf/internal/containers.py b/python/google/protobuf/internal/containers.py
index 9279349..f0c06df 100644
--- a/python/google/protobuf/internal/containers.py
+++ b/python/google/protobuf/internal/containers.py
@@ -42,149 +42,7 @@
 
 __author__ = 'petar@google.com (Petar Petrov)'
 
-import sys
-try:
-  # This fallback applies for all versions of Python before 3.3
-  import collections.abc as collections_abc
-except ImportError:
-  import collections as collections_abc
-
-if sys.version_info[0] < 3:
-  # We would use collections_abc.MutableMapping all the time, but in Python 2
-  # it doesn't define __slots__.  This causes two significant problems:
-  #
-  # 1. we can't disallow arbitrary attribute assignment, even if our derived
-  #    classes *do* define __slots__.
-  #
-  # 2. we can't safely derive a C type from it without __slots__ defined (the
-  #    interpreter expects to find a dict at tp_dictoffset, which we can't
-  #    robustly provide.  And we don't want an instance dict anyway.
-  #
-  # So this is the Python 2.7 definition of Mapping/MutableMapping functions
-  # verbatim, except that:
-  # 1. We declare __slots__.
-  # 2. We don't declare this as a virtual base class.  The classes defined
-  #    in collections_abc are the interesting base classes, not us.
-  #
-  # Note: deriving from object is critical.  It is the only thing that makes
-  # this a true type, allowing us to derive from it in C++ cleanly and making
-  # __slots__ properly disallow arbitrary element assignment.
-
-  class Mapping(object):
-    __slots__ = ()
-
-    def get(self, key, default=None):
-      try:
-        return self[key]
-      except KeyError:
-        return default
-
-    def __contains__(self, key):
-      try:
-        self[key]
-      except KeyError:
-        return False
-      else:
-        return True
-
-    def iterkeys(self):
-      return iter(self)
-
-    def itervalues(self):
-      for key in self:
-        yield self[key]
-
-    def iteritems(self):
-      for key in self:
-        yield (key, self[key])
-
-    def keys(self):
-      return list(self)
-
-    def items(self):
-      return [(key, self[key]) for key in self]
-
-    def values(self):
-      return [self[key] for key in self]
-
-    # Mappings are not hashable by default, but subclasses can change this
-    __hash__ = None
-
-    def __eq__(self, other):
-      if not isinstance(other, collections_abc.Mapping):
-        return NotImplemented
-      return dict(self.items()) == dict(other.items())
-
-    def __ne__(self, other):
-      return not (self == other)
-
-  class MutableMapping(Mapping):
-    __slots__ = ()
-
-    __marker = object()
-
-    def pop(self, key, default=__marker):
-      try:
-        value = self[key]
-      except KeyError:
-        if default is self.__marker:
-          raise
-        return default
-      else:
-        del self[key]
-        return value
-
-    def popitem(self):
-      try:
-        key = next(iter(self))
-      except StopIteration:
-        raise KeyError
-      value = self[key]
-      del self[key]
-      return key, value
-
-    def clear(self):
-      try:
-        while True:
-          self.popitem()
-      except KeyError:
-        pass
-
-    def update(*args, **kwds):
-      if len(args) > 2:
-        raise TypeError("update() takes at most 2 positional "
-                        "arguments ({} given)".format(len(args)))
-      elif not args:
-        raise TypeError("update() takes at least 1 argument (0 given)")
-      self = args[0]
-      other = args[1] if len(args) >= 2 else ()
-
-      if isinstance(other, Mapping):
-        for key in other:
-          self[key] = other[key]
-      elif hasattr(other, "keys"):
-        for key in other.keys():
-          self[key] = other[key]
-      else:
-        for key, value in other:
-          self[key] = value
-      for key, value in kwds.items():
-        self[key] = value
-
-    def setdefault(self, key, default=None):
-      try:
-        return self[key]
-      except KeyError:
-        self[key] = default
-      return default
-
-  collections_abc.Mapping.register(Mapping)
-  collections_abc.MutableMapping.register(MutableMapping)
-
-else:
-  # In Python 3 we can just use MutableMapping directly, because it defines
-  # __slots__.
-  MutableMapping = collections_abc.MutableMapping
+import collections.abc
 
 
 class BaseContainer(object):
@@ -235,7 +93,7 @@
     self._values.reverse()
 
 
-collections_abc.MutableSequence.register(BaseContainer)
+collections.abc.MutableSequence.register(BaseContainer)
 
 
 class RepeatedScalarFieldContainer(BaseContainer):
@@ -458,7 +316,7 @@
     return self._values == other._values
 
 
-class ScalarMap(MutableMapping):
+class ScalarMap(collections.abc.MutableMapping):
 
   """Simple, type-checked, dict-like container for holding repeated scalars."""
 
@@ -548,7 +406,7 @@
     return self._entry_descriptor._concrete_class
 
 
-class MessageMap(MutableMapping):
+class MessageMap(collections.abc.MutableMapping):
 
   """Simple, type-checked, dict-like container for with submessage values."""
 
diff --git a/python/google/protobuf/internal/descriptor_database_test.py b/python/google/protobuf/internal/descriptor_database_test.py
old mode 100755
new mode 100644
index 3435f68..ad3ca64
--- a/python/google/protobuf/internal/descriptor_database_test.py
+++ b/python/google/protobuf/internal/descriptor_database_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/descriptor_pool_test.py b/python/google/protobuf/internal/descriptor_pool_test.py
old mode 100755
new mode 100644
index 8c104b0..e59cf9b
--- a/python/google/protobuf/internal/descriptor_pool_test.py
+++ b/python/google/protobuf/internal/descriptor_pool_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
@@ -403,9 +401,19 @@
         # TODO(jieluo): Fix python and cpp extension diff.
         return
     self.pool = descriptor_pool.DescriptorPool()
-    self.pool.AddSerializedFile(self.factory_test1_fd.SerializeToString())
-    self.pool.AddSerializedFile(self.factory_test2_fd.SerializeToString())
+    file1 = self.pool.AddSerializedFile(
+        self.factory_test1_fd.SerializeToString())
+    file2 = self.pool.AddSerializedFile(
+        self.factory_test2_fd.SerializeToString())
+    self.assertEqual(file1.name,
+                     'google/protobuf/internal/factory_test1.proto')
+    self.assertEqual(file2.name,
+                     'google/protobuf/internal/factory_test2.proto')
     self.testFindMessageTypeByName()
+    file_json = self.pool.AddSerializedFile(
+        more_messages_pb2.DESCRIPTOR.serialized_pb)
+    field = file_json.message_types_by_name['class'].fields_by_name['int_field']
+    self.assertEqual(field.json_name, 'json_int')
 
 
   def testEnumDefaultValue(self):
diff --git a/python/google/protobuf/internal/descriptor_test.py b/python/google/protobuf/internal/descriptor_test.py
old mode 100755
new mode 100644
index 8680883..88d7136
--- a/python/google/protobuf/internal/descriptor_test.py
+++ b/python/google/protobuf/internal/descriptor_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/generator_test.py b/python/google/protobuf/internal/generator_test.py
old mode 100755
new mode 100644
index ab16d17..0c4299a
--- a/python/google/protobuf/internal/generator_test.py
+++ b/python/google/protobuf/internal/generator_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/json_format_test.py b/python/google/protobuf/internal/json_format_test.py
old mode 100755
new mode 100644
index 6a44d4c..af3713f
--- a/python/google/protobuf/internal/json_format_test.py
+++ b/python/google/protobuf/internal/json_format_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/keywords_test.py b/python/google/protobuf/internal/keywords_test.py
old mode 100755
new mode 100644
index 8744928..4182cf6
--- a/python/google/protobuf/internal/keywords_test.py
+++ b/python/google/protobuf/internal/keywords_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/message_factory_test.py b/python/google/protobuf/internal/message_factory_test.py
old mode 100755
new mode 100644
index 088fcd6..97ef3aa
--- a/python/google/protobuf/internal/message_factory_test.py
+++ b/python/google/protobuf/internal/message_factory_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/message_test.py b/python/google/protobuf/internal/message_test.py
old mode 100755
new mode 100644
index 1b0710b..6ed1f20
--- a/python/google/protobuf/internal/message_test.py
+++ b/python/google/protobuf/internal/message_test.py
@@ -1,6 +1,4 @@
-#! /usr/bin/env python
 # -*- coding: utf-8 -*-
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/more_messages.proto b/python/google/protobuf/internal/more_messages.proto
index c5889c4..524dc70 100644
--- a/python/google/protobuf/internal/more_messages.proto
+++ b/python/google/protobuf/internal/more_messages.proto
@@ -40,44 +40,44 @@
 // canonicalization of serialized output, which should always be in tag order.
 // We also mix in some extensions for extra fun.
 message OutOfOrderFields {
-  optional   sint32 optional_sint32   =  5;
+  optional sint32 optional_sint32 = 5;
   extensions 4 to 4;
-  optional   uint32 optional_uint32   =  3;
+  optional uint32 optional_uint32 = 3;
   extensions 2 to 2;
-  optional    int32 optional_int32    =  1;
-};
-
+  optional int32 optional_int32 = 1;
+}
 
 extend OutOfOrderFields {
-  optional   uint64 optional_uint64   =  4;
-  optional    int64 optional_int64    =  2;
+  optional uint64 optional_uint64 = 4;
+  optional int64 optional_int64 = 2;
 }
 
-enum is {                               // top level enum keyword
+enum is {  // top level enum keyword
   default = 0;
-  else = 1;                             // top level enum value keyword
+  else = 1;  // top level enum value keyword
 }
 
-message class {                         // message keyword
-  optional int32 int_field = 1;
-  optional int32 if = 2;                // field keyword
-  optional is as = 3;                   // enum field keyword
+message class {  // message keyword
+  optional int32 int_field = 1 [json_name = "json_int"];
+  optional int32 if = 2;  // field keyword
+  optional is as = 3;     // enum field keyword
   optional is enum_field = 4;
   enum for {                            // nested enum keyword
     default = 0;
-    True = 1;                           // nested enum value keyword
+    True = 1;  // nested enum value keyword
   }
   optional for nested_enum_field = 5;
   message try {
     optional int32 field = 1;
     extensions 999 to 9999;
   }
-  optional try nested_message = 6;
+  optional try
+    nested_message = 6;
   extensions 999 to 9999;
 }
 
 extend class {
-  optional int32 continue = 1001;       // top level extension keyword
+  optional int32 continue = 1001;  // top level extension keyword
 }
 
 extend class.try {
@@ -86,7 +86,7 @@
 
 message ExtendClass {
   extend class {
-    optional int32 return = 1002;       // nested extension keyword
+    optional int32 return = 1002;  // nested extension keyword
   }
 }
 
diff --git a/python/google/protobuf/internal/proto_builder_test.py b/python/google/protobuf/internal/proto_builder_test.py
old mode 100755
new mode 100644
index d7d63c8..8e2afaf
--- a/python/google/protobuf/internal/proto_builder_test.py
+++ b/python/google/protobuf/internal/proto_builder_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/python_protobuf.cc b/python/google/protobuf/internal/python_protobuf.cc
new file mode 100644
index 0000000..e823bf2
--- /dev/null
+++ b/python/google/protobuf/internal/python_protobuf.cc
@@ -0,0 +1,59 @@
+// 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.
+
+// Author: qrczak@google.com (Marcin Kowalczyk)
+
+#include <google/protobuf/python/python_protobuf.h>
+
+namespace google {
+namespace protobuf {
+namespace python {
+
+static const Message* GetCProtoInsidePyProtoStub(PyObject* msg) { return NULL; }
+static Message* MutableCProtoInsidePyProtoStub(PyObject* msg) { return NULL; }
+
+// This is initialized with a default, stub implementation.
+// If python-google.protobuf.cc is loaded, the function pointer is overridden
+// with a full implementation.
+const Message* (*GetCProtoInsidePyProtoPtr)(PyObject* msg) =
+    GetCProtoInsidePyProtoStub;
+Message* (*MutableCProtoInsidePyProtoPtr)(PyObject* msg) =
+    MutableCProtoInsidePyProtoStub;
+
+const Message* GetCProtoInsidePyProto(PyObject* msg) {
+  return GetCProtoInsidePyProtoPtr(msg);
+}
+Message* MutableCProtoInsidePyProto(PyObject* msg) {
+  return MutableCProtoInsidePyProtoPtr(msg);
+}
+
+}  // namespace python
+}  // namespace protobuf
+}  // namespace google
diff --git a/python/google/protobuf/internal/reflection_test.py b/python/google/protobuf/internal/reflection_test.py
old mode 100755
new mode 100644
index 827998a..d1d5956
--- a/python/google/protobuf/internal/reflection_test.py
+++ b/python/google/protobuf/internal/reflection_test.py
@@ -1,6 +1,4 @@
-#! /usr/bin/env python
 # -*- coding: utf-8 -*-
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
@@ -39,6 +37,7 @@
 import gc
 import operator
 import struct
+import sys
 import warnings
 import unittest
 
@@ -378,7 +377,8 @@
     self.assertRaises(TypeError, setattr, proto, 'optional_float', 'foo')
     self.assertRaises(TypeError, setattr, proto, 'optional_double', 'foo')
     # TODO(jieluo): Fix type checking difference for python and c extension
-    if api_implementation.Type() == 'python':
+    if (api_implementation.Type() == 'python' or
+        (sys.version_info.major, sys.version_info.minor) >= (3, 10)):
       self.assertRaises(TypeError, setattr, proto, 'optional_bool', 1.1)
     else:
       proto.optional_bool = 1.1
diff --git a/python/google/protobuf/internal/service_reflection_test.py b/python/google/protobuf/internal/service_reflection_test.py
old mode 100755
new mode 100644
index 343db4d..8e72213
--- a/python/google/protobuf/internal/service_reflection_test.py
+++ b/python/google/protobuf/internal/service_reflection_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/symbol_database_test.py b/python/google/protobuf/internal/symbol_database_test.py
old mode 100755
new mode 100644
index 3c51aec..4fdc4ee
--- a/python/google/protobuf/internal/symbol_database_test.py
+++ b/python/google/protobuf/internal/symbol_database_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/text_encoding_test.py b/python/google/protobuf/internal/text_encoding_test.py
old mode 100755
new mode 100644
index 8f4351d..f36a2cc
--- a/python/google/protobuf/internal/text_encoding_test.py
+++ b/python/google/protobuf/internal/text_encoding_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/text_format_test.py b/python/google/protobuf/internal/text_format_test.py
old mode 100755
new mode 100644
index bb2d675..ec1ad52
--- a/python/google/protobuf/internal/text_format_test.py
+++ b/python/google/protobuf/internal/text_format_test.py
@@ -1,6 +1,4 @@
-#! /usr/bin/env python
 # -*- coding: utf-8 -*-
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
@@ -522,6 +520,35 @@
         '  type: TYPE_INT32\n'
         '  oneof_index: 0\n'
         '}\n'
+        'field {\n'
+        '  name: "map_field"\n'
+        '  number: 3\n'
+        '  label: LABEL_REPEATED\n'
+        '  type: TYPE_MESSAGE\n'
+        '  type_name: ".protobuf_unittest.TestMessageWithCustomOptions.'
+        'MapFieldEntry"\n'
+        '  options {\n'
+        '    [protobuf_unittest.field_opt1]: 12345\n'
+        '  }\n'
+        '}\n'
+        'nested_type {\n'
+        '  name: "MapFieldEntry"\n'
+        '  field {\n'
+        '    name: "key"\n'
+        '    number: 1\n'
+        '    label: LABEL_OPTIONAL\n'
+        '    type: TYPE_STRING\n'
+        '  }\n'
+        '  field {\n'
+        '    name: "value"\n'
+        '    number: 2\n'
+        '    label: LABEL_OPTIONAL\n'
+        '    type: TYPE_STRING\n'
+        '  }\n'
+        '  options {\n'
+        '    map_entry: true\n'
+        '  }\n'
+        '}\n'
         'enum_type {\n'
         '  name: "AnEnum"\n'
         '  value {\n'
diff --git a/python/google/protobuf/internal/unknown_fields_test.py b/python/google/protobuf/internal/unknown_fields_test.py
old mode 100755
new mode 100644
index 2e3372e..e8caf6b
--- a/python/google/protobuf/internal/unknown_fields_test.py
+++ b/python/google/protobuf/internal/unknown_fields_test.py
@@ -1,6 +1,4 @@
-#! /usr/bin/env python
 # -*- coding: utf-8 -*-
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/well_known_types.py b/python/google/protobuf/internal/well_known_types.py
index f14f152..30ff125 100644
--- a/python/google/protobuf/internal/well_known_types.py
+++ b/python/google/protobuf/internal/well_known_types.py
@@ -41,16 +41,10 @@
 __author__ = 'jieluo@google.com (Jie Luo)'
 
 import calendar
+import collections.abc
 from datetime import datetime
 from datetime import timedelta
 
-try:
-  # Since python 3
-  import collections.abc as collections_abc
-except ImportError:
-  # Won't work after python 3.8
-  import collections as collections_abc
-
 from google.protobuf.descriptor import FieldDescriptor
 
 _TIMESTAMPFOMAT = '%Y-%m-%dT%H:%M:%S'
@@ -806,7 +800,7 @@
     for key, value in dictionary.items():
       _SetStructValue(self.fields[key], value)
 
-collections_abc.MutableMapping.register(Struct)
+collections.abc.MutableMapping.register(Struct)
 
 
 class ListValue(object):
@@ -852,7 +846,7 @@
     list_value.Clear()
     return list_value
 
-collections_abc.MutableSequence.register(ListValue)
+collections.abc.MutableSequence.register(ListValue)
 
 
 WKTBASES = {
diff --git a/python/google/protobuf/internal/well_known_types_test.py b/python/google/protobuf/internal/well_known_types_test.py
old mode 100755
new mode 100644
index 156fa02..d2632f9
--- a/python/google/protobuf/internal/well_known_types_test.py
+++ b/python/google/protobuf/internal/well_known_types_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/internal/wire_format_test.py b/python/google/protobuf/internal/wire_format_test.py
old mode 100755
new mode 100644
index 5cd7fcb..f7ad0c7
--- a/python/google/protobuf/internal/wire_format_test.py
+++ b/python/google/protobuf/internal/wire_format_test.py
@@ -1,5 +1,3 @@
-#! /usr/bin/env python
-#
 # Protocol Buffers - Google's data interchange format
 # Copyright 2008 Google Inc.  All rights reserved.
 # https://developers.google.com/protocol-buffers/
diff --git a/python/google/protobuf/json_format.py b/python/google/protobuf/json_format.py
index b3e8593..21eb749 100644
--- a/python/google/protobuf/json_format.py
+++ b/python/google/protobuf/json_format.py
@@ -226,7 +226,7 @@
               else:
                 recorded_key = 'false'
             else:
-              recorded_key = key
+              recorded_key = str(key)
             js_map[recorded_key] = self._FieldToJsonObject(
                 v_field, value[key])
           js[name] = js_map
diff --git a/python/google/protobuf/message.py b/python/google/protobuf/message.py
index 224d2fc..ee46d0e 100644
--- a/python/google/protobuf/message.py
+++ b/python/google/protobuf/message.py
@@ -359,6 +359,14 @@
     """
     raise NotImplementedError
 
+  @classmethod
+  def FromString(cls, s):
+    raise NotImplementedError
+
+  @staticmethod
+  def RegisterExtension(extension_handle):
+    raise NotImplementedError
+
   def _SetListener(self, message_listener):
     """Internal method used by the protocol message implementation.
     Clients should not call this directly.
diff --git a/python/google/protobuf/proto_api.h b/python/google/protobuf/proto_api.h
index 2e2156a..9969a91 100644
--- a/python/google/protobuf/proto_api.h
+++ b/python/google/protobuf/proto_api.h
@@ -45,6 +45,7 @@
 #ifndef GOOGLE_PROTOBUF_PYTHON_PROTO_API_H__
 #define GOOGLE_PROTOBUF_PYTHON_PROTO_API_H__
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <google/protobuf/descriptor_database.h>
diff --git a/python/google/protobuf/pyext/descriptor.cc b/python/google/protobuf/pyext/descriptor.cc
index 8c326ef..a2993d9 100644
--- a/python/google/protobuf/pyext/descriptor.cc
+++ b/python/google/protobuf/pyext/descriptor.cc
@@ -32,6 +32,7 @@
 
 #include <google/protobuf/pyext/descriptor.h>
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <frameobject.h>
 
@@ -49,22 +50,12 @@
 #include <google/protobuf/pyext/scoped_pyobject_ptr.h>
 #include <google/protobuf/stubs/hash.h>
 
-#if PY_MAJOR_VERSION >= 3
-  #define PyString_FromStringAndSize PyUnicode_FromStringAndSize
-  #define PyString_Check PyUnicode_Check
-  #define PyString_InternFromString PyUnicode_InternFromString
-  #define PyInt_FromLong PyLong_FromLong
-  #define PyInt_FromSize_t PyLong_FromSize_t
-  #if PY_VERSION_HEX < 0x03030000
-    #error "Python 3.0 - 3.2 are not supported."
-  #endif
 #define PyString_AsStringAndSize(ob, charpp, sizep)                           \
   (PyUnicode_Check(ob) ? ((*(charpp) = const_cast<char*>(                     \
                                PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL \
                               ? -1                                            \
                               : 0)                                            \
                        : PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
-#endif
 
 namespace google {
 namespace protobuf {
@@ -79,7 +70,7 @@
 std::unordered_map<const void*, PyObject*>* interned_descriptors;
 
 PyObject* PyString_FromCppString(const std::string& str) {
-  return PyString_FromStringAndSize(str.c_str(), str.size());
+  return PyUnicode_FromStringAndSize(str.c_str(), str.size());
 }
 
 // Check that the calling Python code is the global scope of a _pb2.py module.
@@ -565,8 +556,8 @@
 
   for (int i = 0; i < descriptor->extension_range_count(); i++) {
     const Descriptor::ExtensionRange* range = descriptor->extension_range(i);
-    PyObject* start = PyInt_FromLong(range->start);
-    PyObject* end = PyInt_FromLong(range->end);
+    PyObject* start = PyLong_FromLong(range->start);
+    PyObject* end = PyLong_FromLong(range->end);
     PyList_SetItem(range_list, i, PyTuple_Pack(2, start, end));
   }
 
@@ -640,7 +631,7 @@
 }
 
 static PyObject* GetSyntax(PyBaseDescriptor *self, void *closure) {
-  return PyString_InternFromString(
+  return PyUnicode_InternFromString(
       FileDescriptor::SyntaxName(_GetDescriptor(self)->file()->syntax()));
 }
 
@@ -767,23 +758,23 @@
 }
 
 static PyObject* GetType(PyBaseDescriptor *self, void *closure) {
-  return PyInt_FromLong(_GetDescriptor(self)->type());
+  return PyLong_FromLong(_GetDescriptor(self)->type());
 }
 
 static PyObject* GetCppType(PyBaseDescriptor *self, void *closure) {
-  return PyInt_FromLong(_GetDescriptor(self)->cpp_type());
+  return PyLong_FromLong(_GetDescriptor(self)->cpp_type());
 }
 
 static PyObject* GetLabel(PyBaseDescriptor *self, void *closure) {
-  return PyInt_FromLong(_GetDescriptor(self)->label());
+  return PyLong_FromLong(_GetDescriptor(self)->label());
 }
 
 static PyObject* GetNumber(PyBaseDescriptor *self, void *closure) {
-  return PyInt_FromLong(_GetDescriptor(self)->number());
+  return PyLong_FromLong(_GetDescriptor(self)->number());
 }
 
 static PyObject* GetIndex(PyBaseDescriptor *self, void *closure) {
-  return PyInt_FromLong(_GetDescriptor(self)->index());
+  return PyLong_FromLong(_GetDescriptor(self)->index());
 }
 
 static PyObject* GetID(PyBaseDescriptor *self, void *closure) {
@@ -809,7 +800,7 @@
   switch (_GetDescriptor(self)->cpp_type()) {
     case FieldDescriptor::CPPTYPE_INT32: {
       int32_t value = _GetDescriptor(self)->default_value_int32();
-      result = PyInt_FromLong(value);
+      result = PyLong_FromLong(value);
       break;
     }
     case FieldDescriptor::CPPTYPE_INT64: {
@@ -819,7 +810,7 @@
     }
     case FieldDescriptor::CPPTYPE_UINT32: {
       uint32_t value = _GetDescriptor(self)->default_value_uint32();
-      result = PyInt_FromSize_t(value);
+      result = PyLong_FromSsize_t(value);
       break;
     }
     case FieldDescriptor::CPPTYPE_UINT64: {
@@ -850,7 +841,7 @@
     case FieldDescriptor::CPPTYPE_ENUM: {
       const EnumValueDescriptor* value =
           _GetDescriptor(self)->default_value_enum();
-      result = PyInt_FromLong(value->number());
+      result = PyLong_FromLong(value->number());
       break;
     }
     case FieldDescriptor::CPPTYPE_MESSAGE: {
@@ -1222,11 +1213,11 @@
 }
 
 static PyObject* GetNumber(PyBaseDescriptor *self, void *closure) {
-  return PyInt_FromLong(_GetDescriptor(self)->number());
+  return PyLong_FromLong(_GetDescriptor(self)->number());
 }
 
 static PyObject* GetIndex(PyBaseDescriptor *self, void *closure) {
-  return PyInt_FromLong(_GetDescriptor(self)->index());
+  return PyLong_FromLong(_GetDescriptor(self)->index());
 }
 
 static PyObject* GetType(PyBaseDescriptor *self, void *closure) {
@@ -1418,7 +1409,7 @@
 }
 
 static PyObject* GetSyntax(PyFileDescriptor *self, void *closure) {
-  return PyString_InternFromString(
+  return PyUnicode_InternFromString(
       FileDescriptor::SyntaxName(_GetDescriptor(self)->syntax()));
 }
 
@@ -1550,7 +1541,7 @@
 }
 
 static PyObject* GetIndex(PyBaseDescriptor *self, void *closure) {
-  return PyInt_FromLong(_GetDescriptor(self)->index());
+  return PyLong_FromLong(_GetDescriptor(self)->index());
 }
 
 static PyObject* GetFields(PyBaseDescriptor* self, void *closure) {
@@ -1676,7 +1667,7 @@
 }
 
 static PyObject* GetIndex(PyBaseDescriptor *self, void *closure) {
-  return PyInt_FromLong(_GetDescriptor(self)->index());
+  return PyLong_FromLong(_GetDescriptor(self)->index());
 }
 
 static PyObject* GetMethods(PyBaseDescriptor* self, void *closure) {
@@ -1799,7 +1790,7 @@
 }
 
 static PyObject* GetIndex(PyBaseDescriptor *self, void *closure) {
-  return PyInt_FromLong(_GetDescriptor(self)->index());
+  return PyLong_FromLong(_GetDescriptor(self)->index());
 }
 
 static PyObject* GetContainingService(PyBaseDescriptor *self, void *closure) {
@@ -1890,7 +1881,7 @@
                           const EnumDescriptor* enum_descriptor) {
   for (int i = 0; i < enum_descriptor->value_count(); ++i) {
     const EnumValueDescriptor* value = enum_descriptor->value(i);
-    ScopedPyObjectPtr obj(PyInt_FromLong(value->number()));
+    ScopedPyObjectPtr obj(PyLong_FromLong(value->number()));
     if (obj == NULL) {
       return false;
     }
@@ -1903,7 +1894,7 @@
 }
 
 static bool AddIntConstant(PyTypeObject *type, const char* name, int value) {
-  ScopedPyObjectPtr obj(PyInt_FromLong(value));
+  ScopedPyObjectPtr obj(PyLong_FromLong(value));
   if (PyDict_SetItemString(type->tp_dict, name, obj.get()) < 0) {
     return false;
   }
diff --git a/python/google/protobuf/pyext/descriptor.h b/python/google/protobuf/pyext/descriptor.h
index b99209d..d97e2f8 100644
--- a/python/google/protobuf/pyext/descriptor.h
+++ b/python/google/protobuf/pyext/descriptor.h
@@ -33,6 +33,7 @@
 #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_DESCRIPTOR_H__
 #define GOOGLE_PROTOBUF_PYTHON_CPP_DESCRIPTOR_H__
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <google/protobuf/descriptor.h>
diff --git a/python/google/protobuf/pyext/descriptor_containers.cc b/python/google/protobuf/pyext/descriptor_containers.cc
index c6ec258..4caff69 100644
--- a/python/google/protobuf/pyext/descriptor_containers.cc
+++ b/python/google/protobuf/pyext/descriptor_containers.cc
@@ -49,6 +49,7 @@
 // because the Python API is based on C, and does not play well with C++
 // inheritance.
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <google/protobuf/descriptor.h>
@@ -57,20 +58,12 @@
 #include <google/protobuf/pyext/descriptor.h>
 #include <google/protobuf/pyext/scoped_pyobject_ptr.h>
 
-#if PY_MAJOR_VERSION >= 3
-  #define PyString_FromStringAndSize PyUnicode_FromStringAndSize
-  #define PyString_FromFormat PyUnicode_FromFormat
-  #define PyInt_FromLong PyLong_FromLong
-  #if PY_VERSION_HEX < 0x03030000
-    #error "Python 3.0 - 3.2 are not supported."
-  #endif
 #define PyString_AsStringAndSize(ob, charpp, sizep)                           \
   (PyUnicode_Check(ob) ? ((*(charpp) = const_cast<char*>(                     \
                                PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL \
                               ? -1                                            \
                               : 0)                                            \
                        : PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
-#endif
 
 namespace google {
 namespace protobuf {
@@ -232,18 +225,18 @@
     case PyContainer::KIND_BYNAME:
       {
       const std::string& name(self->container_def->get_item_name_fn(item));
-      return PyString_FromStringAndSize(name.c_str(), name.size());
+      return PyUnicode_FromStringAndSize(name.c_str(), name.size());
       }
     case PyContainer::KIND_BYCAMELCASENAME:
       {
       const std::string& name(
           self->container_def->get_item_camelcase_name_fn(item));
-      return PyString_FromStringAndSize(name.c_str(), name.size());
+      return PyUnicode_FromStringAndSize(name.c_str(), name.size());
       }
     case PyContainer::KIND_BYNUMBER:
       {
         int value = self->container_def->get_item_number_fn(item);
-        return PyInt_FromLong(value);
+        return PyLong_FromLong(value);
       }
     default:
       PyErr_SetNone(PyExc_NotImplementedError);
@@ -320,8 +313,8 @@
       kind = "mapping by number";
       break;
   }
-  return PyString_FromFormat(
-      "<%s %s>", self->container_def->mapping_name, kind);
+  return PyUnicode_FromFormat("<%s %s>", self->container_def->mapping_name,
+                              kind);
 }
 
 extern PyTypeObject DescriptorMapping_Type;
@@ -678,7 +671,7 @@
     PyErr_SetNone(PyExc_ValueError);
     return NULL;
   } else {
-    return PyInt_FromLong(position);
+    return PyLong_FromLong(position);
   }
 }
 // Implements "list.__contains__()": is the object in the sequence.
@@ -696,9 +689,9 @@
 static PyObject* Count(PyContainer* self, PyObject* item) {
   int position = Find(self, item);
   if (position < 0) {
-    return PyInt_FromLong(0);
+    return PyLong_FromLong(0);
   } else {
-    return PyInt_FromLong(1);
+    return PyLong_FromLong(1);
   }
 }
 
diff --git a/python/google/protobuf/pyext/descriptor_containers.h b/python/google/protobuf/pyext/descriptor_containers.h
index 4e05c58..cf2cf4a 100644
--- a/python/google/protobuf/pyext/descriptor_containers.h
+++ b/python/google/protobuf/pyext/descriptor_containers.h
@@ -34,6 +34,7 @@
 // Mappings and Sequences of descriptors.
 // They implement containers like fields_by_name, EnumDescriptor.values...
 // See descriptor_containers.cc for more description.
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 namespace google {
diff --git a/python/google/protobuf/pyext/descriptor_database.h b/python/google/protobuf/pyext/descriptor_database.h
index d2d9f8e..3bc99e7 100644
--- a/python/google/protobuf/pyext/descriptor_database.h
+++ b/python/google/protobuf/pyext/descriptor_database.h
@@ -31,6 +31,7 @@
 #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_DESCRIPTOR_DATABASE_H__
 #define GOOGLE_PROTOBUF_PYTHON_CPP_DESCRIPTOR_DATABASE_H__
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <google/protobuf/descriptor_database.h>
diff --git a/python/google/protobuf/pyext/descriptor_pool.cc b/python/google/protobuf/pyext/descriptor_pool.cc
index 7154d31..f6bdb6e 100644
--- a/python/google/protobuf/pyext/descriptor_pool.cc
+++ b/python/google/protobuf/pyext/descriptor_pool.cc
@@ -32,6 +32,7 @@
 
 #include <unordered_map>
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <google/protobuf/descriptor.pb.h>
@@ -43,18 +44,12 @@
 #include <google/protobuf/pyext/scoped_pyobject_ptr.h>
 #include <google/protobuf/stubs/hash.h>
 
-#if PY_MAJOR_VERSION >= 3
-  #define PyString_FromStringAndSize PyUnicode_FromStringAndSize
-  #if PY_VERSION_HEX < 0x03030000
-    #error "Python 3.0 - 3.2 are not supported."
-  #endif
 #define PyString_AsStringAndSize(ob, charpp, sizep)                           \
   (PyUnicode_Check(ob) ? ((*(charpp) = const_cast<char*>(                     \
                                PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL \
                               ? -1                                            \
                               : 0)                                            \
                        : PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
-#endif
 
 namespace google {
 namespace protobuf {
diff --git a/python/google/protobuf/pyext/descriptor_pool.h b/python/google/protobuf/pyext/descriptor_pool.h
index 48658d3..5d3c3a9 100644
--- a/python/google/protobuf/pyext/descriptor_pool.h
+++ b/python/google/protobuf/pyext/descriptor_pool.h
@@ -31,6 +31,7 @@
 #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_DESCRIPTOR_POOL_H__
 #define GOOGLE_PROTOBUF_PYTHON_CPP_DESCRIPTOR_POOL_H__
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <unordered_map>
diff --git a/python/google/protobuf/pyext/extension_dict.cc b/python/google/protobuf/pyext/extension_dict.cc
index 37b414c..b36c723 100644
--- a/python/google/protobuf/pyext/extension_dict.cc
+++ b/python/google/protobuf/pyext/extension_dict.cc
@@ -49,17 +49,12 @@
 #include <google/protobuf/pyext/repeated_scalar_container.h>
 #include <google/protobuf/pyext/scoped_pyobject_ptr.h>
 
-#if PY_MAJOR_VERSION >= 3
-  #if PY_VERSION_HEX < 0x03030000
-    #error "Python 3.0 - 3.2 are not supported."
-  #endif
 #define PyString_AsStringAndSize(ob, charpp, sizep)                           \
   (PyUnicode_Check(ob) ? ((*(charpp) = const_cast<char*>(                     \
                                PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL \
                               ? -1                                            \
                               : 0)                                            \
                        : PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
-#endif
 
 namespace google {
 namespace protobuf {
diff --git a/python/google/protobuf/pyext/extension_dict.h b/python/google/protobuf/pyext/extension_dict.h
index c9da443..a058194 100644
--- a/python/google/protobuf/pyext/extension_dict.h
+++ b/python/google/protobuf/pyext/extension_dict.h
@@ -34,6 +34,7 @@
 #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_EXTENSION_DICT_H__
 #define GOOGLE_PROTOBUF_PYTHON_CPP_EXTENSION_DICT_H__
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <memory>
diff --git a/python/google/protobuf/pyext/field.cc b/python/google/protobuf/pyext/field.cc
index 1afd458..5eab3ef 100644
--- a/python/google/protobuf/pyext/field.cc
+++ b/python/google/protobuf/pyext/field.cc
@@ -34,10 +34,6 @@
 #include <google/protobuf/pyext/descriptor.h>
 #include <google/protobuf/pyext/message.h>
 
-#if PY_MAJOR_VERSION >= 3
-  #define PyString_FromFormat PyUnicode_FromFormat
-#endif
-
 namespace google {
 namespace protobuf {
 namespace python {
@@ -45,8 +41,8 @@
 namespace field {
 
 static PyObject* Repr(PyMessageFieldProperty* self) {
-  return PyString_FromFormat("<field property '%s'>",
-                             self->field_descriptor->full_name().c_str());
+  return PyUnicode_FromFormat("<field property '%s'>",
+                              self->field_descriptor->full_name().c_str());
 }
 
 static PyObject* DescrGet(PyMessageFieldProperty* self, PyObject* obj,
@@ -74,8 +70,8 @@
 }
 
 static PyObject* GetDoc(PyMessageFieldProperty* self, void* closure) {
-  return PyString_FromFormat("Field %s",
-                             self->field_descriptor->full_name().c_str());
+  return PyUnicode_FromFormat("Field %s",
+                              self->field_descriptor->full_name().c_str());
 }
 
 static PyGetSetDef Getters[] = {
diff --git a/python/google/protobuf/pyext/field.h b/python/google/protobuf/pyext/field.h
index 7b4660c..f9f94c4 100644
--- a/python/google/protobuf/pyext/field.h
+++ b/python/google/protobuf/pyext/field.h
@@ -31,6 +31,7 @@
 #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_FIELD_H__
 #define GOOGLE_PROTOBUF_PYTHON_CPP_FIELD_H__
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 namespace google {
diff --git a/python/google/protobuf/pyext/map_container.cc b/python/google/protobuf/pyext/map_container.cc
index 1c2c526..053a78e 100644
--- a/python/google/protobuf/pyext/map_container.cc
+++ b/python/google/protobuf/pyext/map_container.cc
@@ -46,11 +46,6 @@
 #include <google/protobuf/pyext/scoped_pyobject_ptr.h>
 #include <google/protobuf/stubs/map_util.h>
 
-#if PY_MAJOR_VERSION >= 3
-  #define PyInt_FromLong PyLong_FromLong
-  #define PyInt_FromSize_t PyLong_FromSize_t
-#endif
-
 namespace google {
 namespace protobuf {
 namespace python {
@@ -177,11 +172,11 @@
       self->parent_field_descriptor->message_type()->map_key();
   switch (field_descriptor->cpp_type()) {
     case FieldDescriptor::CPPTYPE_INT32:
-      return PyInt_FromLong(key.GetInt32Value());
+      return PyLong_FromLong(key.GetInt32Value());
     case FieldDescriptor::CPPTYPE_INT64:
       return PyLong_FromLongLong(key.GetInt64Value());
     case FieldDescriptor::CPPTYPE_UINT32:
-      return PyInt_FromSize_t(key.GetUInt32Value());
+      return PyLong_FromSize_t(key.GetUInt32Value());
     case FieldDescriptor::CPPTYPE_UINT64:
       return PyLong_FromUnsignedLongLong(key.GetUInt64Value());
     case FieldDescriptor::CPPTYPE_BOOL:
@@ -203,11 +198,11 @@
       self->parent_field_descriptor->message_type()->map_value();
   switch (field_descriptor->cpp_type()) {
     case FieldDescriptor::CPPTYPE_INT32:
-      return PyInt_FromLong(value.GetInt32Value());
+      return PyLong_FromLong(value.GetInt32Value());
     case FieldDescriptor::CPPTYPE_INT64:
       return PyLong_FromLongLong(value.GetInt64Value());
     case FieldDescriptor::CPPTYPE_UINT32:
-      return PyInt_FromSize_t(value.GetUInt32Value());
+      return PyLong_FromSize_t(value.GetUInt32Value());
     case FieldDescriptor::CPPTYPE_UINT64:
       return PyLong_FromUnsignedLongLong(value.GetUInt64Value());
     case FieldDescriptor::CPPTYPE_FLOAT:
@@ -219,7 +214,7 @@
     case FieldDescriptor::CPPTYPE_STRING:
       return ToStringObject(field_descriptor, value.GetStringValue());
     case FieldDescriptor::CPPTYPE_ENUM:
-      return PyInt_FromLong(value.GetEnumValue());
+      return PyLong_FromLong(value.GetEnumValue());
     default:
       PyErr_Format(
           PyExc_SystemError, "Couldn't convert type %d to value",
@@ -550,73 +545,21 @@
     {NULL, NULL},
 };
 
-PyTypeObject *ScalarMapContainer_Type;
-#if PY_MAJOR_VERSION >= 3
-  static PyType_Slot ScalarMapContainer_Type_slots[] = {
-      {Py_tp_dealloc, (void *)ScalarMapDealloc},
-      {Py_mp_length, (void *)MapReflectionFriend::Length},
-      {Py_mp_subscript, (void *)MapReflectionFriend::ScalarMapGetItem},
-      {Py_mp_ass_subscript, (void *)MapReflectionFriend::ScalarMapSetItem},
-      {Py_tp_methods, (void *)ScalarMapMethods},
-      {Py_tp_iter, (void *)MapReflectionFriend::GetIterator},
-      {Py_tp_repr, (void *)MapReflectionFriend::ScalarMapToStr},
-      {0, 0},
-  };
+PyTypeObject* ScalarMapContainer_Type;
+static PyType_Slot ScalarMapContainer_Type_slots[] = {
+    {Py_tp_dealloc, (void*)ScalarMapDealloc},
+    {Py_mp_length, (void*)MapReflectionFriend::Length},
+    {Py_mp_subscript, (void*)MapReflectionFriend::ScalarMapGetItem},
+    {Py_mp_ass_subscript, (void*)MapReflectionFriend::ScalarMapSetItem},
+    {Py_tp_methods, (void*)ScalarMapMethods},
+    {Py_tp_iter, (void*)MapReflectionFriend::GetIterator},
+    {Py_tp_repr, (void*)MapReflectionFriend::ScalarMapToStr},
+    {0, 0},
+};
 
-  PyType_Spec ScalarMapContainer_Type_spec = {
-      FULL_MODULE_NAME ".ScalarMapContainer",
-      sizeof(MapContainer),
-      0,
-      Py_TPFLAGS_DEFAULT,
-      ScalarMapContainer_Type_slots
-  };
-#else
-  static PyMappingMethods ScalarMapMappingMethods = {
-    MapReflectionFriend::Length,             // mp_length
-    MapReflectionFriend::ScalarMapGetItem,   // mp_subscript
-    MapReflectionFriend::ScalarMapSetItem,   // mp_ass_subscript
-  };
-
-  PyTypeObject _ScalarMapContainer_Type = {
-    PyVarObject_HEAD_INIT(&PyType_Type, 0)
-    FULL_MODULE_NAME ".ScalarMapContainer",  //  tp_name
-    sizeof(MapContainer),                //  tp_basicsize
-    0,                                   //  tp_itemsize
-    ScalarMapDealloc,                    //  tp_dealloc
-    0,                                   //  tp_print
-    0,                                   //  tp_getattr
-    0,                                   //  tp_setattr
-    0,                                   //  tp_compare
-    MapReflectionFriend::ScalarMapToStr,  //  tp_repr
-    0,                                   //  tp_as_number
-    0,                                   //  tp_as_sequence
-    &ScalarMapMappingMethods,            //  tp_as_mapping
-    0,                                   //  tp_hash
-    0,                                   //  tp_call
-    0,                                   //  tp_str
-    0,                                   //  tp_getattro
-    0,                                   //  tp_setattro
-    0,                                   //  tp_as_buffer
-    Py_TPFLAGS_DEFAULT,                  //  tp_flags
-    "A scalar map container",            //  tp_doc
-    0,                                   //  tp_traverse
-    0,                                   //  tp_clear
-    0,                                   //  tp_richcompare
-    0,                                   //  tp_weaklistoffset
-    MapReflectionFriend::GetIterator,    //  tp_iter
-    0,                                   //  tp_iternext
-    ScalarMapMethods,                    //  tp_methods
-    0,                                   //  tp_members
-    0,                                   //  tp_getset
-    0,                                   //  tp_base
-    0,                                   //  tp_dict
-    0,                                   //  tp_descr_get
-    0,                                   //  tp_descr_set
-    0,                                   //  tp_dictoffset
-    0,                                   //  tp_init
-  };
-#endif
-
+PyType_Spec ScalarMapContainer_Type_spec = {
+    FULL_MODULE_NAME ".ScalarMapContainer", sizeof(MapContainer), 0,
+    Py_TPFLAGS_DEFAULT, ScalarMapContainer_Type_slots};
 
 // MessageMap //////////////////////////////////////////////////////////////////
 
@@ -819,72 +762,20 @@
     {NULL, NULL},
 };
 
-PyTypeObject *MessageMapContainer_Type;
-#if PY_MAJOR_VERSION >= 3
-  static PyType_Slot MessageMapContainer_Type_slots[] = {
-      {Py_tp_dealloc, (void *)MessageMapDealloc},
-      {Py_mp_length, (void *)MapReflectionFriend::Length},
-      {Py_mp_subscript, (void *)MapReflectionFriend::MessageMapGetItem},
-      {Py_mp_ass_subscript, (void *)MapReflectionFriend::MessageMapSetItem},
-      {Py_tp_methods, (void *)MessageMapMethods},
-      {Py_tp_iter, (void *)MapReflectionFriend::GetIterator},
-      {Py_tp_repr, (void *)MapReflectionFriend::MessageMapToStr},
-      {0, 0}
-  };
+PyTypeObject* MessageMapContainer_Type;
+static PyType_Slot MessageMapContainer_Type_slots[] = {
+    {Py_tp_dealloc, (void*)MessageMapDealloc},
+    {Py_mp_length, (void*)MapReflectionFriend::Length},
+    {Py_mp_subscript, (void*)MapReflectionFriend::MessageMapGetItem},
+    {Py_mp_ass_subscript, (void*)MapReflectionFriend::MessageMapSetItem},
+    {Py_tp_methods, (void*)MessageMapMethods},
+    {Py_tp_iter, (void*)MapReflectionFriend::GetIterator},
+    {Py_tp_repr, (void*)MapReflectionFriend::MessageMapToStr},
+    {0, 0}};
 
-  PyType_Spec MessageMapContainer_Type_spec = {
-      FULL_MODULE_NAME ".MessageMapContainer",
-      sizeof(MessageMapContainer),
-      0,
-      Py_TPFLAGS_DEFAULT,
-      MessageMapContainer_Type_slots
-  };
-#else
-  static PyMappingMethods MessageMapMappingMethods = {
-    MapReflectionFriend::Length,              // mp_length
-    MapReflectionFriend::MessageMapGetItem,   // mp_subscript
-    MapReflectionFriend::MessageMapSetItem,   // mp_ass_subscript
-  };
-
-  PyTypeObject _MessageMapContainer_Type = {
-    PyVarObject_HEAD_INIT(&PyType_Type, 0)
-    FULL_MODULE_NAME ".MessageMapContainer",  //  tp_name
-    sizeof(MessageMapContainer),         //  tp_basicsize
-    0,                                   //  tp_itemsize
-    MessageMapDealloc,                   //  tp_dealloc
-    0,                                   //  tp_print
-    0,                                   //  tp_getattr
-    0,                                   //  tp_setattr
-    0,                                   //  tp_compare
-    MapReflectionFriend::MessageMapToStr,  //  tp_repr
-    0,                                   //  tp_as_number
-    0,                                   //  tp_as_sequence
-    &MessageMapMappingMethods,           //  tp_as_mapping
-    0,                                   //  tp_hash
-    0,                                   //  tp_call
-    0,                                   //  tp_str
-    0,                                   //  tp_getattro
-    0,                                   //  tp_setattro
-    0,                                   //  tp_as_buffer
-    Py_TPFLAGS_DEFAULT,                  //  tp_flags
-    "A map container for message",       //  tp_doc
-    0,                                   //  tp_traverse
-    0,                                   //  tp_clear
-    0,                                   //  tp_richcompare
-    0,                                   //  tp_weaklistoffset
-    MapReflectionFriend::GetIterator,    //  tp_iter
-    0,                                   //  tp_iternext
-    MessageMapMethods,                   //  tp_methods
-    0,                                   //  tp_members
-    0,                                   //  tp_getset
-    0,                                   //  tp_base
-    0,                                   //  tp_dict
-    0,                                   //  tp_descr_get
-    0,                                   //  tp_descr_set
-    0,                                   //  tp_dictoffset
-    0,                                   //  tp_init
-  };
-#endif
+PyType_Spec MessageMapContainer_Type_spec = {
+    FULL_MODULE_NAME ".MessageMapContainer", sizeof(MessageMapContainer), 0,
+    Py_TPFLAGS_DEFAULT, MessageMapContainer_Type_slots};
 
 // MapIterator /////////////////////////////////////////////////////////////////
 
@@ -1001,20 +892,18 @@
 
 bool InitMapContainers() {
   // ScalarMapContainer_Type derives from our MutableMapping type.
-  ScopedPyObjectPtr containers(PyImport_ImportModule(
-      "google.protobuf.internal.containers"));
-  if (containers == NULL) {
+  ScopedPyObjectPtr abc(PyImport_ImportModule("collections.abc"));
+  if (abc == NULL) {
     return false;
   }
 
   ScopedPyObjectPtr mutable_mapping(
-      PyObject_GetAttrString(containers.get(), "MutableMapping"));
+      PyObject_GetAttrString(abc.get(), "MutableMapping"));
   if (mutable_mapping == NULL) {
     return false;
   }
 
   Py_INCREF(mutable_mapping.get());
-#if PY_MAJOR_VERSION >= 3
   ScopedPyObjectPtr bases(PyTuple_Pack(1, mutable_mapping.get()));
   if (bases == NULL) {
     return false;
@@ -1022,35 +911,13 @@
 
   ScalarMapContainer_Type = reinterpret_cast<PyTypeObject*>(
       PyType_FromSpecWithBases(&ScalarMapContainer_Type_spec, bases.get()));
-#else
-  _ScalarMapContainer_Type.tp_base =
-      reinterpret_cast<PyTypeObject*>(mutable_mapping.get());
-
-  if (PyType_Ready(&_ScalarMapContainer_Type) < 0) {
-    return false;
-  }
-
-  ScalarMapContainer_Type = &_ScalarMapContainer_Type;
-#endif
 
   if (PyType_Ready(&MapIterator_Type) < 0) {
     return false;
   }
 
-#if PY_MAJOR_VERSION >= 3
   MessageMapContainer_Type = reinterpret_cast<PyTypeObject*>(
       PyType_FromSpecWithBases(&MessageMapContainer_Type_spec, bases.get()));
-#else
-  Py_INCREF(mutable_mapping.get());
-  _MessageMapContainer_Type.tp_base =
-      reinterpret_cast<PyTypeObject*>(mutable_mapping.get());
-
-  if (PyType_Ready(&_MessageMapContainer_Type) < 0) {
-    return false;
-  }
-
-  MessageMapContainer_Type = &_MessageMapContainer_Type;
-#endif
   return true;
 }
 
diff --git a/python/google/protobuf/pyext/map_container.h b/python/google/protobuf/pyext/map_container.h
index 842602e..e14136e 100644
--- a/python/google/protobuf/pyext/map_container.h
+++ b/python/google/protobuf/pyext/map_container.h
@@ -31,6 +31,7 @@
 #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_MAP_CONTAINER_H__
 #define GOOGLE_PROTOBUF_PYTHON_CPP_MAP_CONTAINER_H__
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <cstdint>
diff --git a/python/google/protobuf/pyext/message.cc b/python/google/protobuf/pyext/message.cc
index 34816ee..cb48faa 100644
--- a/python/google/protobuf/pyext/message.cc
+++ b/python/google/protobuf/pyext/message.cc
@@ -77,27 +77,14 @@
 #include <google/protobuf/port_def.inc>
 // clang-format on
 
-#if PY_MAJOR_VERSION >= 3
-  #define PyInt_AsLong PyLong_AsLong
-  #define PyInt_FromLong PyLong_FromLong
-  #define PyInt_FromSize_t PyLong_FromSize_t
-  #define PyString_Check PyUnicode_Check
-  #define PyString_FromString PyUnicode_FromString
-  #define PyString_FromStringAndSize PyUnicode_FromStringAndSize
-  #define PyString_FromFormat PyUnicode_FromFormat
-  #if PY_VERSION_HEX < 0x03030000
-    #error "Python 3.0 - 3.2 are not supported."
-  #else
-  #define PyString_AsString(ob) \
-    (PyUnicode_Check(ob)? PyUnicode_AsUTF8(ob): PyBytes_AsString(ob))
+#define PyString_AsString(ob) \
+  (PyUnicode_Check(ob) ? PyUnicode_AsUTF8(ob) : PyBytes_AsString(ob))
 #define PyString_AsStringAndSize(ob, charpp, sizep)                           \
   (PyUnicode_Check(ob) ? ((*(charpp) = const_cast<char*>(                     \
                                PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL \
                               ? -1                                            \
                               : 0)                                            \
                        : PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
-#endif
-#endif
 
 namespace google {
 namespace protobuf {
@@ -110,9 +97,10 @@
       const std::vector<const FieldDescriptor*>& fields) {
     lhs->GetReflection()->UnsafeShallowSwapFields(lhs, rhs, fields);
   }
-  static bool IsLazyField(const Reflection* reflection,
+  static bool IsLazyField(const Reflection* reflection, const Message& message,
                           const FieldDescriptor* field) {
-    return reflection->IsLazyField(field);
+    return reflection->IsLazyField(field) ||
+           reflection->IsLazyExtension(message, field);
   }
 };
 
@@ -124,8 +112,6 @@
 
 namespace message_meta {
 
-static int InsertEmptyWeakref(PyTypeObject* base);
-
 namespace {
 // Copied over from internal 'google/protobuf/stubs/strutil.h'.
 inline void LowerString(std::string* s) {
@@ -175,8 +161,8 @@
     for (int j = 0; j < enum_descriptor->value_count(); ++j) {
       const EnumValueDescriptor* enum_value_descriptor =
           enum_descriptor->value(j);
-      ScopedPyObjectPtr value_number(PyInt_FromLong(
-          enum_value_descriptor->number()));
+      ScopedPyObjectPtr value_number(
+          PyLong_FromLong(enum_value_descriptor->number()));
       if (value_number == NULL) {
         return -1;
       }
@@ -286,13 +272,6 @@
   }
   CMessageClass* newtype = reinterpret_cast<CMessageClass*>(result.get());
 
-  // Insert the empty weakref into the base classes.
-  if (InsertEmptyWeakref(
-          reinterpret_cast<PyTypeObject*>(PythonMessage_class)) < 0 ||
-      InsertEmptyWeakref(CMessage_Type) < 0) {
-    return NULL;
-  }
-
   // Cache the descriptor, both as Python object and as C++ pointer.
   const Descriptor* descriptor =
       PyMessageDescriptor_AsDescriptor(py_descriptor);
@@ -347,32 +326,6 @@
   return PyType_Type.tp_clear(pself);
 }
 
-// This function inserts and empty weakref at the end of the list of
-// subclasses for the main protocol buffer Message class.
-//
-// This eliminates a O(n^2) behaviour in the internal add_subclass
-// routine.
-static int InsertEmptyWeakref(PyTypeObject *base_type) {
-#if PY_MAJOR_VERSION >= 3
-  // Python 3.4 has already included the fix for the issue that this
-  // hack addresses. For further background and the fix please see
-  // https://bugs.python.org/issue17936.
-  return 0;
-#else
-#ifdef Py_DEBUG
-  // The code below causes all new subclasses to append an entry, which is never
-  // cleared. This is a small memory leak, which we disable in Py_DEBUG mode
-  // to have stable refcounting checks.
-#else
-  PyObject *subclasses = base_type->tp_subclasses;
-  if (subclasses && PyList_CheckExact(subclasses)) {
-    return PyList_Append(subclasses, kEmptyWeakref);
-  }
-#endif  // !Py_DEBUG
-  return 0;
-#endif  // PY_MAJOR_VERSION >= 3
-}
-
 // The _extensions_by_name dictionary is built on every access.
 // TODO(amauryfa): Migrate all users to pool.FindAllExtensions()
 static PyObject* GetExtensionsByName(CMessageClass *self, void *closure) {
@@ -425,7 +378,7 @@
     if (extension == NULL) {
       return NULL;
     }
-    ScopedPyObjectPtr number(PyInt_FromLong(extensions[i]->number()));
+    ScopedPyObjectPtr number(PyLong_FromLong(extensions[i]->number()));
     if (number == NULL) {
       return NULL;
     }
@@ -463,7 +416,7 @@
           self->message_descriptor->FindExtensionByLowercaseName(field_name);
     }
     if (field) {
-      return PyInt_FromLong(field->number());
+      return PyLong_FromLong(field->number());
     }
   }
   PyErr_SetObject(PyExc_AttributeError, name);
@@ -616,20 +569,6 @@
 
 template <class T>
 bool CheckAndGetInteger(PyObject* arg, T* value) {
-  // The fast path.
-#if PY_MAJOR_VERSION < 3
-  // For the typical case, offer a fast path.
-  if (PROTOBUF_PREDICT_TRUE(PyInt_Check(arg))) {
-    long int_result = PyInt_AsLong(arg);
-    if (PROTOBUF_PREDICT_TRUE(IsValidNumericCast<T>(int_result))) {
-      *value = static_cast<T>(int_result);
-      return true;
-    } else {
-      OutOfRangeError(arg);
-      return false;
-    }
-  }
-#endif
   // This effectively defines an integer as "an object that can be cast as
   // an integer and can be used as an ordinal number".
   // This definition includes everything that implements numbers.Integral
@@ -719,7 +658,7 @@
 }
 
 bool CheckAndGetBool(PyObject* arg, bool* value) {
-  long long_value = PyInt_AsLong(arg);
+  long long_value = PyLong_AsLong(arg);  // NOLINT
   if (long_value == -1 && PyErr_Occurred()) {
     FormatTypeError(arg, "int, long, bool");
     return false;
@@ -976,7 +915,7 @@
 // descriptor, otherwise simply return value.  Always returns a new reference.
 static PyObject* GetIntegerEnumValue(const FieldDescriptor& descriptor,
                                      PyObject* value) {
-  if (PyString_Check(value) || PyUnicode_Check(value)) {
+  if (PyUnicode_Check(value)) {
     const EnumDescriptor* enum_descriptor = descriptor.enum_type();
     if (enum_descriptor == NULL) {
       PyErr_SetString(PyExc_TypeError, "not an enum field");
@@ -993,7 +932,7 @@
       PyErr_Format(PyExc_ValueError, "unknown enum label \"%s\"", enum_label);
       return NULL;
     }
-    return PyInt_FromLong(enum_value_descriptor->number());
+    return PyLong_FromLong(enum_value_descriptor->number());
   }
   Py_INCREF(value);
   return value;
@@ -1015,15 +954,7 @@
 
   if (PySlice_Check(slice)) {
     from = to = step = slice_length = 0;
-#if PY_MAJOR_VERSION < 3
-    PySlice_GetIndicesEx(
-        reinterpret_cast<PySliceObject*>(slice),
-        length, &from, &to, &step, &slice_length);
-#else
-    PySlice_GetIndicesEx(
-        slice,
-        length, &from, &to, &step, &slice_length);
-#endif
+    PySlice_GetIndicesEx(slice, length, &from, &to, &step, &slice_length);
     if (from < to) {
       min = from;
       max = to - 1;
@@ -1120,7 +1051,7 @@
   PyObject* name;
   PyObject* value;
   while (PyDict_Next(kwargs, &pos, &name, &value)) {
-    if (!(PyString_Check(name) || PyUnicode_Check(name))) {
+    if (!(PyUnicode_Check(name))) {
       PyErr_SetString(PyExc_ValueError, "Field name must be a string");
       return -1;
     }
@@ -1395,7 +1326,7 @@
     if (initialization_errors == NULL) {
       return NULL;
     }
-    ScopedPyObjectPtr extend_name(PyString_FromString("extend"));
+    ScopedPyObjectPtr extend_name(PyUnicode_FromString("extend"));
     if (extend_name == NULL) {
       return NULL;
     }
@@ -1468,16 +1399,10 @@
 PyObject* HasField(CMessage* self, PyObject* arg) {
   char* field_name;
   Py_ssize_t size;
-#if PY_MAJOR_VERSION < 3
-  if (PyString_AsStringAndSize(arg, &field_name, &size) < 0) {
-    return NULL;
-  }
-#else
   field_name = const_cast<char*>(PyUnicode_AsUTF8AndSize(arg, &size));
   if (!field_name) {
     return NULL;
   }
-#endif
 
   Message* message = self->message;
   bool is_in_oneof;
@@ -1745,7 +1670,7 @@
     if (errors == NULL) {
       return NULL;
     }
-    ScopedPyObjectPtr comma(PyString_FromString(","));
+    ScopedPyObjectPtr comma(PyUnicode_FromString(","));
     if (comma == NULL) {
       return NULL;
     }
@@ -1871,7 +1796,7 @@
     PyErr_SetString(PyExc_ValueError, "Unable to convert message to str");
     return NULL;
   }
-  return PyString_FromString(output.c_str());
+  return PyUnicode_FromString(output.c_str());
 }
 
 PyObject* MergeFrom(CMessage* self, PyObject* arg) {
@@ -1994,7 +1919,9 @@
   // explicit in our correctness checks.
   if (ptr == nullptr || ctx.BytesUntilLimit(ptr) < 0) {
     // Parse error or the parser overshoot the limit.
-    PyErr_Format(DecodeError_class, "Error parsing message");
+    PyErr_Format(
+        DecodeError_class, "Error parsing message with type '%s'",
+        self->GetMessageClass()->message_descriptor->full_name().c_str());
     return NULL;
   }
   // ctx has an explicit limit set (length of string_view), so we have to
@@ -2003,9 +1930,9 @@
     // TODO(jieluo): Raise error and return NULL instead.
     // b/27494216
     PyErr_Warn(nullptr, "Unexpected end-group tag: Not all data was converted");
-    return PyInt_FromLong(data.len - ctx.BytesUntilLimit(ptr));
+    return PyLong_FromLong(data.len - ctx.BytesUntilLimit(ptr));
   }
-  return PyInt_FromLong(data.len);
+  return PyLong_FromLong(data.len);
 }
 
 static PyObject* ParseFromString(CMessage* self, PyObject* arg) {
@@ -2070,7 +1997,7 @@
     Py_RETURN_NONE;
   } else {
     const std::string& name = field_in_oneof->name();
-    return PyString_FromStringAndSize(name.c_str(), name.size());
+    return PyUnicode_FromStringAndSize(name.c_str(), name.size());
   }
 }
 
@@ -2170,8 +2097,8 @@
   }
   for (size_t i = 0; i < errors.size(); ++i) {
     const std::string& error = errors[i];
-    PyObject* error_string = PyString_FromStringAndSize(
-        error.c_str(), error.length());
+    PyObject* error_string =
+        PyUnicode_FromStringAndSize(error.c_str(), error.length());
     if (error_string == NULL) {
       Py_DECREF(error_list);
       return NULL;
@@ -2227,7 +2154,7 @@
   switch (field_descriptor->cpp_type()) {
     case FieldDescriptor::CPPTYPE_INT32: {
       int32_t value = reflection->GetInt32(*message, field_descriptor);
-      result = PyInt_FromLong(value);
+      result = PyLong_FromLong(value);
       break;
     }
     case FieldDescriptor::CPPTYPE_INT64: {
@@ -2237,7 +2164,7 @@
     }
     case FieldDescriptor::CPPTYPE_UINT32: {
       uint32_t value = reflection->GetUInt32(*message, field_descriptor);
-      result = PyInt_FromSize_t(value);
+      result = PyLong_FromSsize_t(value);
       break;
     }
     case FieldDescriptor::CPPTYPE_UINT64: {
@@ -2270,7 +2197,7 @@
     case FieldDescriptor::CPPTYPE_ENUM: {
       const EnumValueDescriptor* enum_value =
           message->GetReflection()->GetEnum(*message, field_descriptor);
-      result = PyInt_FromLong(enum_value->number());
+      result = PyLong_FromLong(enum_value->number());
       break;
     }
     default:
@@ -2305,7 +2232,8 @@
   cmsg->parent_field_descriptor = field_descriptor;
   if (reflection->HasField(*self->message, field_descriptor)) {
     // Force triggering MutableMessage to set the lazy message 'Dirty'
-    if (MessageReflectionFriend::IsLazyField(reflection, field_descriptor)) {
+    if (MessageReflectionFriend::IsLazyField(reflection, *self->message,
+                                             field_descriptor)) {
       Message* sub_message = reflection->MutableMessage(
           self->message, field_descriptor, factory->message_factory);
       cmsg->read_only = false;
@@ -2459,7 +2387,7 @@
   if (text_format == NULL) {
     return NULL;
   }
-  ScopedPyObjectPtr method_name(PyString_FromString("MessageToString"));
+  ScopedPyObjectPtr method_name(PyUnicode_FromString("MessageToString"));
   if (method_name == NULL) {
     return NULL;
   }
@@ -2470,11 +2398,7 @@
   if (encoded == NULL) {
     return NULL;
   }
-#if PY_MAJOR_VERSION < 3
-  PyObject* decoded = PyString_AsDecodedObject(encoded.get(), "utf-8", NULL);
-#else
   PyObject* decoded = PyUnicode_FromEncodedObject(encoded.get(), "utf-8", NULL);
-#endif
   if (decoded == NULL) {
     return NULL;
   }
@@ -2964,7 +2888,7 @@
   // TODO(gps): Check all return values in this function for NULL and propagate
   // the error (MemoryError) on up to result in an import failure.  These should
   // also be freed and reset to NULL during finalization.
-  kDESCRIPTOR = PyString_FromString("DESCRIPTOR");
+  kDESCRIPTOR = PyUnicode_FromString("DESCRIPTOR");
 
   PyObject *dummy_obj = PySet_New(NULL);
   kEmptyWeakref = PyWeakref_NewRef(dummy_obj, NULL);
@@ -3033,11 +2957,7 @@
         reinterpret_cast<PyObject*>(&RepeatedCompositeContainer_Type));
 
     // Register them as MutableSequence.
-#if PY_MAJOR_VERSION >= 3
     ScopedPyObjectPtr collections(PyImport_ImportModule("collections.abc"));
-#else
-    ScopedPyObjectPtr collections(PyImport_ImportModule("collections"));
-#endif
     if (collections == NULL) {
       return false;
     }
diff --git a/python/google/protobuf/pyext/message.h b/python/google/protobuf/pyext/message.h
index 29af255..b17daa5 100644
--- a/python/google/protobuf/pyext/message.h
+++ b/python/google/protobuf/pyext/message.h
@@ -34,6 +34,7 @@
 #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_MESSAGE_H__
 #define GOOGLE_PROTOBUF_PYTHON_CPP_MESSAGE_H__
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <cstdint>
diff --git a/python/google/protobuf/pyext/message_factory.cc b/python/google/protobuf/pyext/message_factory.cc
index 7905be0..5098379 100644
--- a/python/google/protobuf/pyext/message_factory.cc
+++ b/python/google/protobuf/pyext/message_factory.cc
@@ -30,6 +30,7 @@
 
 #include <unordered_map>
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <google/protobuf/dynamic_message.h>
@@ -38,17 +39,12 @@
 #include <google/protobuf/pyext/message_factory.h>
 #include <google/protobuf/pyext/scoped_pyobject_ptr.h>
 
-#if PY_MAJOR_VERSION >= 3
-  #if PY_VERSION_HEX < 0x03030000
-    #error "Python 3.0 - 3.2 are not supported."
-  #endif
-  #define PyString_AsStringAndSize(ob, charpp, sizep) \
-    (PyUnicode_Check(ob) ? ((*(charpp) = const_cast<char*>(                   \
+#define PyString_AsStringAndSize(ob, charpp, sizep)                           \
+  (PyUnicode_Check(ob) ? ((*(charpp) = const_cast<char*>(                     \
                                PyUnicode_AsUTF8AndSize(ob, (sizep)))) == NULL \
                               ? -1                                            \
                               : 0)                                            \
-                        : PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
-#endif
+                       : PyBytes_AsStringAndSize(ob, (charpp), (sizep)))
 
 namespace google {
 namespace protobuf {
diff --git a/python/google/protobuf/pyext/message_factory.h b/python/google/protobuf/pyext/message_factory.h
index 515c29c..7dfe425 100644
--- a/python/google/protobuf/pyext/message_factory.h
+++ b/python/google/protobuf/pyext/message_factory.h
@@ -31,6 +31,7 @@
 #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_MESSAGE_FACTORY_H__
 #define GOOGLE_PROTOBUF_PYTHON_CPP_MESSAGE_FACTORY_H__
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <unordered_map>
diff --git a/python/google/protobuf/pyext/message_module.cc b/python/google/protobuf/pyext/message_module.cc
index 4125dd7..a0806a3 100644
--- a/python/google/protobuf/pyext/message_module.cc
+++ b/python/google/protobuf/pyext/message_module.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.
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <google/protobuf/message_lite.h>
@@ -95,7 +96,6 @@
     // DO NOT USE: For migration and testing only.
     {NULL, NULL}};
 
-#if PY_MAJOR_VERSION >= 3
 static struct PyModuleDef _module = {PyModuleDef_HEAD_INIT,
                                      "_message",
                                      module_docstring,
@@ -105,27 +105,17 @@
                                      NULL,
                                      NULL,
                                      NULL};
-#define INITFUNC PyInit__message
-#define INITFUNC_ERRORVAL NULL
-#else  // Python 2
-#define INITFUNC init_message
-#define INITFUNC_ERRORVAL
-#endif
 
-PyMODINIT_FUNC INITFUNC() {
+PyMODINIT_FUNC PyInit__message() {
   PyObject* m;
-#if PY_MAJOR_VERSION >= 3
   m = PyModule_Create(&_module);
-#else
-  m = Py_InitModule3("_message", ModuleMethods, module_docstring);
-#endif
   if (m == NULL) {
-    return INITFUNC_ERRORVAL;
+    return NULL;
   }
 
   if (!google::protobuf::python::InitProto2MessageModule(m)) {
     Py_DECREF(m);
-    return INITFUNC_ERRORVAL;
+    return NULL;
   }
 
   // Adds the C++ API
@@ -137,10 +127,8 @@
           })) {
     PyModule_AddObject(m, "proto_API", api);
   } else {
-    return INITFUNC_ERRORVAL;
+    return NULL;
   }
 
-#if PY_MAJOR_VERSION >= 3
   return m;
-#endif
 }
diff --git a/python/google/protobuf/pyext/repeated_composite_container.cc b/python/google/protobuf/pyext/repeated_composite_container.cc
index f3d6fc3..2e8ff4b 100644
--- a/python/google/protobuf/pyext/repeated_composite_container.cc
+++ b/python/google/protobuf/pyext/repeated_composite_container.cc
@@ -48,12 +48,6 @@
 #include <google/protobuf/reflection.h>
 #include <google/protobuf/stubs/map_util.h>
 
-#if PY_MAJOR_VERSION >= 3
-  #define PyInt_Check PyLong_Check
-  #define PyInt_AsLong PyLong_AsLong
-  #define PyInt_FromLong PyLong_FromLong
-#endif
-
 namespace google {
 namespace protobuf {
 namespace python {
@@ -246,13 +240,8 @@
     Py_ssize_t from, to, step, slicelength, cur, i;
     PyObject* result;
 
-#if PY_MAJOR_VERSION >= 3
-    if (PySlice_GetIndicesEx(item,
-                             length, &from, &to, &step, &slicelength) == -1) {
-#else
-    if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(item),
-                             length, &from, &to, &step, &slicelength) == -1) {
-#endif
+    if (PySlice_GetIndicesEx(item, length, &from, &to, &step, &slicelength) ==
+        -1) {
       return nullptr;
     }
 
diff --git a/python/google/protobuf/pyext/repeated_composite_container.h b/python/google/protobuf/pyext/repeated_composite_container.h
index e241827..30536ea 100644
--- a/python/google/protobuf/pyext/repeated_composite_container.h
+++ b/python/google/protobuf/pyext/repeated_composite_container.h
@@ -34,6 +34,7 @@
 #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_REPEATED_COMPOSITE_CONTAINER_H__
 #define GOOGLE_PROTOBUF_PYTHON_CPP_REPEATED_COMPOSITE_CONTAINER_H__
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <memory>
diff --git a/python/google/protobuf/pyext/repeated_scalar_container.cc b/python/google/protobuf/pyext/repeated_scalar_container.cc
index d76114b..4b6d12a 100644
--- a/python/google/protobuf/pyext/repeated_scalar_container.cc
+++ b/python/google/protobuf/pyext/repeated_scalar_container.cc
@@ -46,15 +46,8 @@
 #include <google/protobuf/pyext/message.h>
 #include <google/protobuf/pyext/scoped_pyobject_ptr.h>
 
-#if PY_MAJOR_VERSION >= 3
-#define PyInt_FromLong PyLong_FromLong
-#if PY_VERSION_HEX < 0x03030000
-#error "Python 3.0 - 3.2 are not supported."
-#else
 #define PyString_AsString(ob) \
   (PyUnicode_Check(ob) ? PyUnicode_AsUTF8(ob) : PyBytes_AsString(ob))
-#endif
-#endif
 
 namespace google {
 namespace protobuf {
@@ -210,7 +203,7 @@
     case FieldDescriptor::CPPTYPE_INT32: {
       int32_t value =
           reflection->GetRepeatedInt32(*message, field_descriptor, index);
-      result = PyInt_FromLong(value);
+      result = PyLong_FromLong(value);
       break;
     }
     case FieldDescriptor::CPPTYPE_INT64: {
@@ -253,7 +246,7 @@
       const EnumValueDescriptor* enum_value =
           message->GetReflection()->GetRepeatedEnum(*message, field_descriptor,
                                                     index);
-      result = PyInt_FromLong(enum_value->number());
+      result = PyLong_FromLong(enum_value->number());
       break;
     }
     case FieldDescriptor::CPPTYPE_STRING: {
@@ -279,22 +272,12 @@
   Py_ssize_t length;
   Py_ssize_t slicelength;
   bool return_list = false;
-#if PY_MAJOR_VERSION < 3
-  if (PyInt_Check(slice)) {
-    from = to = PyInt_AsLong(slice);
-  } else  // NOLINT
-#endif
-      if (PyLong_Check(slice)) {
+  if (PyLong_Check(slice)) {
     from = to = PyLong_AsLong(slice);
   } else if (PySlice_Check(slice)) {
     length = Len(pself);
-#if PY_MAJOR_VERSION >= 3
     if (PySlice_GetIndicesEx(slice, length, &from, &to, &step, &slicelength) ==
         -1) {
-#else
-    if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice), length,
-                             &from, &to, &step, &slicelength) == -1) {
-#endif
       return nullptr;
     }
     return_list = true;
@@ -436,23 +419,13 @@
   Message* message = self->parent->message;
   const FieldDescriptor* field_descriptor = self->parent_field_descriptor;
 
-#if PY_MAJOR_VERSION < 3
-  if (PyInt_Check(slice)) {
-    from = to = PyInt_AsLong(slice);
-  } else  // NOLINT
-#endif
-      if (PyLong_Check(slice)) {
+  if (PyLong_Check(slice)) {
     from = to = PyLong_AsLong(slice);
   } else if (PySlice_Check(slice)) {
     const Reflection* reflection = message->GetReflection();
     length = reflection->FieldSize(*message, field_descriptor);
-#if PY_MAJOR_VERSION >= 3
     if (PySlice_GetIndicesEx(slice, length, &from, &to, &step, &slicelength) ==
         -1) {
-#else
-    if (PySlice_GetIndicesEx(reinterpret_cast<PySliceObject*>(slice), length,
-                             &from, &to, &step, &slicelength) == -1) {
-#endif
       return -1;
     }
     create_list = true;
diff --git a/python/google/protobuf/pyext/repeated_scalar_container.h b/python/google/protobuf/pyext/repeated_scalar_container.h
index f9f0ea8..372b6f0 100644
--- a/python/google/protobuf/pyext/repeated_scalar_container.h
+++ b/python/google/protobuf/pyext/repeated_scalar_container.h
@@ -34,6 +34,7 @@
 #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_REPEATED_SCALAR_CONTAINER_H__
 #define GOOGLE_PROTOBUF_PYTHON_CPP_REPEATED_SCALAR_CONTAINER_H__
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <memory>
diff --git a/python/google/protobuf/pyext/scoped_pyobject_ptr.h b/python/google/protobuf/pyext/scoped_pyobject_ptr.h
index 6f7fc29..985df2c 100644
--- a/python/google/protobuf/pyext/scoped_pyobject_ptr.h
+++ b/python/google/protobuf/pyext/scoped_pyobject_ptr.h
@@ -35,6 +35,7 @@
 
 #include <google/protobuf/stubs/common.h>
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 namespace google {
 namespace protobuf {
diff --git a/python/google/protobuf/pyext/unknown_fields.cc b/python/google/protobuf/pyext/unknown_fields.cc
index deb86e6..6d919b3 100644
--- a/python/google/protobuf/pyext/unknown_fields.cc
+++ b/python/google/protobuf/pyext/unknown_fields.cc
@@ -30,6 +30,7 @@
 
 #include <google/protobuf/pyext/unknown_fields.h>
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 #include <set>
 #include <memory>
@@ -40,10 +41,6 @@
 #include <google/protobuf/unknown_field_set.h>
 #include <google/protobuf/wire_format_lite.h>
 
-#if PY_MAJOR_VERSION >= 3
-  #define PyInt_FromLong PyLong_FromLong
-#endif
-
 namespace google {
 namespace protobuf {
 namespace python {
@@ -222,7 +219,7 @@
                  "The parent message might be cleared.");
     return NULL;
   }
-  ssize_t total_size = fields->field_count();
+  Py_ssize_t total_size = fields->field_count();
   if (self->index >= total_size) {
     PyErr_Format(PyExc_ValueError,
                  "UnknownField does not exist. "
@@ -237,7 +234,7 @@
   if (unknown_field == NULL) {
     return NULL;
   }
-  return PyInt_FromLong(unknown_field->number());
+  return PyLong_FromLong(unknown_field->number());
 }
 
 using internal::WireFormatLite;
@@ -267,7 +264,7 @@
       wire_type = WireFormatLite::WIRETYPE_START_GROUP;
       break;
   }
-  return PyInt_FromLong(wire_type);
+  return PyLong_FromLong(wire_type);
 }
 
 static PyObject* GetData(PyUnknownFieldRef* self, void *closure) {
@@ -278,13 +275,13 @@
   PyObject* data = NULL;
   switch (field->type()) {
     case UnknownField::TYPE_VARINT:
-      data = PyInt_FromLong(field->varint());
+      data = PyLong_FromLong(field->varint());
       break;
     case UnknownField::TYPE_FIXED32:
-      data = PyInt_FromLong(field->fixed32());
+      data = PyLong_FromLong(field->fixed32());
       break;
     case UnknownField::TYPE_FIXED64:
-      data = PyInt_FromLong(field->fixed64());
+      data = PyLong_FromLong(field->fixed64());
       break;
     case UnknownField::TYPE_LENGTH_DELIMITED:
       data = PyBytes_FromStringAndSize(field->length_delimited().data(),
diff --git a/python/google/protobuf/pyext/unknown_fields.h b/python/google/protobuf/pyext/unknown_fields.h
index 94d55e1..e7b0b35 100644
--- a/python/google/protobuf/pyext/unknown_fields.h
+++ b/python/google/protobuf/pyext/unknown_fields.h
@@ -31,6 +31,7 @@
 #ifndef GOOGLE_PROTOBUF_PYTHON_CPP_UNKNOWN_FIELDS_H__
 #define GOOGLE_PROTOBUF_PYTHON_CPP_UNKNOWN_FIELDS_H__
 
+#define PY_SSIZE_T_CLEAN
 #include <Python.h>
 
 #include <memory>
diff --git a/python/google/protobuf/python_protobuf.h b/python/google/protobuf/python_protobuf.h
new file mode 100644
index 0000000..4fcf065
--- /dev/null
+++ b/python/google/protobuf/python_protobuf.h
@@ -0,0 +1,58 @@
+// 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.
+
+// Author: qrczak@google.com (Marcin Kowalczyk)
+//
+// This module exposes the C proto inside the given Python proto, in
+// case the Python proto is implemented with a C proto.
+
+#ifndef GOOGLE_PROTOBUF_PYTHON_PYTHON_PROTOBUF_H__
+#define GOOGLE_PROTOBUF_PYTHON_PYTHON_PROTOBUF_H__
+
+#define PY_SSIZE_T_CLEAN
+#include <Python.h>
+
+namespace google {
+namespace protobuf {
+
+class Message;
+
+namespace python {
+
+// Return the pointer to the C proto inside the given Python proto,
+// or NULL when this is not a Python proto implemented with a C proto.
+const Message* GetCProtoInsidePyProto(PyObject* msg);
+Message* MutableCProtoInsidePyProto(PyObject* msg);
+
+}  // namespace python
+}  // namespace protobuf
+}  // namespace google
+
+#endif  // GOOGLE_PROTOBUF_PYTHON_PYTHON_PROTOBUF_H__
diff --git a/python/protobuf_distutils/protobuf_distutils/generate_py_protobufs.py b/python/protobuf_distutils/protobuf_distutils/generate_py_protobufs.py
index 515ded2..88b8d45 100644
--- a/python/protobuf_distutils/protobuf_distutils/generate_py_protobufs.py
+++ b/python/protobuf_distutils/protobuf_distutils/generate_py_protobufs.py
@@ -120,7 +120,7 @@
         if self.proto_files is None:
             files = glob.glob(os.path.join(self.source_dir, '*.proto'))
             if self.recurse:
-                files.extend(glob.glob(os.path.join(self.source_dir, '**', '*.proto')))
+                files.extend(glob.glob(os.path.join(self.source_dir, '**', '*.proto'), recursive=True))
             self.proto_files = [f.partition(self.proto_root_path + os.path.sep)[-1] for f in files]
             if not self.proto_files:
                 raise DistutilsOptionError('no .proto files were found under ' + self.source_dir)
diff --git a/python/setup.py b/python/setup.py
index 50fd5be..4a6161c 100755
--- a/python/setup.py
+++ b/python/setup.py
@@ -16,9 +16,9 @@
 # namespace_packages option for the "google" package.
 from setuptools import setup, Extension, find_packages
 
+from distutils.command.build_ext import build_ext as _build_ext
 from distutils.command.build_py import build_py as _build_py
 from distutils.command.clean import clean as _clean
-from distutils.command.build_ext import build_ext as _build_ext
 from distutils.spawn import find_executable
 
 # Find the Protocol Compiler.
@@ -159,20 +159,21 @@
 
 
 class build_ext(_build_ext):
-  def get_ext_filename(self, ext_name):
-      # since python3.5, python extensions' shared libraries use a suffix that corresponds to the value
-      # of sysconfig.get_config_var('EXT_SUFFIX') and contains info about the architecture the library targets.
-      # E.g. on x64 linux the suffix is ".cpython-XYZ-x86_64-linux-gnu.so"
-      # When crosscompiling python wheels, we need to be able to override this suffix
-      # so that the resulting file name matches the target architecture and we end up with a well-formed
-      # wheel.
-      filename = _build_ext.get_ext_filename(self, ext_name)
-      orig_ext_suffix = sysconfig.get_config_var("EXT_SUFFIX")
-      new_ext_suffix = os.getenv("PROTOCOL_BUFFERS_OVERRIDE_EXT_SUFFIX")
-      if new_ext_suffix and filename.endswith(orig_ext_suffix):
-        filename = filename[:-len(orig_ext_suffix)] + new_ext_suffix
-      return filename
 
+  def get_ext_filename(self, ext_name):
+    # since python3.5, python extensions' shared libraries use a suffix that
+    # corresponds to the value of sysconfig.get_config_var('EXT_SUFFIX') and
+    # contains info about the architecture the library targets.  E.g. on x64
+    # linux the suffix is ".cpython-XYZ-x86_64-linux-gnu.so" When
+    # crosscompiling python wheels, we need to be able to override this
+    # suffix so that the resulting file name matches the target architecture
+    # and we end up with a well-formed wheel.
+    filename = _build_ext.get_ext_filename(self, ext_name)
+    orig_ext_suffix = sysconfig.get_config_var("EXT_SUFFIX")
+    new_ext_suffix = os.getenv("PROTOCOL_BUFFERS_OVERRIDE_EXT_SUFFIX")
+    if new_ext_suffix and filename.endswith(orig_ext_suffix):
+      filename = filename[:-len(orig_ext_suffix)] + new_ext_suffix
+    return filename
 
 class test_conformance(_build_py):
   target = 'test_python'
@@ -209,12 +210,24 @@
 
     extra_compile_args = []
 
+    message_extra_link_args = None
+    api_implementation_link_args = None
+    if "darwin" in sys.platform:
+      if sys.version_info[0] == 2:
+          message_init_symbol = 'init_message'
+          api_implementation_init_symbol = 'init_api_implementation'
+      else:
+          message_init_symbol = 'PyInit__message'
+          api_implementation_init_symbol = 'PyInit__api_implementation'
+      message_extra_link_args = ['-Wl,-exported_symbol,_%s' % message_init_symbol]
+      api_implementation_link_args = ['-Wl,-exported_symbol,_%s' % api_implementation_init_symbol]
+
     if sys.platform != 'win32':
-        extra_compile_args.append('-Wno-write-strings')
-        extra_compile_args.append('-Wno-invalid-offsetof')
-        extra_compile_args.append('-Wno-sign-compare')
-        extra_compile_args.append('-Wno-unused-variable')
-        extra_compile_args.append('-std=c++11')
+      extra_compile_args.append('-Wno-write-strings')
+      extra_compile_args.append('-Wno-invalid-offsetof')
+      extra_compile_args.append('-Wno-sign-compare')
+      extra_compile_args.append('-Wno-unused-variable')
+      extra_compile_args.append('-std=c++11')
 
     if sys.platform == 'darwin':
       extra_compile_args.append("-Wno-shorten-64-to-32");
@@ -259,6 +272,7 @@
             include_dirs=[".", "../src"],
             libraries=libraries,
             extra_objects=extra_objects,
+            extra_link_args=message_extra_link_args,
             library_dirs=['../src/.libs'],
             extra_compile_args=extra_compile_args,
         ),
@@ -266,6 +280,7 @@
             "google.protobuf.internal._api_implementation",
             glob.glob('google/protobuf/internal/api_implementation.cc'),
             extra_compile_args=extra_compile_args + ['-DPYTHON_PROTO2_CPP_IMPL_V2'],
+            extra_link_args=api_implementation_link_args,
         ),
     ])
     os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp'
@@ -284,21 +299,21 @@
       maintainer_email='protobuf@googlegroups.com',
       license='3-Clause BSD License',
       classifiers=[
-        "Programming Language :: Python",
-        "Programming Language :: Python :: 3",
-        "Programming Language :: Python :: 3.3",
-        "Programming Language :: Python :: 3.4",
-        "Programming Language :: Python :: 3.5",
-        "Programming Language :: Python :: 3.6",
-        "Programming Language :: Python :: 3.7",
-        ],
+          "Programming Language :: Python",
+          "Programming Language :: Python :: 3",
+          "Programming Language :: Python :: 3.5",
+          "Programming Language :: Python :: 3.6",
+          "Programming Language :: Python :: 3.7",
+          "Programming Language :: Python :: 3.8",
+          "Programming Language :: Python :: 3.9",
+          "Programming Language :: Python :: 3.10",
+      ],
       namespace_packages=['google'],
       packages=find_packages(
           exclude=[
               'import_test_package',
               'protobuf_distutils',
-          ],
-      ),
+          ],),
       test_suite='google.protobuf.internal',
       cmdclass={
           'clean': clean,
@@ -308,5 +323,5 @@
       },
       install_requires=install_requires,
       ext_modules=ext_module_list,
-      python_requires='>=3.5',
+      python_requires=">=3.5",
   )
diff --git a/python/tox.ini b/python/tox.ini
index 88dd842..7142b86 100644
--- a/python/tox.ini
+++ b/python/tox.ini
@@ -1,6 +1,6 @@
 [tox]
 envlist =
-    py{35,36,37,38,39}-{cpp,python}
+    py{35,36,37,38,39,310}-{cpp,python}
 
 [testenv]
 usedevelop=true
@@ -14,7 +14,7 @@
 commands =
     python setup.py -q build_py
     python: python setup.py -q build
-    py{35,36,37,38,39}-cpp: python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension
+    py{35,36,37,38,39,310}-cpp: python setup.py -q build --cpp_implementation --warnings_as_errors --compile_static_extension
     python: python setup.py -q test -q
     cpp: python setup.py -q test -q --cpp_implementation
     python: python setup.py -q test_conformance
diff --git a/ruby/Gemfile b/ruby/Gemfile
index 76b23ad..fa75df1 100644
--- a/ruby/Gemfile
+++ b/ruby/Gemfile
@@ -1,5 +1,3 @@
 source 'https://rubygems.org'
 
 gemspec
-
-gem "irb", "~> 1.1", "< 1.2.0" if RUBY_VERSION < "2.5"
diff --git a/ruby/Rakefile b/ruby/Rakefile
index c7187a6..89b9ca5 100644
--- a/ruby/Rakefile
+++ b/ruby/Rakefile
@@ -67,16 +67,18 @@
 end
 
 if RUBY_PLATFORM == "java"
-  if `which mvn` == ''
-    raise ArgumentError, "maven needs to be installed"
-  end
-  task :clean do
+  task :clean => :require_mvn do
     system("mvn --batch-mode clean")
   end
 
-  task :compile do
+  task :compile => :require_mvn do
     system("mvn --batch-mode package")
   end
+
+  task :require_mvn do
+    raise ArgumentError, "maven needs to be installed" if `which mvn` == ''
+  end
+
 else
   Rake::ExtensionTask.new("protobuf_c", spec) do |ext|
     unless RUBY_PLATFORM =~ /darwin/
@@ -91,16 +93,31 @@
     ext.cross_platform = [
       'x86-mingw32', 'x64-mingw32',
       'x86_64-linux', 'x86-linux',
-      'universal-darwin'
+      'x86_64-darwin', 'arm64-darwin',
     ]
   end
 
+  task 'gem:java' do
+    sh "rm Gemfile.lock"
+    require 'rake_compiler_dock'
+    # Specify the repo root as the working and mount directory to provide access
+    # to the java directory
+    repo_root = File.realdirpath File.join(Dir.pwd, '..')
+    RakeCompilerDock.sh <<-"EOT", platform: 'jruby', rubyvm: :jruby, mountdir: repo_root, workdir: repo_root
+      sudo apt-get install maven -y && \
+      cd java && mvn install -Dmaven.test.skip=true && cd ../ruby && \
+      bundle && \
+      IN_DOCKER=true rake compile gem
+    EOT
+  end
+
   task 'gem:windows' do
+    sh "rm Gemfile.lock"
     require 'rake_compiler_dock'
     ['x86-mingw32', 'x64-mingw32', 'x86_64-linux', 'x86-linux'].each do |plat|
       RakeCompilerDock.sh <<-"EOT", platform: plat
         bundle && \
-        IN_DOCKER=true rake native:#{plat} pkg/#{spec.full_name}-#{plat}.gem RUBY_CC_VERSION=3.0.0:2.7.0:2.6.0:2.5.0:2.4.0:2.3.0
+        IN_DOCKER=true rake native:#{plat} pkg/#{spec.full_name}-#{plat}.gem RUBY_CC_VERSION=3.0.0:2.7.0:2.6.0:2.5.0
       EOT
     end
   end
@@ -108,10 +125,10 @@
   if RUBY_PLATFORM =~ /darwin/
     task 'gem:native' do
       system "rake genproto"
-      system "rake cross native gem RUBY_CC_VERSION=3.0.0:2.7.0:2.6.0:2.5.1:2.4.0:2.3.0"
+      system "rake cross native gem RUBY_CC_VERSION=3.0.0:2.7.0:2.6.0:2.5.1"
     end
   else
-    task 'gem:native' => [:genproto, 'gem:windows']
+    task 'gem:native' => [:genproto, 'gem:windows', 'gem:java']
   end
 end
 
diff --git a/ruby/compatibility_tests/v3.0.0/test.sh b/ruby/compatibility_tests/v3.0.0/test.sh
index d5a8fd7..1a9b798 100755
--- a/ruby/compatibility_tests/v3.0.0/test.sh
+++ b/ruby/compatibility_tests/v3.0.0/test.sh
@@ -14,4 +14,4 @@
 chmod +x protoc
 
 # Run tests
-rake test
+RUBYLIB=../../lib:. rake test
diff --git a/ruby/ext/google/protobuf_c/map.c b/ruby/ext/google/protobuf_c/map.c
index d5b47e4..2f6de4d 100644
--- a/ruby/ext/google/protobuf_c/map.c
+++ b/ruby/ext/google/protobuf_c/map.c
@@ -680,7 +680,10 @@
   rb_define_method(klass, "delete", Map_delete, 1);
   rb_define_method(klass, "clear", Map_clear, 0);
   rb_define_method(klass, "length", Map_length, 0);
+  rb_define_method(klass, "size", Map_length, 0);
   rb_define_method(klass, "dup", Map_dup, 0);
+  // Also define #clone so that we don't inherit Object#clone.
+  rb_define_method(klass, "clone", Map_dup, 0);
   rb_define_method(klass, "==", Map_eq, 1);
   rb_define_method(klass, "freeze", Map_freeze, 0);
   rb_define_method(klass, "hash", Map_hash, 0);
diff --git a/ruby/ext/google/protobuf_c/message.c b/ruby/ext/google/protobuf_c/message.c
index 59602cf..d07eba7 100644
--- a/ruby/ext/google/protobuf_c/message.c
+++ b/ruby/ext/google/protobuf_c/message.c
@@ -1012,7 +1012,6 @@
  */
 static VALUE Message_encode(VALUE klass, VALUE msg_rb) {
   Message* msg = ruby_to_Message(msg_rb);
-  upb_arena *arena = upb_arena_new();
   const char *data;
   size_t size;
 
@@ -1020,6 +1019,8 @@
     rb_raise(rb_eArgError, "Message of wrong type.");
   }
 
+  upb_arena *arena = upb_arena_new();
+
   data = upb_encode(msg->msg, upb_msgdef_layout(msg->msgdef), arena,
                     &size);
 
diff --git a/ruby/ext/google/protobuf_c/ruby-upb.c b/ruby/ext/google/protobuf_c/ruby-upb.c
index d68caac..d6c2a0b 100755
--- a/ruby/ext/google/protobuf_c/ruby-upb.c
+++ b/ruby/ext/google/protobuf_c/ruby-upb.c
@@ -5583,7 +5583,7 @@
   }
 
   /* Account for space used by hasbits. */
-  l->size = div_round_up(hasbit, 8);
+  l->size = div_round_up(hasbit + 1, 8);
 
   /* Allocate non-oneof fields. */
   for (upb_msg_field_begin(&it, m); !upb_msg_field_done(&it);
diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec
index 7a9e3f3..87d75a3 100644
--- a/ruby/google-protobuf.gemspec
+++ b/ruby/google-protobuf.gemspec
@@ -1,6 +1,6 @@
 Gem::Specification.new do |s|
   s.name        = "google-protobuf"
-  s.version     = "3.18.1"
+  s.version     = "3.19.4"
   git_tag       = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag
   s.licenses    = ["BSD-3-Clause"]
   s.summary     = "Protocol Buffers"
@@ -17,7 +17,7 @@
   else
     s.files     += Dir.glob('ext/**/*')
     s.extensions= ["ext/google/protobuf_c/extconf.rb"]
-    s.add_development_dependency "rake-compiler-dock", ">= 1.1.0", "< 2.0"
+    s.add_development_dependency "rake-compiler-dock", "= 1.1.0"
   end
   s.test_files  = ["tests/basic.rb",
                   "tests/stress.rb",
@@ -25,5 +25,4 @@
   s.required_ruby_version = '>= 2.3'
   s.add_development_dependency "rake-compiler", "~> 1.1.0"
   s.add_development_dependency "test-unit", '~> 3.0', '>= 3.0.9'
-  s.add_development_dependency "rubygems-tasks", "~> 0.2.4"
 end
diff --git a/ruby/lib/google/protobuf.rb b/ruby/lib/google/protobuf.rb
index 9368768..f939a4c 100644
--- a/ruby/lib/google/protobuf.rb
+++ b/ruby/lib/google/protobuf.rb
@@ -51,9 +51,9 @@
     require 'google/protobuf_c'
   end
 
-  require 'google/protobuf/descriptor_dsl'
 end
 
+require 'google/protobuf/descriptor_dsl'
 require 'google/protobuf/repeated_field'
 
 module Google
diff --git a/ruby/lib/google/protobuf/well_known_types.rb b/ruby/lib/google/protobuf/well_known_types.rb
index 37f8d5b..c9a9ab1 100755
--- a/ruby/lib/google/protobuf/well_known_types.rb
+++ b/ruby/lib/google/protobuf/well_known_types.rb
@@ -85,6 +85,11 @@
       def from_time(time)
         self.seconds = time.to_i
         self.nanos = time.nsec
+        self
+      end
+
+      def self.from_time(time)
+        new.from_time(time)
       end
 
       def to_i
diff --git a/ruby/pom.xml b/ruby/pom.xml
index 6c96bf4..0320a05 100644
--- a/ruby/pom.xml
+++ b/ruby/pom.xml
@@ -1,7 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
     <modelVersion>4.0.0</modelVersion>
     <parent>
       <groupId>com.google</groupId>
@@ -11,7 +9,7 @@
 
     <groupId>com.google.protobuf.jruby</groupId>
     <artifactId>protobuf-jruby</artifactId>
-    <version>1.0-SNAPSHOT</version>
+    <version>3.19.4</version>
     <name>Protocol Buffer JRuby native extension</name>
     <description>
       Protocol Buffers are a way of encoding structured data in an efficient yet
@@ -74,21 +72,17 @@
         </plugins>
     </build>
     <dependencies>
+        <!-- Ordering of dependencies matters to update_version.py -->
         <dependency>
-            <groupId>com.fasterxml.jackson.core</groupId>
-            <artifactId>jackson-core</artifactId>
-            <version>2.4.3</version>
+          <groupId>com.google.protobuf</groupId>
+          <artifactId>protobuf-java-util</artifactId>
+          <version>3.19.4</version>
         </dependency>
         <dependency>
             <groupId>org.jruby</groupId>
             <artifactId>jruby-complete</artifactId>
-            <version>9.2.11.1</version>
+            <version>9.2.19.0</version>
             <scope>provided</scope>
         </dependency>
-        <dependency>
-            <groupId>com.google.protobuf</groupId>
-            <artifactId>protobuf-java-util</artifactId>
-            <version>3.13.0</version>
-        </dependency>
     </dependencies>
 </project>
diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java
deleted file mode 100644
index b19ea64..0000000
--- a/ruby/src/main/java/com/google/protobuf/jruby/RubyBuilder.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Protocol Buffers - Google's data interchange format
- * Copyright 2014 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.
- */
-
-package com.google.protobuf.jruby;
-
-import org.jruby.*;
-import org.jruby.anno.JRubyClass;
-import org.jruby.anno.JRubyMethod;
-import org.jruby.runtime.*;
-import org.jruby.runtime.builtin.IRubyObject;
-
-@JRubyClass(name = "Builder")
-public class RubyBuilder extends RubyObject {
-    public static void createRubyBuilder(Ruby runtime) {
-        RubyModule internal = runtime.getClassFromPath("Google::Protobuf::Internal");
-        RubyClass cBuilder = internal.defineClassUnder("Builder", runtime.getObject(), new ObjectAllocator() {
-            @Override
-            public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
-                return new RubyBuilder(runtime, klazz);
-            }
-        });
-        cBuilder.defineAnnotatedMethods(RubyBuilder.class);
-    }
-
-    public RubyBuilder(Ruby runtime, RubyClass metaClass) {
-        super(runtime, metaClass);
-        this.cFileBuilderContext = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Internal::FileBuilderContext");
-    }
-
-    /*
-     * call-seq:
-     *     Builder.new => builder
-     *
-     * Creates a new Builder. A Builder can accumulate a set of new message and enum
-     * descriptors and atomically register them into a pool in a way that allows for
-     * (co)recursive type references.
-     */
-    @JRubyMethod
-    public IRubyObject initialize(ThreadContext context, IRubyObject descriptorPool) {
-        this.descriptorPool = (RubyDescriptorPool) descriptorPool;
-        return this;
-    }
-
-    /*
-     * call-seq:
-     *     Builder.add_message(name, &block)
-     *
-     * Old and deprecated way to create a new descriptor.
-     * See FileBuilderContext.add_message for the recommended way.
-     *
-     * Exists for backwards compatibility to allow building descriptor pool for
-     * files generated by protoc which don't add messages within "add_file" block.
-     * Descriptors created this way get assigned to a default empty FileDescriptor.
-     */
-    @JRubyMethod(name = "add_message")
-    public IRubyObject addMessage(ThreadContext context, IRubyObject name, Block block) {
-        ensureDefaultFileBuilder(context);
-        defaultFileBuilder.addMessage(context, name, block);
-        return context.nil;
-    }
-
-    /*
-     * call-seq:
-     *     Builder.add_enum(name, &block)
-     *
-     * Old and deprecated way to create a new enum descriptor.
-     * See FileBuilderContext.add_enum for the recommended way.
-     *
-     * Exists for backwards compatibility to allow building descriptor pool for
-     * files generated by protoc which don't add enums within "add_file" block.
-     * Enum descriptors created this way get assigned to a default empty
-     * FileDescriptor.
-     */
-    @JRubyMethod(name = "add_enum")
-    public IRubyObject addEnum(ThreadContext context, IRubyObject name, Block block) {
-        ensureDefaultFileBuilder(context);
-        defaultFileBuilder.addEnum(context, name, block);
-        return context.nil;
-    }
-
-    /*
-     * call-seq:
-     *     Builder.add_file(name, options = nil, &block)
-     *
-     * Creates a new, file descriptor with the given name and options and invokes
-     * the block in the context of a FileBuilderContext on that descriptor. The
-     * block can then call FileBuilderContext#add_message or
-     * FileBuilderContext#add_enum to define new messages or enums, respectively.
-     *
-     * This is the recommended, idiomatic way to build file descriptors.
-     */
-    @JRubyMethod(name = "add_file")
-    public IRubyObject addFile(ThreadContext context, IRubyObject name, IRubyObject options, Block block) {
-        RubyFileBuilderContext ctx = (RubyFileBuilderContext) cFileBuilderContext.newInstance(context, descriptorPool, name, options, Block.NULL_BLOCK);
-        ctx.instance_eval(context, block);
-        ctx.build(context);
-        return context.nil;
-    }
-
-    /*
-     * Used to trigger the build when using the deprecated syntax
-     */
-    protected void build(ThreadContext context) {
-        if (defaultFileBuilder != null) {
-            defaultFileBuilder.build(context);
-        }
-    }
-
-    private void ensureDefaultFileBuilder(ThreadContext context) {
-        if (defaultFileBuilder == null) {
-            this.defaultFileBuilder = (RubyFileBuilderContext) cFileBuilderContext.newInstance(context, descriptorPool, context.runtime.newString("ruby_default_file.proto"), Block.NULL_BLOCK);
-        }
-    }
-
-    private RubyClass cFileBuilderContext;
-    private RubyDescriptorPool descriptorPool;
-    private RubyFileBuilderContext defaultFileBuilder;
-}
diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java
index 99a7f02..6cdb341 100644
--- a/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java
+++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyDescriptorPool.java
@@ -37,9 +37,11 @@
 import com.google.protobuf.Descriptors.DescriptorValidationException;
 import com.google.protobuf.Descriptors.EnumDescriptor;
 import com.google.protobuf.Descriptors.FileDescriptor;
+import com.google.protobuf.InvalidProtocolBufferException;
 import org.jruby.*;
 import org.jruby.anno.JRubyClass;
 import org.jruby.anno.JRubyMethod;
+import org.jruby.exceptions.RaiseException;
 import org.jruby.runtime.*;
 import org.jruby.runtime.builtin.IRubyObject;
 
@@ -61,7 +63,6 @@
 
         cDescriptorPool.defineAnnotatedMethods(RubyDescriptorPool.class);
         descriptorPool = (RubyDescriptorPool) cDescriptorPool.newInstance(runtime.getCurrentContext(), Block.NULL_BLOCK);
-        cBuilder = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Internal::Builder");
         cDescriptor = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Descriptor");
         cEnumDescriptor = (RubyClass) runtime.getClassFromPath("Google::Protobuf::EnumDescriptor");
     }
@@ -74,9 +75,10 @@
 
     @JRubyMethod
     public IRubyObject build(ThreadContext context, Block block) {
-        RubyBuilder ctx = (RubyBuilder) cBuilder.newInstance(context, this, Block.NULL_BLOCK);
+        RubyClass cBuilder = (RubyClass) context.runtime.getClassFromPath("Google::Protobuf::Internal::Builder");
+        RubyBasicObject ctx = (RubyBasicObject) cBuilder.newInstance(context, this, Block.NULL_BLOCK);
         ctx.instance_eval(context, block);
-        ctx.build(context); // Needs to be called to support the deprecated syntax
+        ctx.callMethod(context, "build"); // Needs to be called to support the deprecated syntax
         return context.nil;
     }
 
@@ -109,6 +111,18 @@
         return descriptorPool;
     }
 
+    @JRubyMethod(required = 1)
+    public IRubyObject add_serialized_file (ThreadContext context, IRubyObject data ) {
+        byte[] bin = data.convertToString().getBytes();
+        try {
+            FileDescriptorProto.Builder builder = FileDescriptorProto.newBuilder().mergeFrom(bin);
+            registerFileDescriptor(context, builder);
+        } catch (InvalidProtocolBufferException e) {
+            throw RaiseException.from(context.runtime, (RubyClass) context.runtime.getClassFromPath("Google::Protobuf::ParseError"), e.getMessage());
+        }
+        return context.nil;
+    }
+
     protected void registerFileDescriptor(ThreadContext context, FileDescriptorProto.Builder builder) {
         final FileDescriptor fd;
         try {
@@ -157,7 +171,6 @@
         return fileDescriptors.toArray(new FileDescriptor[fileDescriptors.size()]);
     }
 
-    private static RubyClass cBuilder;
     private static RubyClass cDescriptor;
     private static RubyClass cEnumDescriptor;
     private static RubyDescriptorPool descriptorPool;
diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java
deleted file mode 100644
index 38d31ad..0000000
--- a/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumBuilderContext.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Protocol Buffers - Google's data interchange format
- * Copyright 2014 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.
- */
-
-package com.google.protobuf.jruby;
-
-import com.google.protobuf.DescriptorProtos.EnumDescriptorProto;
-import org.jruby.Ruby;
-import org.jruby.RubyClass;
-import org.jruby.RubyModule;
-import org.jruby.RubyNumeric;
-import org.jruby.RubyObject;
-import org.jruby.anno.JRubyClass;
-import org.jruby.anno.JRubyMethod;
-import org.jruby.runtime.ObjectAllocator;
-import org.jruby.runtime.ThreadContext;
-import org.jruby.runtime.builtin.IRubyObject;
-
-@JRubyClass(name = "EnumBuilderContext")
-public class RubyEnumBuilderContext extends RubyObject {
-    public static void createRubyEnumBuilderContext(Ruby runtime) {
-        RubyModule internal = runtime.getClassFromPath("Google::Protobuf::Internal");
-        RubyClass cEnumBuilderContext = internal.defineClassUnder("EnumBuilderContext", runtime.getObject(), new ObjectAllocator() {
-            @Override
-            public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
-                return new RubyEnumBuilderContext(runtime, klazz);
-            }
-        });
-        cEnumBuilderContext.defineAnnotatedMethods(RubyEnumBuilderContext.class);
-    }
-
-    public RubyEnumBuilderContext(Ruby ruby, RubyClass klazz) {
-        super(ruby, klazz);
-    }
-
-    @JRubyMethod
-    public IRubyObject initialize(ThreadContext context, IRubyObject fileBuilderContext, IRubyObject name) {
-        this.fileBuilderContext = (RubyFileBuilderContext) fileBuilderContext;
-        this.builder = this.fileBuilderContext.getNewEnumBuilder();
-        this.builder.setName(name.asJavaString());
-        this.builder.getOptionsBuilder().setAllowAlias(true);
-
-        return this;
-    }
-
-    /*
-     * call-seq:
-     *     EnumBuilder.add_value(name, number)
-     *
-     * Adds the given name => number mapping to the enum type. Name must be a Ruby
-     * symbol.
-     */
-    @JRubyMethod
-    public IRubyObject value(ThreadContext context, IRubyObject name, IRubyObject number) {
-        this.builder.addValueBuilder()
-            .setName(name.asJavaString())
-            .setNumber(RubyNumeric.num2int(number));
-        return context.nil;
-    }
-
-    private EnumDescriptorProto.Builder builder;
-    private RubyFileBuilderContext fileBuilderContext;
-}
diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java
index e9c1f10..26f00db 100644
--- a/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java
+++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyEnumDescriptor.java
@@ -35,6 +35,7 @@
 import com.google.protobuf.DescriptorProtos.EnumDescriptorProto;
 import com.google.protobuf.Descriptors.EnumDescriptor;
 import com.google.protobuf.Descriptors.EnumValueDescriptor;
+import com.google.protobuf.Descriptors.FileDescriptor;
 import org.jruby.Ruby;
 import org.jruby.RubyClass;
 import org.jruby.RubyModule;
@@ -151,6 +152,7 @@
         Ruby runtime = context.runtime;
 
         RubyModule enumModule = RubyModule.newModule(runtime);
+        boolean defaultValueRequiredButNotFound = descriptor.getFile().getSyntax() == FileDescriptor.Syntax.PROTO3;
         for (EnumValueDescriptor value : descriptor.getValues()) {
             String name = value.getName();
             // Make sure its a valid constant name before trying to create it
@@ -159,8 +161,14 @@
             } else {
                 runtime.getWarnings().warn("Enum value " + name + " does not start with an uppercase letter as is required for Ruby constants.");
             }
+            if (value.getNumber() == 0) {
+                defaultValueRequiredButNotFound = false;
+            }
         }
 
+        if (defaultValueRequiredButNotFound) {
+            throw Utils.createTypeError(context, "Enum definition " + name + " does not contain a value for '0'");
+        }
         enumModule.instance_variable_set(runtime.newString(Utils.DESCRIPTOR_INSTANCE_VAR), this);
         enumModule.defineAnnotatedMethods(RubyEnum.class);
         return enumModule;
diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java
index 8ac5e4c..e9594d8 100644
--- a/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java
+++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyFieldDescriptor.java
@@ -32,8 +32,8 @@
 
 package com.google.protobuf.jruby;
 
-import com.google.protobuf.Descriptors.Descriptor;
 import com.google.protobuf.Descriptors.FieldDescriptor;
+import com.google.protobuf.Descriptors.FileDescriptor;
 import org.jruby.*;
 import org.jruby.anno.JRubyClass;
 import org.jruby.anno.JRubyMethod;
@@ -228,6 +228,9 @@
     }
 
     protected void setDescriptor(ThreadContext context, FieldDescriptor descriptor, RubyDescriptorPool pool) {
+        if (descriptor.isRequired() && descriptor.getFile().getSyntax() == FileDescriptor.Syntax.PROTO3) {
+            throw Utils.createTypeError(context, descriptor.getName() + " is labeled required but required fields are unsupported in proto3");
+        }
         this.descriptor = descriptor;
         this.name = context.runtime.newString(descriptor.getName());
         this.pool = pool;
diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyFileBuilderContext.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyFileBuilderContext.java
deleted file mode 100644
index 00ce3f2..0000000
--- a/ruby/src/main/java/com/google/protobuf/jruby/RubyFileBuilderContext.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*
- * Protocol Buffers - Google's data interchange format
- * Copyright 2014 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.
- */
-
-package com.google.protobuf.jruby;
-
-import com.google.protobuf.DescriptorProtos.DescriptorProto;
-import com.google.protobuf.DescriptorProtos.EnumDescriptorProto;
-import com.google.protobuf.DescriptorProtos.EnumValueDescriptorProtoOrBuilder;
-import com.google.protobuf.DescriptorProtos.FieldDescriptorProto;
-import com.google.protobuf.DescriptorProtos.FileDescriptorProto;
-import com.google.protobuf.Descriptors.FieldDescriptor;
-import org.jruby.Ruby;
-import org.jruby.RubyClass;
-import org.jruby.RubyHash;
-import org.jruby.RubyModule;
-import org.jruby.RubyObject;
-import org.jruby.anno.JRubyClass;
-import org.jruby.anno.JRubyMethod;
-import org.jruby.runtime.Block;
-import org.jruby.runtime.ObjectAllocator;
-import org.jruby.runtime.ThreadContext;
-import org.jruby.runtime.builtin.IRubyObject;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.TreeMap;
-
-@JRubyClass(name = "FileBuilderContext")
-public class RubyFileBuilderContext extends RubyObject {
-    public static void createRubyFileBuilderContext(Ruby runtime) {
-        RubyModule internal = runtime.getClassFromPath("Google::Protobuf::Internal");
-        RubyClass cFileBuilderContext = internal.defineClassUnder("FileBuilderContext", runtime.getObject(), new ObjectAllocator() {
-            @Override
-            public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
-                return new RubyFileBuilderContext(runtime, klazz);
-            }
-        });
-        cFileBuilderContext.defineAnnotatedMethods(RubyFileBuilderContext.class);
-
-        cDescriptor = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Descriptor");
-        cEnumBuilderContext = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Internal::EnumBuilderContext");
-        cEnumDescriptor = (RubyClass) runtime.getClassFromPath("Google::Protobuf::EnumDescriptor");
-        cMessageBuilderContext = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Internal::MessageBuilderContext");
-    }
-
-    public RubyFileBuilderContext(Ruby runtime, RubyClass klazz) {
-        super(runtime, klazz);
-    }
-
-    /*
-     * call-seq:
-     *     FileBuilderContext.new(descriptor_pool, name, options = nil) => context
-     *
-     * Create a new file builder context for the given file descriptor and
-     * builder context. This class is intended to serve as a DSL context to be used
-     * with #instance_eval.
-     */
-    @JRubyMethod(required = 2, optional = 1)
-    public IRubyObject initialize(ThreadContext context, IRubyObject[] args) {
-        this.descriptorPool = (RubyDescriptorPool) args[0];
-        this.builder = FileDescriptorProto.newBuilder();
-        this.builder.setName(args[1].asJavaString());
-        this.builder.setSyntax("proto3");
-
-        if (args.length > 2) {
-            RubyHash options = (RubyHash) args[2];
-            IRubyObject syntax = options.fastARef(context.runtime.newSymbol("syntax"));
-
-            if (syntax != null) {
-                String syntaxStr = syntax.asJavaString();
-                this.builder.setSyntax(syntaxStr);
-                this.proto3 = syntaxStr.equals("proto3");
-            }
-        }
-
-        return this;
-    }
-
-    /*
-     * call-seq:
-     *     FileBuilderContext.add_enum(name, &block)
-     *
-     * Creates a new, empty enum descriptor with the given name, and invokes the
-     * block in the context of an EnumBuilderContext on that descriptor. The block
-     * can then call EnumBuilderContext#add_value to define the enum values.
-     *
-     * This is the recommended, idiomatic way to build enum definitions.
-     */
-    @JRubyMethod(name = "add_enum")
-    public IRubyObject addEnum(ThreadContext context, IRubyObject name, Block block) {
-        RubyObject ctx = (RubyObject) cEnumBuilderContext.newInstance(context, this, name, Block.NULL_BLOCK);
-        ctx.instance_eval(context, block);
-
-        return context.nil;
-    }
-
-    /*
-     * call-seq:
-     *     FileBuilderContext.add_message(name, &block)
-     *
-     * Creates a new, empty descriptor with the given name, and invokes the block in
-     * the context of a MessageBuilderContext on that descriptor. The block can then
-     * call, e.g., MessageBuilderContext#optional and MessageBuilderContext#repeated
-     * methods to define the message fields.
-     *
-     * This is the recommended, idiomatic way to build message definitions.
-     */
-    @JRubyMethod(name = "add_message")
-    public IRubyObject addMessage(ThreadContext context, IRubyObject name, Block block) {
-        RubyObject ctx = (RubyObject) cMessageBuilderContext.newInstance(context, this, name, Block.NULL_BLOCK);
-        ctx.instance_eval(context, block);
-
-        return context.nil;
-    }
-
-    protected void build(ThreadContext context) {
-        Ruby runtime = context.runtime;
-        List<DescriptorProto.Builder> messageBuilderList = builder.getMessageTypeBuilderList();
-        List<EnumDescriptorProto.Builder> enumBuilderList = builder.getEnumTypeBuilderList();
-
-        // Get the package name from defined names
-        String packageName = getPackageName(messageBuilderList, enumBuilderList);
-
-        if (!packageName.isEmpty()) {
-            builder.setPackage(packageName);
-        }
-
-        // Make an index of the message builders so we can easily nest them
-        TreeMap<String, DescriptorProto.Builder> messageBuilderMap = new TreeMap();
-        for (DescriptorProto.Builder messageBuilder : messageBuilderList) {
-            messageBuilderMap.put(messageBuilder.getName(), messageBuilder);
-        }
-
-        // Make an index of the enum builders so we can easily nest them
-        HashMap<String, EnumDescriptorProto.Builder> enumBuilderMap = new HashMap();
-        for (EnumDescriptorProto.Builder enumBuilder : enumBuilderList) {
-            enumBuilderMap.put("." + enumBuilder.getName(), enumBuilder);
-        }
-
-        // Rename and properly nest messages and create associated ruby objects
-        int packageNameLength = packageName.length();
-        int currentMessageIndex = 0;
-        int currentEnumIndex = 0;
-
-        // Need to get a static list because we are potentially deleting some of them from the collection
-        DescriptorProto.Builder[] messageBuilders = new DescriptorProto.Builder[messageBuilderList.size()];
-        messageBuilderList.toArray(messageBuilders);
-        EnumDescriptorProto.Builder[] enumBuilders = new EnumDescriptorProto.Builder[enumBuilderList.size()];
-        enumBuilderList.toArray(enumBuilders);
-
-        for (EnumDescriptorProto.Builder enumBuilder : enumBuilders) {
-            String name = enumBuilder.getName();
-            int lastDot = name.lastIndexOf('.');
-
-            if (lastDot > packageNameLength) {
-                String parentName = name.substring(0, lastDot);
-                String shortName = name.substring(lastDot + 1);
-
-                enumBuilder.setName(shortName);
-                messageBuilderMap.get(parentName).addEnumType(enumBuilder);
-
-                builder.removeEnumType(currentEnumIndex);
-
-            } else {
-                if (packageNameLength > 0) {
-                    // Remove the package name
-                    String shortName = name.substring(packageNameLength + 1);
-                    enumBuilder.setName(shortName);
-                }
-
-                currentEnumIndex++;
-            }
-
-            // Ensure we have a default value if using proto3 syntax
-            if (proto3) {
-                boolean foundDefault = false;
-                for (EnumValueDescriptorProtoOrBuilder enumValue : enumBuilder.getValueOrBuilderList()) {
-                    if (enumValue.getNumber() == 0) {
-                        foundDefault = true;
-                        break;
-                    }
-                }
-
-                if (!foundDefault) {
-                    throw Utils.createTypeError(context, "Enum definition " + enumBuilder.getName() + " does not contain a value for '0'");
-                }
-            }
-        }
-
-        // Wipe out top level message builders so we can insert only the ones that should be there
-        builder.clearMessageType();
-
-        /*
-         * This block is done in this order because calling
-         * `addNestedType` and `addMessageType` makes a copy of the builder
-         * so the objects that our maps point to are no longer the objects
-         * that are being used to build the descriptions.
-         */
-        for (HashMap.Entry<String, DescriptorProto.Builder> entry : messageBuilderMap.descendingMap().entrySet()) {
-            DescriptorProto.Builder messageBuilder = entry.getValue();
-
-            // Rewrite any enum defaults needed
-            for(FieldDescriptorProto.Builder field : messageBuilder.getFieldBuilderList()) {
-                String typeName = field.getTypeName();
-
-                if (typeName == null || !field.hasDefaultValue()) continue;
-
-                EnumDescriptorProto.Builder enumBuilder = enumBuilderMap.get(typeName);
-
-                if (enumBuilder == null) continue;
-
-                int defaultValue = Integer.parseInt(field.getDefaultValue());
-
-                for (EnumValueDescriptorProtoOrBuilder enumValue : enumBuilder.getValueOrBuilderList()) {
-                    if (enumValue.getNumber() == defaultValue) {
-                        field.setDefaultValue(enumValue.getName());
-                        break;
-                    }
-                }
-            }
-
-            // Turn Foo.Bar.Baz into a correctly nested structure with the correct name
-            String name = messageBuilder.getName();
-            int lastDot = name.lastIndexOf('.');
-
-            if (lastDot > packageNameLength) {
-                String parentName = name.substring(0, lastDot);
-                String shortName = name.substring(lastDot + 1);
-                messageBuilder.setName(shortName);
-                messageBuilderMap.get(parentName).addNestedType(messageBuilder);
-
-            } else {
-                if (packageNameLength > 0) {
-                    // Remove the package name
-                    messageBuilder.setName(name.substring(packageNameLength + 1));
-                }
-
-                // Add back in top level message definitions
-                builder.addMessageType(messageBuilder);
-
-                currentMessageIndex++;
-            }
-        }
-
-        descriptorPool.registerFileDescriptor(context, builder);
-    }
-
-    protected EnumDescriptorProto.Builder getNewEnumBuilder() {
-        return builder.addEnumTypeBuilder();
-    }
-
-    protected DescriptorProto.Builder getNewMessageBuilder() {
-        return builder.addMessageTypeBuilder();
-    }
-
-    protected boolean isProto3() {
-        return proto3;
-    }
-
-    private String getPackageName(List<DescriptorProto.Builder> messages, List<EnumDescriptorProto.Builder> enums) {
-        String shortest = null;
-        String longest = null;
-
-        /*
-         * The >= in the longest string comparisons below makes it so we replace
-         * the name in case all the names are the same length. This makes it so
-         * that the shortest and longest aren't the same name to prevent
-         * finding a "package" that isn't correct
-         */
-
-        for (DescriptorProto.Builder message : messages) {
-            String name = message.getName();
-            int nameLength = name.length();
-            if (shortest == null) {
-                shortest = name;
-                longest = name;
-            } else if (nameLength < shortest.length()) {
-                shortest = name;
-            } else if (nameLength >= longest.length()) {
-                longest = name;
-            }
-        }
-
-        for (EnumDescriptorProto.Builder item : enums) {
-            String name = item.getName();
-            int nameLength = name.length();
-            if (shortest == null) {
-                shortest = name;
-                longest = name;
-            } else if (nameLength < shortest.length()) {
-                shortest = name;
-            } else if (nameLength >= longest.length()) {
-                longest = name;
-            }
-        }
-
-        if (shortest == null) {
-            return "";
-        }
-
-        int lastCommonDot = 0;
-        for (int i = 0; i < shortest.length(); i++) {
-            char nextChar = shortest.charAt(i);
-            if (nextChar != longest.charAt(i)) break;
-            if (nextChar == '.') lastCommonDot = i;
-        }
-
-        return shortest.substring(0, lastCommonDot);
-    }
-
-    private static RubyClass cDescriptor;
-    private static RubyClass cEnumBuilderContext;
-    private static RubyClass cEnumDescriptor;
-    private static RubyClass cMessageBuilderContext;
-
-    private FileDescriptorProto.Builder builder;
-    private RubyDescriptorPool descriptorPool;
-    private boolean proto3 = true;
-}
diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java
index 087f1cb..f7379b1 100644
--- a/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java
+++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyMap.java
@@ -37,7 +37,6 @@
 import org.jruby.*;
 import org.jruby.anno.JRubyClass;
 import org.jruby.anno.JRubyMethod;
-import org.jruby.internal.runtime.methods.DynamicMethod;
 import org.jruby.runtime.Block;
 import org.jruby.runtime.Helpers;
 import org.jruby.runtime.ObjectAllocator;
@@ -80,11 +79,12 @@
      * on the same values as field-type symbols in message descriptors) that
      * indicate the type of the map key and value fields.
      *
-     * The supported key types are: :int32, :int64, :uint32, :uint64, :bool,
-     * :string, :bytes.
+     * The supported key types are: :int32, :int64, :uint32, :uint64, :fixed32,
+     * :fixed64, :sfixed32, :sfixed64, :sint32, :sint64, :bool, :string, :bytes.
      *
-     * The supported value types are: :int32, :int64, :uint32, :uint64, :bool,
-     * :string, :bytes, :enum, :message.
+     * The supported value types are: :int32, :int64, :uint32, :uint64, :fixed32,
+     * :fixed64, :sfixed32, :sfixed64, :sint32, :sint64, :bool, :string, :bytes,
+     * :enum, :message.
      *
      * The third argument, value_typeclass, must be present if value_type is :enum
      * or :message. As in RepeatedField#new, this argument must be a message class
@@ -113,8 +113,14 @@
                 break;
             case INT32:
             case INT64:
+            case SINT32:
+            case SINT64:
             case UINT32:
             case UINT64:
+            case FIXED32:
+            case FIXED64:
+            case SFIXED32:
+            case SFIXED64:
             case BOOL:
                 // These are OK.
                 break;
@@ -154,7 +160,7 @@
          * other types for keys, so deal with them specifically first
          */
         if (keyTypeIsString && !(key instanceof RubySymbol || key instanceof RubyString)) {
-            throw context.runtime.newTypeError("Expected string for map key");
+            throw Utils.createTypeError(context, "Expected string for map key");
         }
         key = Utils.checkType(context, keyType, "key", key, (RubyModule) valueTypeClass);
         value = Utils.checkType(context, valueType, "value", value, (RubyModule) valueTypeClass);
@@ -326,7 +332,7 @@
      *
      * Returns the number of entries (key-value pairs) in the map.
      */
-    @JRubyMethod
+    @JRubyMethod(name = {"length", "size"})
     public IRubyObject length(ThreadContext context) {
         return context.runtime.newFixnum(this.table.size());
     }
@@ -399,7 +405,7 @@
 
     protected RubyMap mergeIntoSelf(final ThreadContext context, IRubyObject hashmap) {
         if (hashmap instanceof RubyHash) {
-            ((RubyHash) hashmap).visitAll(new RubyHash.Visitor() {
+            ((RubyHash) hashmap).visitAll(context, new RubyHash.Visitor() {
                 @Override
                 public void visit(IRubyObject key, IRubyObject val) {
                     if (val instanceof RubyHash && !valueTypeClass.isNil()) {
@@ -407,14 +413,14 @@
                     }
                     indexSet(context, key, val);
                 }
-            });
+            }, null);
         } else if (hashmap instanceof RubyMap) {
             RubyMap other = (RubyMap) hashmap;
             if (!typeCompatible(other)) {
                 throw Utils.createTypeError(context, "Attempt to merge Map with mismatching types");
             }
         } else {
-            throw context.runtime.newTypeError("Unknown type merging into Map");
+            throw Utils.createTypeError(context, "Unknown type merging into Map");
         }
         return this;
     }
diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java
index a905c9a..cf59f62 100644
--- a/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java
+++ b/ruby/src/main/java/com/google/protobuf/jruby/RubyMessage.java
@@ -93,16 +93,18 @@
                 throw runtime.newArgumentError("expected Hash arguments.");
             }
             RubyHash hash = args[0].convertToHash();
-            hash.visitAll(new RubyHash.Visitor() {
+            hash.visitAll(context, new RubyHash.Visitor() {
                 @Override
                 public void visit(IRubyObject key, IRubyObject value) {
-                    if (!(key instanceof RubySymbol) && !(key instanceof RubyString))
-                        throw runtime.newTypeError("Expected string or symbols as hash keys in initialization map.");
+                    if (!(key instanceof RubySymbol) && !(key instanceof RubyString)) {
+                        throw Utils.createTypeError(context,
+                            "Expected string or symbols as hash keys in initialization map.");
+                    }
                     final FieldDescriptor fieldDescriptor = findField(context, key, ignoreUnknownFieldsOnInit);
 
                     if (value == null || value.isNil()) return;
 
-                    if (Utils.isMapEntry(fieldDescriptor)) {
+                    if (fieldDescriptor.isMapField()) {
                         if (!(value instanceof RubyHash))
                             throw runtime.newArgumentError("Expected Hash object as initializer value for map field '" +  key.asJavaString() + "' (given " + value.getMetaClass() + ").");
 
@@ -130,7 +132,7 @@
 
                     }
                 }
-            });
+            }, null);
         }
         return this;
     }
@@ -181,6 +183,9 @@
         sb.append(cname).append(colon);
 
         for (FieldDescriptor fd : descriptor.getFields()) {
+            if (fd.hasPresence() && !fields.containsKey(fd)) {
+                continue;
+            }
             if (addComma) {
                 sb.append(comma);
             } else {
@@ -346,9 +351,11 @@
                 fieldDescriptor = descriptor.findFieldByName(methodName);
 
                 if (fieldDescriptor != null &&
-                        (!proto3 || fieldDescriptor.getContainingOneof() == null) && // This seems like a bug but its needed to pass the tests...
-                        fieldHasPresence(fieldDescriptor)) {
-                    return fields.containsKey(fieldDescriptor) ? runtime.getTrue() : runtime.getFalse();
+                    (!proto3 || fieldDescriptor.getContainingOneof() == null || fieldDescriptor
+                        .getContainingOneof().isSynthetic()) &&
+                    fieldDescriptor.hasPresence()) {
+                    return fields.containsKey(fieldDescriptor) ? runtime.getTrue()
+                        : runtime.getFalse();
                 }
 
             } else if (methodName.endsWith(AS_VALUE_SUFFIX)) {
@@ -428,12 +435,11 @@
     @JRubyMethod
     public IRubyObject dup(ThreadContext context) {
         RubyMessage dup = (RubyMessage) metaClass.newInstance(context, Block.NULL_BLOCK);
-        IRubyObject value;
         for (FieldDescriptor fieldDescriptor : this.descriptor.getFields()) {
             if (fieldDescriptor.isRepeated()) {
                 dup.fields.put(fieldDescriptor, this.getRepeatedField(context, fieldDescriptor));
             } else if (fields.containsKey(fieldDescriptor)) {
-                dup.fields.put(fieldDescriptor, fields.get(fieldDescriptor));
+                dup.setFieldInternal(context, fieldDescriptor, fields.get(fieldDescriptor));
             } else if (this.builder.hasField(fieldDescriptor)) {
                 dup.fields.put(fieldDescriptor, wrapField(context, fieldDescriptor, this.builder.getField(fieldDescriptor)));
             }
@@ -474,7 +480,7 @@
      *     MessageClass.decode(data) => message
      *
      * Decodes the given data (as a string containing bytes in protocol buffers wire
-     * format) under the interpretration given by this message class's definition
+     * format) under the interpretation given by this message class's definition
      * and returns a message object with the corresponding field values.
      */
     @JRubyMethod(meta = true)
@@ -532,11 +538,14 @@
                 printer = printer.preservingProtoFieldNames();
             }
         }
+        printer = printer.usingTypeRegistry(JsonFormat.TypeRegistry.newBuilder().add(message.descriptor).build());
 
         try {
             result = printer.print(message.build(context));
-        } catch(InvalidProtocolBufferException e) {
+        } catch (InvalidProtocolBufferException e) {
             throw runtime.newRuntimeError(e.getMessage());
+        } catch (IllegalArgumentException e) {
+            throw createParseError(context, e.getMessage());
         }
 
         return runtime.newString(result);
@@ -547,7 +556,7 @@
      *     MessageClass.decode_json(data, options = {}) => message
      *
      * Decodes the given data (as a string containing bytes in protocol buffers wire
-     * format) under the interpretration given by this message class's definition
+     * format) under the interpretation given by this message class's definition
      * and returns a message object with the corresponding field values.
      *
      *  @param options [Hash] options for the decoder
@@ -577,6 +586,7 @@
         }
 
         RubyMessage ret = (RubyMessage) ((RubyClass) recv).newInstance(context, Block.NULL_BLOCK);
+        parser = parser.usingTypeRegistry(JsonFormat.TypeRegistry.newBuilder().add(ret.descriptor).build());
 
         try {
             parser.merge(data.asJavaString(), ret.builder);
@@ -633,6 +643,8 @@
         if (depth > SINK_MAXIMUM_NESTING) {
             throw context.runtime.newRuntimeError("Maximum recursion depth exceeded during encoding.");
         }
+
+        // Handle the typical case where the fields.keySet contain the fieldDescriptors
         for (FieldDescriptor fieldDescriptor : fields.keySet()) {
             IRubyObject value = fields.get(fieldDescriptor);
 
@@ -648,15 +660,53 @@
 
                 builder.clearField(fieldDescriptor);
                 for (int i = 0; i < repeatedField.size(); i++) {
-                    Object item = convert(context, fieldDescriptor, repeatedField.get(i), depth);
+                    Object item = convert(context, fieldDescriptor, repeatedField.get(i), depth,
+                        /*isDefaultValueForBytes*/ false);
                     builder.addRepeatedField(fieldDescriptor, item);
                 }
 
-            } else {
-                builder.setField(fieldDescriptor, convert(context, fieldDescriptor, value, depth));
+            } else if (!value.isNil()) {
+                /**
+                 * Detect the special case where default_value strings are provided for byte fields.
+                 * If so, disable normal string encoding behavior within convert.
+                 * For a more detailed explanation of other possible workarounds, see the comments
+                 * above {@code com.google.protobuf.Internal#stringDefaultValue()
+                 * stringDefaultValue}.
+                 */
+                boolean isDefaultStringForBytes = false;
+                FieldDescriptor enumFieldDescriptorForType =
+                    this.builder.getDescriptorForType().findFieldByName("type");
+                String type = enumFieldDescriptorForType == null ?
+                    null : fields.get(enumFieldDescriptorForType).toString();
+                if (type != null && type.equals("TYPE_BYTES") &&
+                    fieldDescriptor.getFullName().equals("google.protobuf.FieldDescriptorProto.default_value")) {
+                    isDefaultStringForBytes = true;
+                }
+                builder.setField(fieldDescriptor, convert(context, fieldDescriptor, value, depth, isDefaultStringForBytes));
             }
         }
 
+        // Handle cases where {@code fields} doesn't contain the value until after getFieldInternal
+        // is called - typical of a deserialized message. Skip non-maps and descriptors that already
+        // have an entry in {@code fields}.
+        for (FieldDescriptor fieldDescriptor : descriptor.getFields()) {
+            if (!fieldDescriptor.isMapField()) {
+                continue;
+            }
+            IRubyObject value = fields.get(fieldDescriptor);
+            if (value!=null) {
+                continue;
+            }
+            value = getFieldInternal(context, fieldDescriptor);
+            if (value instanceof RubyMap) {
+                builder.clearField(fieldDescriptor);
+                RubyDescriptor mapDescriptor = (RubyDescriptor) getDescriptorForField(context,
+                    fieldDescriptor);
+                for (DynamicMessage kv : ((RubyMap) value).build(context, mapDescriptor, depth)) {
+                    builder.addRepeatedField(fieldDescriptor, kv);
+                }
+            }
+        }
         return builder.build();
     }
 
@@ -667,7 +717,7 @@
             if (fdef.isRepeated()) {
                 copy.fields.put(fdef, this.getRepeatedField(context, fdef).deepCopy(context));
             } else if (fields.containsKey(fdef)) {
-                copy.fields.put(fdef, fields.get(fdef));
+                copy.setFieldInternal(context, fdef, fields.get(fdef));
             } else if (builder.hasField(fdef)) {
                 copy.fields.put(fdef, wrapField(context, fdef, builder.getField(fdef)));
             }
@@ -691,7 +741,9 @@
 
     protected IRubyObject hasField(ThreadContext context, FieldDescriptor fieldDescriptor) {
         validateMessageType(context, fieldDescriptor, "has?");
-        if (!fieldHasPresence(fieldDescriptor)) throw context.runtime.newArgumentError("does not track presence");
+        if (!fieldDescriptor.hasPresence()) {
+            throw context.runtime.newArgumentError("does not track presence");
+        }
         return fields.containsKey(fieldDescriptor) ? context.runtime.getTrue() : context.runtime.getFalse();
     }
 
@@ -762,19 +814,24 @@
     // convert a ruby object to protobuf type, skip type check since it is checked on the way in
     private Object convert(ThreadContext context,
                            FieldDescriptor fieldDescriptor,
-                           IRubyObject value, int depth) {
-        Ruby runtime = context.runtime;
+                           IRubyObject value, int depth, boolean isDefaultStringForBytes) {
         Object val = null;
         switch (fieldDescriptor.getType()) {
             case INT32:
+            case SFIXED32:
+            case SINT32:
                 val = RubyNumeric.num2int(value);
                 break;
             case INT64:
+            case SFIXED64:
+            case SINT64:
                 val = RubyNumeric.num2long(value);
                 break;
+            case FIXED32:
             case UINT32:
                 val = Utils.num2uint(value);
                 break;
+            case FIXED64:
             case UINT64:
                 val = Utils.num2ulong(context.runtime, value);
                 break;
@@ -791,7 +848,11 @@
                 val = ByteString.copyFrom(((RubyString) value).getBytes());
                 break;
             case STRING:
-                val = ((RubyString) value).asJavaString();
+                if (isDefaultStringForBytes) {
+                    val = ((RubyString) value).getByteList().toString();
+                } else {
+                    val = value.asJavaString();
+                }
                 break;
             case MESSAGE:
                 val = ((RubyMessage) value).build(context, depth + 1);
@@ -819,6 +880,10 @@
     }
 
     private IRubyObject wrapField(ThreadContext context, FieldDescriptor fieldDescriptor, Object value) {
+        return wrapField(context, fieldDescriptor, value, false);
+    }
+
+    private IRubyObject wrapField(ThreadContext context, FieldDescriptor fieldDescriptor, Object value, boolean encodeBytes) {
         if (value == null) {
             return context.runtime.getNil();
         }
@@ -827,6 +892,12 @@
         switch (fieldDescriptor.getType()) {
             case INT32:
             case INT64:
+            case FIXED32:
+            case SINT32:
+            case FIXED64:
+            case SINT64:
+            case SFIXED64:
+            case SFIXED32:
             case UINT32:
             case UINT64:
             case FLOAT:
@@ -834,7 +905,7 @@
             case BOOL:
             case BYTES:
             case STRING:
-                return Utils.wrapPrimaryValue(context, fieldDescriptor.getType(), value);
+                return Utils.wrapPrimaryValue(context, fieldDescriptor.getType(), value, encodeBytes);
             case MESSAGE:
                 RubyClass typeClass = (RubyClass) ((RubyDescriptor) getDescriptorForField(context, fieldDescriptor)).msgclass(context);
                 RubyMessage msg = (RubyMessage) typeClass.newInstance(context, Block.NULL_BLOCK);
@@ -872,22 +943,44 @@
         return getFieldInternal(context, fieldDescriptor, true);
     }
 
-    private IRubyObject getFieldInternal(ThreadContext context, FieldDescriptor fieldDescriptor, boolean returnDefaults) {
+    private IRubyObject getFieldInternal(ThreadContext context, FieldDescriptor fieldDescriptor,
+        boolean returnDefaults) {
         OneofDescriptor oneofDescriptor = fieldDescriptor.getContainingOneof();
         if (oneofDescriptor != null) {
             if (oneofCases.get(oneofDescriptor) == fieldDescriptor) {
-                return fields.get(fieldDescriptor);
+                IRubyObject value = fields.get(fieldDescriptor);
+                if (value == null) {
+                    FieldDescriptor oneofCase = builder.getOneofFieldDescriptor(oneofDescriptor);
+                    if (oneofCase != null) {
+                        Object builderValue = builder.getField(oneofCase);
+                        if (builderValue != null) {
+                            boolean encodeBytes = oneofCase.hasDefaultValue() && builderValue.equals(oneofCase.getDefaultValue());
+                            value = wrapField(context, oneofCase, builderValue, encodeBytes);
+                        }
+                    }
+                    if (value == null) {
+                        return context.nil;
+                    } else {
+                        return value;
+                    }
+                } else {
+                    return value;
+                }
             } else {
                 FieldDescriptor oneofCase = builder.getOneofFieldDescriptor(oneofDescriptor);
                 if (oneofCase != fieldDescriptor) {
-                  if (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE || !returnDefaults) {
-                    return context.nil;
-                  } else {
-                    return wrapField(context, fieldDescriptor, fieldDescriptor.getDefaultValue());
-                  }
+                    if (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE
+                        || !returnDefaults) {
+                        return context.nil;
+                    } else {
+                        return wrapField(context, fieldDescriptor,
+                            fieldDescriptor.getDefaultValue(), true);
+                    }
                 }
                 if (returnDefaults || builder.hasField(fieldDescriptor)) {
-                    IRubyObject value = wrapField(context, oneofCase, builder.getField(oneofCase));
+                    Object rawValue = builder.getField(oneofCase);
+                    boolean encodeBytes = oneofCase.hasDefaultValue() && rawValue.equals(oneofCase.getDefaultValue());
+                    IRubyObject value = wrapField(context, oneofCase, rawValue, encodeBytes);
                     fields.put(fieldDescriptor, value);
                     return value;
                 } else {
@@ -896,7 +989,7 @@
             }
         }
 
-        if (Utils.isMapEntry(fieldDescriptor)) {
+        if (fieldDescriptor.isMapField()) {
             RubyMap map = (RubyMap) fields.get(fieldDescriptor);
             if (map == null) {
                 map = newMapForField(context, fieldDescriptor);
@@ -925,7 +1018,9 @@
             if (fields.containsKey(fieldDescriptor)) {
                 return fields.get(fieldDescriptor);
             } else if (returnDefaults || builder.hasField(fieldDescriptor)) {
-                IRubyObject value = wrapField(context, fieldDescriptor, builder.getField(fieldDescriptor));
+                Object rawValue = builder.getField(fieldDescriptor);
+                boolean encodeBytes = fieldDescriptor.hasDefaultValue() && rawValue.equals(fieldDescriptor.getDefaultValue());
+                IRubyObject value = wrapField(context, fieldDescriptor, rawValue, encodeBytes);
                 if (builder.hasField(fieldDescriptor)) {
                     fields.put(fieldDescriptor, value);
                 }
@@ -938,7 +1033,7 @@
     private IRubyObject setFieldInternal(ThreadContext context, FieldDescriptor fieldDescriptor, IRubyObject value) {
         testFrozen("can't modify frozen " + getMetaClass());
 
-        if (Utils.isMapEntry(fieldDescriptor)) {
+        if (fieldDescriptor.isMapField()) {
             if (!(value instanceof RubyMap)) {
                 throw Utils.createTypeError(context, "Expected Map instance");
             }
@@ -980,7 +1075,9 @@
                 // Keep track of what Oneofs are set
                 if (value.isNil()) {
                     oneofCases.remove(oneofDescriptor);
-                    addValue = false;
+                    if (!oneofDescriptor.isSynthetic()) {
+                        addValue = false;
+                    }
                 } else {
                     oneofCases.put(oneofDescriptor, fieldDescriptor);
                 }
@@ -1019,20 +1116,12 @@
         return context.runtime.newSymbol("UNKNOWN");
     }
 
-    private boolean fieldHasPresence(FieldDescriptor fieldDescriptor) {
-      return !fieldDescriptor.isRepeated() &&
-              (fieldDescriptor.getType() == FieldDescriptor.Type.MESSAGE ||
-                fieldDescriptor.getContainingOneof() != null ||
-                !proto3);
-    }
-
     private RubyRepeatedField rubyToRepeatedField(ThreadContext context,
                                                   FieldDescriptor fieldDescriptor, IRubyObject value) {
         RubyArray arr = value.convertToArray();
         RubyRepeatedField repeatedField = repeatedFieldForFieldDescriptor(context, fieldDescriptor);
         IRubyObject[] values = new IRubyObject[arr.size()];
         FieldDescriptor.Type fieldType = fieldDescriptor.getType();
-        String fieldName = fieldDescriptor.getName();
 
         RubyModule typeClass = null;
         if (fieldType == FieldDescriptor.Type.MESSAGE) {
@@ -1045,8 +1134,11 @@
 
         for (int i = 0; i < arr.size(); i++) {
             IRubyObject item = arr.eltInternal(i);
+            if (item.isNil()) {
+                throw Utils.createTypeError(context, "nil message not allowed here.");
+            }
             if (item instanceof RubyHash && typeClass != null) {
-                values[i] = (IRubyObject) ((RubyClass) typeClass).newInstance(context, item, Block.NULL_BLOCK);
+                values[i] = ((RubyClass) typeClass).newInstance(context, item, Block.NULL_BLOCK);
             } else {
                 if (fieldType == FieldDescriptor.Type.ENUM) {
                     item = enumToSymbol(context, fieldDescriptor.getEnumType(), item);
@@ -1086,13 +1178,6 @@
         }
     }
 
-    private FieldDescriptor getOneofCase(OneofDescriptor oneof) {
-        if (oneofCases.containsKey(oneof)) {
-            return oneofCases.get(oneof);
-        }
-        return builder.getOneofFieldDescriptor(oneof);
-    }
-
     private boolean isWrappable(FieldDescriptor fieldDescriptor) {
       if (fieldDescriptor.getType() != FieldDescriptor.Type.MESSAGE) return false;
 
@@ -1118,7 +1203,7 @@
 
     private void validateMessageType(ThreadContext context, FieldDescriptor fieldDescriptor, String methodName) {
         if (descriptor != fieldDescriptor.getContainingType()) {
-            throw context.runtime.newTypeError(methodName + " method called on wrong message type");
+            throw Utils.createTypeError(context, methodName + " method called on wrong message type");
         }
     }
 
@@ -1139,6 +1224,4 @@
     private RubyClass cMap;
     private boolean ignoreUnknownFieldsOnInit = false;
     private boolean proto3;
-
-
 }
diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java
deleted file mode 100644
index 211236c..0000000
--- a/ruby/src/main/java/com/google/protobuf/jruby/RubyMessageBuilderContext.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
- * Protocol Buffers - Google's data interchange format
- * Copyright 2014 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.
- */
-
-package com.google.protobuf.jruby;
-
-import com.google.protobuf.DescriptorProtos.DescriptorProto;
-import com.google.protobuf.DescriptorProtos.FieldDescriptorProto;
-import com.google.protobuf.DescriptorProtos.OneofDescriptorProto;
-import org.jruby.*;
-import org.jruby.anno.JRubyClass;
-import org.jruby.anno.JRubyMethod;
-import org.jruby.runtime.Binding;
-import org.jruby.runtime.Block;
-import org.jruby.runtime.ObjectAllocator;
-import org.jruby.runtime.ThreadContext;
-import org.jruby.runtime.builtin.IRubyObject;
-
-@JRubyClass(name = "MessageBuilderContext")
-public class RubyMessageBuilderContext extends RubyObject {
-    public static void createRubyMessageBuilderContext(Ruby runtime) {
-        RubyModule internal = runtime.getClassFromPath("Google::Protobuf::Internal");
-        RubyClass cMessageBuilderContext = internal.defineClassUnder("MessageBuilderContext", runtime.getObject(), new ObjectAllocator() {
-            @Override
-            public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
-                return new RubyMessageBuilderContext(runtime, klazz);
-            }
-        });
-        cMessageBuilderContext.defineAnnotatedMethods(RubyMessageBuilderContext.class);
-
-        cFieldDescriptor = (RubyClass) runtime.getClassFromPath("Google::Protobuf::FieldDescriptor");
-        cOneofBuilderContext = (RubyClass) runtime.getClassFromPath("Google::Protobuf::Internal::OneofBuilderContext");
-    }
-
-    public RubyMessageBuilderContext(Ruby runtime, RubyClass klazz) {
-        super(runtime, klazz);
-    }
-
-    @JRubyMethod
-    public IRubyObject initialize(ThreadContext context, IRubyObject fileBuilderContext, IRubyObject name) {
-        this.fileBuilderContext = (RubyFileBuilderContext) fileBuilderContext;
-        this.builder = this.fileBuilderContext.getNewMessageBuilder();
-        this.builder.setName(name.asJavaString());
-
-        return this;
-    }
-
-    /*
-     * call-seq:
-     *     MessageBuilderContext.optional(name, type, number, type_class = nil,
-     *                                    options = nil)
-     *
-     * Defines a new optional field on this message type with the given type, tag
-     * number, and type class (for message and enum fields). The type must be a Ruby
-     * symbol (as accepted by FieldDescriptor#type=) and the type_class must be a
-     * string, if present (as accepted by FieldDescriptor#submsg_name=).
-     */
-    @JRubyMethod(required = 3, optional = 2)
-    public IRubyObject optional(ThreadContext context, IRubyObject[] args) {
-        addField(context, OPTIONAL, args, false);
-        return context.nil;
-    }
-
-    @JRubyMethod(required = 3, optional = 2)
-    public IRubyObject proto3_optional(ThreadContext context, IRubyObject[] args) {
-      addField(context, OPTIONAL, args, true);
-      return context.nil;
-    }
-
-    /*
-     * call-seq:
-     *     MessageBuilderContext.required(name, type, number, type_class = nil,
-     *                                    options = nil)
-     *
-     * Defines a new required field on this message type with the given type, tag
-     * number, and type class (for message and enum fields). The type must be a Ruby
-     * symbol (as accepted by FieldDescriptor#type=) and the type_class must be a
-     * string, if present (as accepted by FieldDescriptor#submsg_name=).
-     *
-     * Proto3 does not have required fields, but this method exists for
-     * completeness. Any attempt to add a message type with required fields to a
-     * pool will currently result in an error.
-     */
-    @JRubyMethod(required = 3, optional = 2)
-    public IRubyObject required(ThreadContext context, IRubyObject[] args) {
-        if (fileBuilderContext.isProto3()) throw Utils.createTypeError(context, "Required fields are unsupported in proto3");
-        addField(context, "required", args, false);
-        return context.nil;
-    }
-
-    /*
-     * call-seq:
-     *     MessageBuilderContext.repeated(name, type, number, type_class = nil)
-     *
-     * Defines a new repeated field on this message type with the given type, tag
-     * number, and type class (for message and enum fields). The type must be a Ruby
-     * symbol (as accepted by FieldDescriptor#type=) and the type_class must be a
-     * string, if present (as accepted by FieldDescriptor#submsg_name=).
-     */
-    @JRubyMethod(required = 3, optional = 1)
-    public IRubyObject repeated(ThreadContext context, IRubyObject[] args) {
-        addField(context, "repeated", args, false);
-        return context.nil;
-    }
-
-    /*
-     * call-seq:
-     *     MessageBuilderContext.map(name, key_type, value_type, number,
-     *                               value_type_class = nil)
-     *
-     * Defines a new map field on this message type with the given key and value
-     * types, tag number, and type class (for message and enum value types). The key
-     * type must be :int32/:uint32/:int64/:uint64, :bool, or :string. The value type
-     * type must be a Ruby symbol (as accepted by FieldDescriptor#type=) and the
-     * type_class must be a string, if present (as accepted by
-     * FieldDescriptor#submsg_name=).
-     */
-    @JRubyMethod(required = 4, optional = 1)
-    public IRubyObject map(ThreadContext context, IRubyObject[] args) {
-        Ruby runtime = context.runtime;
-        if (!fileBuilderContext.isProto3()) throw runtime.newArgumentError("Cannot add a native map field using proto2 syntax.");
-
-        RubySymbol messageSym = runtime.newSymbol("message");
-
-        IRubyObject name = args[0];
-        IRubyObject keyType = args[1];
-        IRubyObject valueType = args[2];
-        IRubyObject number = args[3];
-        IRubyObject typeClass = args.length > 4 ? args[4] : context.nil;
-
-        // Validate the key type. We can't accept enums, messages, or floats/doubles
-        // as map keys. (We exclude these explicitly, and the field-descriptor setter
-        // below then ensures that the type is one of the remaining valid options.)
-        if (keyType.equals(runtime.newSymbol("float")) ||
-                keyType.equals(runtime.newSymbol("double")) ||
-                keyType.equals(runtime.newSymbol("enum")) ||
-                keyType.equals(messageSym))
-            throw runtime.newArgumentError("Cannot add a map field with a float, double, enum, or message type.");
-
-        DescriptorProto.Builder mapEntryBuilder = fileBuilderContext.getNewMessageBuilder();
-        mapEntryBuilder.setName(builder.getName() + "_MapEntry_" + name.asJavaString());
-        mapEntryBuilder.getOptionsBuilder().setMapEntry(true);
-
-        mapEntryBuilder.addField(
-            Utils.createFieldBuilder(
-                context,
-                OPTIONAL,
-                new IRubyObject[] {
-                    runtime.newString("key"),
-                    keyType,
-                    runtime.newFixnum(1)
-                }
-            )
-        );
-
-        mapEntryBuilder.addField(
-            Utils.createFieldBuilder(
-                context,
-                OPTIONAL,
-                new IRubyObject[] {
-                    runtime.newString("value"),
-                    valueType,
-                    runtime.newFixnum(2),
-                    typeClass
-                }
-            )
-        );
-
-        IRubyObject[] addFieldArgs = {
-            name, messageSym, number, runtime.newString(mapEntryBuilder.getName())
-        };
-
-        repeated(context, addFieldArgs);
-
-        return context.nil;
-    }
-
-    /*
-     * call-seq:
-     *     MessageBuilderContext.oneof(name, &block) => nil
-     *
-     * Creates a new OneofDescriptor with the given name, creates a
-     * OneofBuilderContext attached to that OneofDescriptor, evaluates the given
-     * block in the context of that OneofBuilderContext with #instance_eval, and
-     * then adds the oneof to the message.
-     *
-     * This is the recommended, idiomatic way to build oneof definitions.
-     */
-    @JRubyMethod
-    public IRubyObject oneof(ThreadContext context, IRubyObject name, Block block) {
-        RubyOneofBuilderContext ctx = (RubyOneofBuilderContext)
-                cOneofBuilderContext.newInstance(
-                        context,
-                        context.runtime.newFixnum(builder.getOneofDeclCount()),
-                        this,
-                        Block.NULL_BLOCK
-                );
-
-        builder.addOneofDeclBuilder().setName(name.asJavaString());
-        ctx.instance_eval(context, block);
-
-        return context.nil;
-    }
-
-    protected void addFieldBuilder(FieldDescriptorProto.Builder fieldBuilder) {
-        builder.addField(fieldBuilder);
-    }
-
-    private FieldDescriptorProto.Builder addField(ThreadContext context, String label, IRubyObject[] args, boolean proto3Optional) {
-        FieldDescriptorProto.Builder fieldBuilder =
-                Utils.createFieldBuilder(context, label, args);
-
-        fieldBuilder.setProto3Optional(proto3Optional);
-        builder.addField(fieldBuilder);
-
-        return fieldBuilder;
-    }
-
-    private static RubyClass cFieldDescriptor;
-    private static RubyClass cOneofBuilderContext;
-
-    private static final String OPTIONAL = "optional";
-
-    private DescriptorProto.Builder builder;
-    private RubyClass cDescriptor;
-    private RubyFileBuilderContext fileBuilderContext;
-}
diff --git a/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java b/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java
deleted file mode 100644
index 1ce500e..0000000
--- a/ruby/src/main/java/com/google/protobuf/jruby/RubyOneofBuilderContext.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Protocol Buffers - Google's data interchange format
- * Copyright 2014 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.
- */
-
-package com.google.protobuf.jruby;
-
-import com.google.protobuf.DescriptorProtos.FieldDescriptorProto;
-import org.jruby.Ruby;
-import org.jruby.RubyClass;
-import org.jruby.RubyHash;
-import org.jruby.RubyModule;
-import org.jruby.RubyNumeric;
-import org.jruby.RubyObject;
-import org.jruby.anno.JRubyClass;
-import org.jruby.anno.JRubyMethod;
-import org.jruby.runtime.ObjectAllocator;
-import org.jruby.runtime.ThreadContext;
-import org.jruby.runtime.builtin.IRubyObject;
-
-@JRubyClass(name = "OneofBuilderContext")
-public class RubyOneofBuilderContext extends RubyObject {
-    public static void createRubyOneofBuilderContext(Ruby runtime) {
-        RubyModule internal = runtime.getClassFromPath("Google::Protobuf::Internal");
-        RubyClass cRubyOneofBuidlerContext = internal.defineClassUnder("OneofBuilderContext", runtime.getObject(), new ObjectAllocator() {
-            @Override
-            public IRubyObject allocate(Ruby ruby, RubyClass rubyClass) {
-                return new RubyOneofBuilderContext(ruby, rubyClass);
-            }
-        });
-        cRubyOneofBuidlerContext.defineAnnotatedMethods(RubyOneofBuilderContext.class);
-    }
-
-    public RubyOneofBuilderContext(Ruby ruby, RubyClass rubyClass) {
-        super(ruby, rubyClass);
-    }
-
-    /*
-     * call-seq:
-     *     OneofBuilderContext.new(oneof_index, message_builder) => context
-     *
-     * Create a new oneof builder context around the given oneof descriptor and
-     * builder context. This class is intended to serve as a DSL context to be used
-     * with #instance_eval.
-     */
-    @JRubyMethod
-    public IRubyObject initialize(ThreadContext context, IRubyObject index, IRubyObject messageBuilder) {
-        this.builder = (RubyMessageBuilderContext) messageBuilder;
-        this.index = RubyNumeric.num2int(index);
-
-        return this;
-    }
-
-    /*
-     * call-seq:
-     *     OneofBuilderContext.optional(name, type, number, type_class = nil,
-     *                                  options = nil)
-     *
-     * Defines a new optional field in this oneof with the given type, tag number,
-     * and type class (for message and enum fields). The type must be a Ruby symbol
-     * (as accepted by FieldDescriptor#type=) and the type_class must be a string,
-     * if present (as accepted by FieldDescriptor#submsg_name=).
-     */
-    @JRubyMethod(required = 3, optional = 2)
-    public IRubyObject optional(ThreadContext context, IRubyObject[] args) {
-        FieldDescriptorProto.Builder fieldBuilder =
-                Utils.createFieldBuilder(context, "optional", args);
-        fieldBuilder.setOneofIndex(index);
-        builder.addFieldBuilder(fieldBuilder);
-
-        return context.nil;
-    }
-
-    private RubyMessageBuilderContext builder;
-    private int index;
-}
diff --git a/ruby/src/main/java/com/google/protobuf/jruby/Utils.java b/ruby/src/main/java/com/google/protobuf/jruby/Utils.java
index 17c1c8d..cd27589 100644
--- a/ruby/src/main/java/com/google/protobuf/jruby/Utils.java
+++ b/ruby/src/main/java/com/google/protobuf/jruby/Utils.java
@@ -35,7 +35,6 @@
 import com.google.protobuf.ByteString;
 import com.google.protobuf.DescriptorProtos.FieldDescriptorProto;
 import com.google.protobuf.Descriptors.FieldDescriptor;
-import org.jcodings.Encoding;
 import org.jcodings.specific.ASCIIEncoding;
 import org.jruby.*;
 import org.jruby.exceptions.RaiseException;
@@ -70,6 +69,12 @@
         Ruby runtime = context.runtime;
 
         switch(fieldType) {
+            case SFIXED32:
+            case SFIXED64:
+            case FIXED64:
+            case SINT64:
+            case SINT32:
+            case FIXED32:
             case INT32:
             case INT64:
             case UINT32:
@@ -83,7 +88,8 @@
                         throw runtime.newRangeError("Non-integral floating point value assigned to integer field '" + fieldName + "' (given " + value.getMetaClass() + ").");
                     }
                 }
-                if (fieldType == FieldDescriptor.Type.UINT32 || fieldType == FieldDescriptor.Type.UINT64) {
+                if (fieldType == FieldDescriptor.Type.UINT32 || fieldType == FieldDescriptor.Type.UINT64 ||
+                    fieldType == FieldDescriptor.Type.FIXED32  || fieldType == FieldDescriptor.Type.FIXED64) {
                     if (((RubyNumeric) value).isNegative()) {
                         throw runtime.newRangeError("Assigning negative value to unsigned integer field '" + fieldName + "' (given " + value.getMetaClass() + ").");
                     }
@@ -94,9 +100,11 @@
                         RubyNumeric.num2int(value);
                         break;
                     case UINT32:
+                    case FIXED32:
                         num2uint(value);
                         break;
                     case UINT64:
+                    case FIXED64:
                         num2ulong(context.runtime, value);
                         break;
                     default:
@@ -183,14 +191,24 @@
     }
 
     public static IRubyObject wrapPrimaryValue(ThreadContext context, FieldDescriptor.Type fieldType, Object value) {
+        return wrapPrimaryValue(context, fieldType, value, false);
+    }
+
+    public static IRubyObject wrapPrimaryValue(ThreadContext context, FieldDescriptor.Type fieldType, Object value, boolean encodeBytes) {
         Ruby runtime = context.runtime;
         switch (fieldType) {
             case INT32:
+            case SFIXED32:
+            case SINT32:
                 return runtime.newFixnum((Integer) value);
+            case SFIXED64:
+            case SINT64:
             case INT64:
                 return runtime.newFixnum((Long) value);
+            case FIXED32:
             case UINT32:
                 return runtime.newFixnum(((Integer) value) & (-1l >>> 32));
+            case FIXED64:
             case UINT64:
                 long ret = (Long) value;
                 return ret >= 0 ? runtime.newFixnum(ret) :
@@ -202,7 +220,9 @@
             case BOOL:
                 return (Boolean) value ? runtime.getTrue() : runtime.getFalse();
             case BYTES: {
-                IRubyObject wrapped = RubyString.newString(runtime, ((ByteString) value).toStringUtf8(), ASCIIEncoding.INSTANCE);
+                IRubyObject wrapped = encodeBytes ?
+                    RubyString.newString(runtime, ((ByteString) value).toStringUtf8(), ASCIIEncoding.INSTANCE) :
+                    RubyString.newString(runtime, ((ByteString) value).toByteArray());
                 wrapped.setFrozen(true);
                 return wrapped;
             }
@@ -260,58 +280,6 @@
                 fieldDescriptor.getMessageType().getOptions().getMapEntry();
     }
 
-    /*
-     * call-seq:
-     *     Utils.createFieldBuilder(context, label, name, type, number, typeClass = nil, options = nil)
-     *
-     * Most places calling this are already dealing with an optional number of
-     * arguments so dealing with them here. This helper is a standard way to
-     * create a FieldDescriptor builder that handles some of the options that
-     * are used in different places.
-     */
-    public static FieldDescriptorProto.Builder createFieldBuilder(ThreadContext context,
-            String label, IRubyObject[] args) {
-
-        Ruby runtime = context.runtime;
-        IRubyObject options = context.nil;
-        IRubyObject typeClass = context.nil;
-
-        if (args.length > 4) {
-            options = args[4];
-            typeClass = args[3];
-        } else if (args.length > 3) {
-            if (args[3] instanceof RubyHash) {
-                options = args[3];
-            } else {
-                typeClass = args[3];
-            }
-        }
-
-        FieldDescriptorProto.Builder builder = FieldDescriptorProto.newBuilder();
-
-        builder.setLabel(FieldDescriptorProto.Label.valueOf("LABEL_" + label.toUpperCase()))
-            .setName(args[0].asJavaString())
-            .setNumber(RubyNumeric.num2int(args[2]))
-            .setType(FieldDescriptorProto.Type.valueOf("TYPE_" + args[1].asJavaString().toUpperCase()));
-
-        if (!typeClass.isNil()) {
-            if (!(typeClass instanceof RubyString)) {
-                throw runtime.newArgumentError("expected string for type class");
-            }
-            builder.setTypeName("." + typeClass.asJavaString());
-        }
-
-        if (options instanceof RubyHash) {
-            IRubyObject defaultValue = ((RubyHash) options).fastARef(runtime.newSymbol("default"));
-            if (defaultValue != null) {
-                builder.setDefaultValue(defaultValue.toString());
-            }
-        }
-
-        return builder;
-    }
-
-
     public static RaiseException createTypeError(ThreadContext context, String message) {
         if (cTypeError == null) {
             cTypeError = (RubyClass) context.runtime.getClassFromPath("Google::Protobuf::TypeError");
diff --git a/ruby/src/main/java/google/ProtobufJavaService.java b/ruby/src/main/java/google/ProtobufJavaService.java
index a364719..713891e 100644
--- a/ruby/src/main/java/google/ProtobufJavaService.java
+++ b/ruby/src/main/java/google/ProtobufJavaService.java
@@ -49,18 +49,13 @@
          * need to exist before we try to save a reference to them
          */
         RubyProtobuf.createProtobuf(ruby);
-        RubyBuilder.createRubyBuilder(ruby);
         RubyFileDescriptor.createRubyFileDescriptor(ruby);
         RubyEnumDescriptor.createRubyEnumDescriptor(ruby);
-        RubyEnumBuilderContext.createRubyEnumBuilderContext(ruby);
         RubyRepeatedField.createRubyRepeatedField(ruby);
         RubyFieldDescriptor.createRubyFieldDescriptor(ruby);
         RubyMap.createRubyMap(ruby);
         RubyOneofDescriptor.createRubyOneofDescriptor(ruby);
-        RubyOneofBuilderContext.createRubyOneofBuilderContext(ruby);
-        RubyMessageBuilderContext.createRubyMessageBuilderContext(ruby);
         RubyDescriptor.createRubyDescriptor(ruby);
-        RubyFileBuilderContext.createRubyFileBuilderContext(ruby);
         RubyDescriptorPool.createRubyDescriptorPool(ruby);
         return true;
     }
diff --git a/ruby/tests/basic.rb b/ruby/tests/basic.rb
index ed15bde..b9d1554 100755
--- a/ruby/tests/basic.rb
+++ b/ruby/tests/basic.rb
@@ -66,10 +66,19 @@
     def test_issue_8559_crash
       msg = TestMessage.new
       msg.repeated_int32 = ::Google::Protobuf::RepeatedField.new(:int32, [1, 2, 3])
-      GC.start(full_mark: true, immediate_sweep: true)
+      # TODO: Remove the platform check once https://github.com/jruby/jruby/issues/6818 is released in JRuby 9.3.0.0
+      GC.start(full_mark: true, immediate_sweep: true) unless RUBY_PLATFORM == "java"
       TestMessage.encode(msg)
     end
 
+    def test_issue_9440
+      msg = HelloRequest.new
+      msg.id = 8
+      assert_equal 8, msg.id
+      msg.version = '1'
+      assert_equal 8, msg.id
+    end
+
     def test_has_field
       m = TestSingularFields.new
       assert !m.has_singular_msg?
@@ -619,5 +628,21 @@
       assert_raise(FrozenErrorType) { m.map_string_int32.delete('a') }
       assert_raise(FrozenErrorType) { m.map_string_int32.clear }
     end
+
+    def test_map_length
+      m = proto_module::MapMessage.new
+      assert_equal 0, m.map_string_int32.length
+      assert_equal 0, m.map_string_msg.length
+      assert_equal 0, m.map_string_int32.size
+      assert_equal 0, m.map_string_msg.size
+
+      m.map_string_int32['a'] = 1
+      m.map_string_int32['b'] = 2
+      m.map_string_msg['a'] = proto_module::TestMessage2.new
+      assert_equal 2, m.map_string_int32.length
+      assert_equal 1, m.map_string_msg.length
+      assert_equal 2, m.map_string_int32.size
+      assert_equal 1, m.map_string_msg.size
+    end
   end
 end
diff --git a/ruby/tests/basic_test.proto b/ruby/tests/basic_test.proto
index bca172a..fb70f47 100644
--- a/ruby/tests/basic_test.proto
+++ b/ruby/tests/basic_test.proto
@@ -215,3 +215,38 @@
   optional int32 foo_bar = 1 [json_name="jsonFooBar"];
   repeated WithJsonName baz = 2 [json_name="jsonBaz"];
 }
+
+message HelloRequest {
+  optional uint32 id = 1;
+  optional uint32 random_name_a0 = 2;
+  optional uint32 random_name_a1 = 3;
+  optional uint32 random_name_a2 = 4;
+  optional uint32 random_name_a3 = 5;
+  optional uint32 random_name_a4 = 6;
+  optional uint32 random_name_a5 = 7;
+  optional uint32 random_name_a6 = 8;
+  optional uint32 random_name_a7 = 9;
+  optional uint32 random_name_a8 = 10;
+  optional uint32 random_name_a9 = 11;
+  optional uint32 random_name_b0 = 12;
+  optional uint32 random_name_b1 = 13;
+  optional uint32 random_name_b2 = 14;
+  optional uint32 random_name_b3 = 15;
+  optional uint32 random_name_b4 = 16;
+  optional uint32 random_name_b5 = 17;
+  optional uint32 random_name_b6 = 18;
+  optional uint32 random_name_b7 = 19;
+  optional uint32 random_name_b8 = 20;
+  optional uint32 random_name_b9 = 21;
+  optional uint32 random_name_c0 = 22;
+  optional uint32 random_name_c1 = 23;
+  optional uint32 random_name_c2 = 24;
+  optional uint32 random_name_c3 = 25;
+  optional uint32 random_name_c4 = 26;
+  optional uint32 random_name_c5 = 27;
+  optional uint32 random_name_c6 = 28;
+  optional uint32 random_name_c7 = 29;
+  optional uint32 random_name_c8 = 30;
+  optional uint32 random_name_c9 = 31;
+  optional string version = 32;
+}
diff --git a/ruby/tests/common_tests.rb b/ruby/tests/common_tests.rb
index 7021d60..3d9f67e 100644
--- a/ruby/tests/common_tests.rb
+++ b/ruby/tests/common_tests.rb
@@ -1781,21 +1781,24 @@
   def test_object_gc
     m = proto_module::TestMessage.new(optional_msg: proto_module::TestMessage2.new)
     m.optional_msg
-    GC.start(full_mark: true, immediate_sweep: true)
+    # TODO: Remove the platform check once https://github.com/jruby/jruby/issues/6818 is released in JRuby 9.3.0.0
+    GC.start(full_mark: true, immediate_sweep: true) unless RUBY_PLATFORM == "java"
     m.optional_msg.inspect
   end
 
   def test_object_gc_freeze
     m = proto_module::TestMessage.new
     m.repeated_float.freeze
-    GC.start(full_mark: true)
+    # TODO: Remove the platform check once https://github.com/jruby/jruby/issues/6818 is released in JRuby 9.3.0.0
+    GC.start(full_mark: true) unless RUBY_PLATFORM == "java"
 
     # Make sure we remember that the object is frozen.
     # The wrapper object contains this information, so we need to ensure that
     # the previous GC did not collect it.
     assert m.repeated_float.frozen?
 
-    GC.start(full_mark: true, immediate_sweep: true)
+    # TODO: Remove the platform check once https://github.com/jruby/jruby/issues/6818 is released in JRuby 9.3.0.0
+    GC.start(full_mark: true, immediate_sweep: true) unless RUBY_PLATFORM == "java"
     assert m.repeated_float.frozen?
   end
 end
diff --git a/ruby/tests/stress.rb b/ruby/tests/stress.rb
index 082d5e2..6a3f51d 100755
--- a/ruby/tests/stress.rb
+++ b/ruby/tests/stress.rb
@@ -30,7 +30,7 @@
       100_000.times do
         mnew = TestMessage.decode(data)
         mnew = mnew.dup
-        assert_equal mnew.inspect, m.inspect
+        assert_equal m.inspect, mnew.inspect
         assert TestMessage.encode(mnew) == data
       end
     end
diff --git a/ruby/tests/well_known_types_test.rb b/ruby/tests/well_known_types_test.rb
index ea042eb..c069764 100755
--- a/ruby/tests/well_known_types_test.rb
+++ b/ruby/tests/well_known_types_test.rb
@@ -15,16 +15,20 @@
 
     # millisecond accuracy
     time = Time.at(123456, 654321)
-    ts.from_time(time)
+    ts = Google::Protobuf::Timestamp.from_time(time)
     assert_equal 123456, ts.seconds
     assert_equal 654321000, ts.nanos
     assert_equal time, ts.to_time
 
     # nanosecond accuracy
     time = Time.at(123456, Rational(654321321, 1000))
-    ts.from_time(time)
+    ts = Google::Protobuf::Timestamp.from_time(time)
     assert_equal 654321321, ts.nanos
     assert_equal time, ts.to_time
+
+    # Instance method returns the same value as class method
+    assert_equal Google::Protobuf::Timestamp.new.from_time(time),
+                 Google::Protobuf::Timestamp.from_time(time)
   end
 
   def test_duration
diff --git a/ruby/travis-test.sh b/ruby/travis-test.sh
index b57d8b2..f7fa815 100755
--- a/ruby/travis-test.sh
+++ b/ruby/travis-test.sh
@@ -8,26 +8,26 @@
 
   RUBY_CONFORMANCE=test_ruby
 
-  if [ "$version" == "jruby-9.2.11.1" ] ; then
+  if [[ $version == jruby-9* ]] ; then
     bash --login -c \
       "rvm install $version && rvm use $version && rvm get head && \
        which ruby && \
        git clean -f && \
-       gem install bundler && bundle && \
-       rake test &&
-       rake gc_test &&
-       cd ../conformance && make test_jruby &&
+       gem install --no-document bundler && bundle && \
+       rake test && \
+       rake gc_test && \
+       cd ../conformance && make test_jruby && \
        cd ../ruby/compatibility_tests/v3.0.0 && ./test.sh"
   else
     bash --login -c \
       "rvm install $version && rvm use $version && \
        which ruby && \
        git clean -f && \
-       gem install bundler -v 1.17.3 && bundle && \
-       rake test &&
-       rake gc_test &&
-       cd ../conformance && make ${RUBY_CONFORMANCE} &&
-       cd ../ruby/compatibility_tests/v3.0.0 &&
+       gem install --no-document bundler -v 1.17.3 && bundle && \
+       rake test && \
+       rake gc_test && \
+       cd ../conformance && make ${RUBY_CONFORMANCE} && \
+       cd ../ruby/compatibility_tests/v3.0.0 && \
        cp -R ../../lib lib && ./test.sh"
   fi
 }
diff --git a/src/Makefile.am b/src/Makefile.am
index 3da92e7..225061a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,7 +18,7 @@
 PTHREAD_DEF =
 endif
 
-PROTOBUF_VERSION = 29:1:0
+PROTOBUF_VERSION = 30:4:0
 
 if GCC
 # Turn on all warnings except for sign comparison (we ignore sign comparison
@@ -73,15 +73,19 @@
   google/protobuf/arenastring.h                                  \
   google/protobuf/compiler/code_generator.h                      \
   google/protobuf/compiler/command_line_interface.h              \
+  google/protobuf/compiler/cpp/cpp_file.h                        \
   google/protobuf/compiler/cpp/cpp_generator.h                   \
+  google/protobuf/compiler/cpp/cpp_helpers.h                     \
+  google/protobuf/compiler/cpp/cpp_names.h                       \
+  google/protobuf/compiler/csharp/csharp_doc_comment.h           \
   google/protobuf/compiler/csharp/csharp_generator.h             \
   google/protobuf/compiler/csharp/csharp_names.h                 \
+  google/protobuf/compiler/csharp/csharp_options.h               \
   google/protobuf/compiler/importer.h                            \
   google/protobuf/compiler/java/java_generator.h                 \
   google/protobuf/compiler/java/java_kotlin_generator.h          \
   google/protobuf/compiler/java/java_names.h                     \
   google/protobuf/compiler/js/js_generator.h                     \
-  google/protobuf/compiler/js/well_known_types_embed.h           \
   google/protobuf/compiler/objectivec/objectivec_generator.h     \
   google/protobuf/compiler/objectivec/objectivec_helpers.h       \
   google/protobuf/compiler/parser.h                              \
@@ -96,6 +100,7 @@
   google/protobuf/duration.pb.h                                  \
   google/protobuf/dynamic_message.h                              \
   google/protobuf/empty.pb.h                                     \
+  google/protobuf/explicitly_constructed.h                       \
   google/protobuf/extension_set.h                                \
   google/protobuf/extension_set_inl.h                            \
   google/protobuf/field_access_listener.h                        \
@@ -105,6 +110,7 @@
   google/protobuf/generated_message_bases.h                      \
   google/protobuf/generated_message_reflection.h                 \
   google/protobuf/generated_message_table_driven.h               \
+  google/protobuf/generated_message_table_driven_lite.h          \
   google/protobuf/generated_message_tctable_decl.h               \
   google/protobuf/generated_message_tctable_impl.h               \
   google/protobuf/generated_message_tctable_impl.inc             \
@@ -133,15 +139,15 @@
   google/protobuf/metadata.h                                     \
   google/protobuf/metadata_lite.h                                \
   google/protobuf/parse_context.h                                \
+  google/protobuf/port.h                                         \
   google/protobuf/port_def.inc                                   \
   google/protobuf/port_undef.inc                                 \
-  google/protobuf/port.h                                         \
   google/protobuf/reflection.h                                   \
   google/protobuf/reflection_ops.h                               \
   google/protobuf/repeated_field.h                               \
+  google/protobuf/repeated_ptr_field.h                           \
   google/protobuf/service.h                                      \
   google/protobuf/source_context.pb.h                            \
-  google/protobuf/string_member_robber.h                         \
   google/protobuf/struct.pb.h                                    \
   google/protobuf/stubs/bytestream.h                             \
   google/protobuf/stubs/callback.h                               \
@@ -191,7 +197,7 @@
   google/protobuf/extension_set.cc                             \
   google/protobuf/generated_enum_util.cc                       \
   google/protobuf/generated_message_table_driven_lite.cc       \
-  google/protobuf/generated_message_table_driven_lite.h        \
+  google/protobuf/generated_message_tctable_lite.cc            \
   google/protobuf/generated_message_util.cc                    \
   google/protobuf/implicit_weak_message.cc                     \
   google/protobuf/inlined_string_field.cc                      \
@@ -205,21 +211,18 @@
   google/protobuf/message_lite.cc                              \
   google/protobuf/parse_context.cc                             \
   google/protobuf/repeated_field.cc                            \
+  google/protobuf/repeated_ptr_field.cc                        \
+  google/protobuf/string_member_robber.h                       \
   google/protobuf/stubs/bytestream.cc                          \
-  google/protobuf/stubs/bytestream.h                           \
   google/protobuf/stubs/common.cc                              \
-  google/protobuf/stubs/hash.h                                 \
   google/protobuf/stubs/int128.cc                              \
   google/protobuf/stubs/int128.h                               \
-  google/protobuf/stubs/map_util.h                             \
   google/protobuf/stubs/mathutil.h                             \
-  google/protobuf/stubs/status_macros.h                        \
   google/protobuf/stubs/status.cc                              \
-  google/protobuf/stubs/status.h                               \
+  google/protobuf/stubs/status_macros.h                        \
   google/protobuf/stubs/statusor.cc                            \
   google/protobuf/stubs/statusor.h                             \
   google/protobuf/stubs/stringpiece.cc                         \
-  google/protobuf/stubs/stringpiece.h                          \
   google/protobuf/stubs/stringprintf.cc                        \
   google/protobuf/stubs/stringprintf.h                         \
   google/protobuf/stubs/structurally_valid.cc                  \
@@ -252,7 +255,7 @@
   google/protobuf/generated_message_bases.cc                   \
   google/protobuf/generated_message_reflection.cc              \
   google/protobuf/generated_message_table_driven.cc            \
-  google/protobuf/generated_message_table_driven_lite.h        \
+  google/protobuf/generated_message_tctable_full.cc            \
   google/protobuf/io/gzip_stream.cc                            \
   google/protobuf/io/printer.cc                                \
   google/protobuf/io/tokenizer.cc                              \
@@ -303,7 +306,6 @@
   google/protobuf/util/internal/structured_objectwriter.h      \
   google/protobuf/util/internal/type_info.cc                   \
   google/protobuf/util/internal/type_info.h                    \
-  google/protobuf/util/internal/type_info_test_helper.cc       \
   google/protobuf/util/internal/type_info_test_helper.h        \
   google/protobuf/util/internal/utility.cc                     \
   google/protobuf/util/internal/utility.h                      \
@@ -334,10 +336,8 @@
   google/protobuf/compiler/cpp/cpp_field.cc                    \
   google/protobuf/compiler/cpp/cpp_field.h                     \
   google/protobuf/compiler/cpp/cpp_file.cc                     \
-  google/protobuf/compiler/cpp/cpp_file.h                      \
   google/protobuf/compiler/cpp/cpp_generator.cc                \
   google/protobuf/compiler/cpp/cpp_helpers.cc                  \
-  google/protobuf/compiler/cpp/cpp_helpers.h                   \
   google/protobuf/compiler/cpp/cpp_map_field.cc                \
   google/protobuf/compiler/cpp/cpp_map_field.h                 \
   google/protobuf/compiler/cpp/cpp_message.cc                  \
@@ -345,7 +345,6 @@
   google/protobuf/compiler/cpp/cpp_message_field.cc            \
   google/protobuf/compiler/cpp/cpp_message_field.h             \
   google/protobuf/compiler/cpp/cpp_message_layout_helper.h     \
-  google/protobuf/compiler/cpp/cpp_names.h                     \
   google/protobuf/compiler/cpp/cpp_options.h                   \
   google/protobuf/compiler/cpp/cpp_padding_optimizer.cc        \
   google/protobuf/compiler/cpp/cpp_padding_optimizer.h         \
@@ -358,7 +357,6 @@
   google/protobuf/compiler/cpp/cpp_string_field.cc             \
   google/protobuf/compiler/cpp/cpp_string_field.h              \
   google/protobuf/compiler/csharp/csharp_doc_comment.cc        \
-  google/protobuf/compiler/csharp/csharp_doc_comment.h         \
   google/protobuf/compiler/csharp/csharp_enum.cc               \
   google/protobuf/compiler/csharp/csharp_enum.h                \
   google/protobuf/compiler/csharp/csharp_enum_field.cc         \
@@ -374,11 +372,10 @@
   google/protobuf/compiler/csharp/csharp_message.h             \
   google/protobuf/compiler/csharp/csharp_message_field.cc      \
   google/protobuf/compiler/csharp/csharp_message_field.h       \
-  google/protobuf/compiler/csharp/csharp_options.h             \
   google/protobuf/compiler/csharp/csharp_primitive_field.cc    \
   google/protobuf/compiler/csharp/csharp_primitive_field.h     \
-  google/protobuf/compiler/csharp/csharp_reflection_class.cc     \
-  google/protobuf/compiler/csharp/csharp_reflection_class.h      \
+  google/protobuf/compiler/csharp/csharp_reflection_class.cc   \
+  google/protobuf/compiler/csharp/csharp_reflection_class.h    \
   google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc \
   google/protobuf/compiler/csharp/csharp_repeated_enum_field.h \
   google/protobuf/compiler/csharp/csharp_repeated_message_field.cc \
@@ -448,6 +445,7 @@
   google/protobuf/compiler/java/java_string_field_lite.h       \
   google/protobuf/compiler/js/js_generator.cc                  \
   google/protobuf/compiler/js/well_known_types_embed.cc        \
+  google/protobuf/compiler/js/well_known_types_embed.h         \
   google/protobuf/compiler/objectivec/objectivec_enum.cc       \
   google/protobuf/compiler/objectivec/objectivec_enum.h        \
   google/protobuf/compiler/objectivec/objectivec_enum_field.cc \
@@ -460,7 +458,6 @@
   google/protobuf/compiler/objectivec/objectivec_file.h        \
   google/protobuf/compiler/objectivec/objectivec_generator.cc  \
   google/protobuf/compiler/objectivec/objectivec_helpers.cc    \
-  google/protobuf/compiler/objectivec/objectivec_helpers.h     \
   google/protobuf/compiler/objectivec/objectivec_map_field.cc  \
   google/protobuf/compiler/objectivec/objectivec_map_field.h   \
   google/protobuf/compiler/objectivec/objectivec_message.cc    \
@@ -542,19 +539,19 @@
 
 EXTRA_DIST =                                                   \
   $(protoc_inputs)                                             \
-  solaris/libstdc++.la                                         \
+  README.md                                                    \
   google/protobuf/compiler/package_info.h                      \
   google/protobuf/compiler/ruby/ruby_generated_code.proto      \
   google/protobuf/compiler/ruby/ruby_generated_code_pb.rb      \
-  google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto         \
-  google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto         \
-  google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb         \
-  google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto        \
+  google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto \
+  google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto \
+  google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb \
+  google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto \
   google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto \
   google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy_pb.rb \
-  google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb        \
-  google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto        \
-  google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb        \
+  google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_pb.rb \
+  google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto \
+  google/protobuf/compiler/ruby/ruby_generated_pkg_implicit_pb.rb \
   google/protobuf/compiler/zip_output_unittest.sh              \
   google/protobuf/io/gzip_stream.h                             \
   google/protobuf/io/gzip_stream_unittest.sh                   \
@@ -570,16 +567,16 @@
   google/protobuf/testdata/golden_packed_fields_message        \
   google/protobuf/testdata/map_test_data.txt                   \
   google/protobuf/testdata/text_format_unittest_data.txt       \
-  google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt  \
-  google/protobuf/testdata/text_format_unittest_data_pointy.txt             \
-  google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt       \
-  google/protobuf/testdata/text_format_unittest_extensions_data.txt         \
-  google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt  \
+  google/protobuf/testdata/text_format_unittest_data_oneof_implemented.txt \
+  google/protobuf/testdata/text_format_unittest_data_pointy.txt \
+  google/protobuf/testdata/text_format_unittest_data_pointy_oneof.txt \
+  google/protobuf/testdata/text_format_unittest_extensions_data.txt \
+  google/protobuf/testdata/text_format_unittest_extensions_data_pointy.txt \
   google/protobuf/util/package_info.h                          \
   libprotobuf-lite.map                                         \
   libprotobuf.map                                              \
   libprotoc.map                                                \
-  README.md
+  solaris/libstdc++.la                                        
 
 protoc_lite_outputs =                                          \
   google/protobuf/map_lite_unittest.pb.cc                      \
@@ -704,11 +701,10 @@
 $(protoc_outputs): unittest_proto_middleman
 
 COMMON_TEST_SOURCES =                                          \
-  google/protobuf/arena_test_util.cc                           \
-  google/protobuf/arena_test_util.h                            \
+  $(COMMON_LITE_TEST_SOURCES)                                  \
+  google/protobuf/compiler/cpp/cpp_unittest.h                  \
   google/protobuf/map_test_util.h                              \
   google/protobuf/map_test_util.inc                            \
-  google/protobuf/map_test_util_impl.h                         \
   google/protobuf/reflection_tester.cc                         \
   google/protobuf/reflection_tester.h                          \
   google/protobuf/test_util.cc                                 \
@@ -738,6 +734,7 @@
 # See configure.ac for more info.
 protobuf_test_CXXFLAGS = $(NO_OPT_CXXFLAGS)
 protobuf_test_SOURCES =                                        \
+  $(COMMON_TEST_SOURCES)                                       \
   google/protobuf/any_test.cc                                  \
   google/protobuf/arena_unittest.cc                            \
   google/protobuf/arenastring_unittest.cc                      \
@@ -748,7 +745,6 @@
   google/protobuf/compiler/cpp/cpp_move_unittest.cc            \
   google/protobuf/compiler/cpp/cpp_plugin_unittest.cc          \
   google/protobuf/compiler/cpp/cpp_unittest.cc                 \
-  google/protobuf/compiler/cpp/cpp_unittest.h                  \
   google/protobuf/compiler/cpp/cpp_unittest.inc                \
   google/protobuf/compiler/cpp/metadata_test.cc                \
   google/protobuf/compiler/csharp/csharp_bootstrap_unittest.cc \
@@ -816,8 +812,7 @@
   google/protobuf/util/type_resolver_util_test.cc              \
   google/protobuf/well_known_types_unittest.cc                 \
   google/protobuf/wire_format_unittest.cc                      \
-  google/protobuf/wire_format_unittest.inc                     \
-  $(COMMON_TEST_SOURCES)
+  google/protobuf/wire_format_unittest.inc
 
 nodist_protobuf_test_SOURCES = $(protoc_outputs)
 $(am_protobuf_test_OBJECTS): unittest_proto_middleman
@@ -843,6 +838,7 @@
   google/protobuf/arena_test_util.h                                    \
   google/protobuf/map_lite_test_util.cc                                \
   google/protobuf/map_lite_test_util.h                                 \
+  google/protobuf/map_test_util_impl.h                                 \
   google/protobuf/test_util_lite.cc                                    \
   google/protobuf/test_util_lite.h
 
diff --git a/src/README.md b/src/README.md
index 51d9e2f..9db40fd 100644
--- a/src/README.md
+++ b/src/README.md
@@ -19,7 +19,7 @@
 
 On Ubuntu/Debian, you can install them with:
 
-    $ sudo apt-get install autoconf automake libtool curl make g++ unzip
+    sudo apt-get install autoconf automake libtool curl make g++ unzip
 
 On other platforms, please use the corresponding package managing tool to
 install them before proceeding.
diff --git a/src/google/protobuf/any.cc b/src/google/protobuf/any.cc
index 955dd80..73c002f 100644
--- a/src/google/protobuf/any.cc
+++ b/src/google/protobuf/any.cc
@@ -45,13 +45,11 @@
   return PackFrom(arena, message, kTypeGoogleApisComPrefix);
 }
 
-bool AnyMetadata::PackFrom(Arena* arena,
-                           const Message& message,
+bool AnyMetadata::PackFrom(Arena* arena, const Message& message,
                            StringPiece type_url_prefix) {
   type_url_->Set(
       &::PROTOBUF_NAMESPACE_ID::internal::GetEmptyString(),
-      GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix),
-      arena);
+      GetTypeUrl(message.GetDescriptor()->full_name(), type_url_prefix), arena);
   return message.SerializeToString(
       value_->Mutable(ArenaStringPtr::EmptyDefault{}, arena));
 }
@@ -72,9 +70,9 @@
   }
   *type_url_field = descriptor->FindFieldByNumber(1);
   *value_field = descriptor->FindFieldByNumber(2);
-  return (*type_url_field != NULL &&
+  return (*type_url_field != nullptr &&
           (*type_url_field)->type() == FieldDescriptor::TYPE_STRING &&
-          *value_field != NULL &&
+          *value_field != nullptr &&
           (*value_field)->type() == FieldDescriptor::TYPE_BYTES);
 }
 
diff --git a/src/google/protobuf/any.h b/src/google/protobuf/any.h
index 3ec8294..e8336fa 100644
--- a/src/google/protobuf/any.h
+++ b/src/google/protobuf/any.h
@@ -82,11 +82,14 @@
   // URL: "type.googleapis.com/<message_full_name>".
   // Returns false if serializing the message failed.
   template <typename T>
-  bool PackFrom(Arena* arena, const T& message, StringPiece type_url_prefix) {
-    return InternalPackFrom(arena, message, type_url_prefix, T::FullMessageName());
+  bool PackFrom(Arena* arena, const T& message,
+                StringPiece type_url_prefix) {
+    return InternalPackFrom(arena, message, type_url_prefix,
+                            T::FullMessageName());
   }
 
-  bool PackFrom(Arena* arena, const Message& message, StringPiece type_url_prefix);
+  bool PackFrom(Arena* arena, const Message& message,
+                StringPiece type_url_prefix);
 
   // Unpacks the payload into the given message. Returns false if the message's
   // type doesn't match the type specified in the type URL (i.e., the full
@@ -108,8 +111,7 @@
   }
 
  private:
-  bool InternalPackFrom(Arena* arena,
-                        const MessageLite& message,
+  bool InternalPackFrom(Arena* arena, const MessageLite& message,
                         StringPiece type_url_prefix,
                         StringPiece type_name);
   bool InternalUnpackTo(StringPiece type_name,
diff --git a/src/google/protobuf/any.pb.cc b/src/google/protobuf/any.pb.cc
index a32c3e7..52c6ccc 100644
--- a/src/google/protobuf/any.pb.cc
+++ b/src/google/protobuf/any.pb.cc
@@ -36,7 +36,7 @@
 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fany_2eproto = nullptr;
 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fany_2eproto = nullptr;
 
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fany_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   ~0u,  // no _has_bits_
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Any, _internal_metadata_),
   ~0u,  // no _extensions_
@@ -112,11 +112,17 @@
       _any_metadata_(&type_url_, &value_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_type_url().empty()) {
     type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_url(), 
       GetArenaForAllocation());
   }
   value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_value().empty()) {
     value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(), 
       GetArenaForAllocation());
@@ -124,9 +130,15 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Any)
 }
 
-void Any::SharedCtor() {
+inline void Any::SharedCtor() {
 type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 }
 
 Any::~Any() {
@@ -154,7 +166,7 @@
 
 void Any::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Any)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -166,12 +178,12 @@
 const char* Any::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // string type_url = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_type_url();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Any.type_url"));
@@ -181,7 +193,7 @@
         continue;
       // bytes value = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           auto str = _internal_mutable_value();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(ptr);
@@ -211,10 +223,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Any::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Any::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Any)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // string type_url = 1;
@@ -245,7 +257,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Any)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -282,7 +294,7 @@
 void Any::MergeFrom(const Any& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Any)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (!from._internal_type_url().empty()) {
diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h
index 13c5086..ff7ef9c 100644
--- a/src/google/protobuf/any.pb.h
+++ b/src/google/protobuf/any.pb.h
@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3018000
+#if PROTOBUF_VERSION < 3019000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
@@ -50,7 +50,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
   static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
-  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+  static const uint32_t offsets[];
 };
 PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fany_2eproto;
 PROTOBUF_NAMESPACE_OPEN
@@ -153,7 +153,12 @@
   }
   inline void Swap(Any* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -167,11 +172,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Any* New() const final {
-    return new Any();
-  }
-
-  Any* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Any* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Any>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -186,8 +187,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -195,6 +196,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Any* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Any";
@@ -226,7 +229,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_type_url(ArgT0&& arg0, ArgT... args);
   std::string* mutable_type_url();
-  PROTOBUF_MUST_USE_RESULT std::string* release_type_url();
+  PROTOBUF_NODISCARD std::string* release_type_url();
   void set_allocated_type_url(std::string* type_url);
   private:
   const std::string& _internal_type_url() const;
@@ -240,7 +243,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_value(ArgT0&& arg0, ArgT... args);
   std::string* mutable_value();
-  PROTOBUF_MUST_USE_RESULT std::string* release_value();
+  PROTOBUF_NODISCARD std::string* release_value();
   void set_allocated_value(std::string* value);
   private:
   const std::string& _internal_value() const;
@@ -315,6 +318,11 @@
   }
   type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.type_url)
 }
 
@@ -361,6 +369,11 @@
   }
   value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Any.value)
 }
 
diff --git a/src/google/protobuf/any_lite.cc b/src/google/protobuf/any_lite.cc
index 1fa06c7..a98559d 100644
--- a/src/google/protobuf/any_lite.cc
+++ b/src/google/protobuf/any_lite.cc
@@ -53,8 +53,7 @@
 const char kTypeGoogleApisComPrefix[] = "type.googleapis.com/";
 const char kTypeGoogleProdComPrefix[] = "type.googleprod.com/";
 
-bool AnyMetadata::InternalPackFrom(Arena* arena,
-                                   const MessageLite& message,
+bool AnyMetadata::InternalPackFrom(Arena* arena, const MessageLite& message,
                                    StringPiece type_url_prefix,
                                    StringPiece type_name) {
   type_url_->Set(&::google::protobuf::internal::GetEmptyString(),
diff --git a/src/google/protobuf/api.pb.cc b/src/google/protobuf/api.pb.cc
index 5cca2f1..72cc72e 100644
--- a/src/google/protobuf/api.pb.cc
+++ b/src/google/protobuf/api.pb.cc
@@ -73,7 +73,7 @@
 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr;
 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fapi_2eproto = nullptr;
 
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fapi_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   ~0u,  // no _has_bits_
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Api, _internal_metadata_),
   ~0u,  // no _extensions_
@@ -200,11 +200,17 @@
       mixins_(from.mixins_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_name().empty()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
   }
   version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_version().empty()) {
     version_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_version(), 
       GetArenaForAllocation());
@@ -218,9 +224,15 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Api)
 }
 
-void Api::SharedCtor() {
+inline void Api::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 version_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&source_context_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&syntax_) -
@@ -253,7 +265,7 @@
 
 void Api::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Api)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -273,12 +285,12 @@
 const char* Api::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Api.name"));
@@ -288,7 +300,7 @@
         continue;
       // repeated .google.protobuf.Method methods = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -301,7 +313,7 @@
         continue;
       // repeated .google.protobuf.Option options = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -314,7 +326,7 @@
         continue;
       // string version = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
           auto str = _internal_mutable_version();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Api.version"));
@@ -324,7 +336,7 @@
         continue;
       // .google.protobuf.SourceContext source_context = 5;
       case 5:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
           ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr);
           CHK_(ptr);
         } else
@@ -332,7 +344,7 @@
         continue;
       // repeated .google.protobuf.Mixin mixins = 6;
       case 6:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -345,8 +357,8 @@
         continue;
       // .google.protobuf.Syntax syntax = 7;
       case 7:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val));
         } else
@@ -375,10 +387,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Api::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Api::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Api)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // string name = 1;
@@ -452,7 +464,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Api)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -523,7 +535,7 @@
 void Api::MergeFrom(const Api& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Api)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   methods_.MergeFrom(from.methods_);
@@ -611,16 +623,25 @@
       options_(from.options_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_name().empty()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
   }
   request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_request_type_url().empty()) {
     request_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_request_type_url(), 
       GetArenaForAllocation());
   }
   response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_response_type_url().empty()) {
     response_type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_response_type_url(), 
       GetArenaForAllocation());
@@ -631,10 +652,19 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Method)
 }
 
-void Method::SharedCtor() {
+inline void Method::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 request_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 response_type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&request_streaming_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&syntax_) -
@@ -667,7 +697,7 @@
 
 void Method::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Method)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -684,12 +714,12 @@
 const char* Method::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.name"));
@@ -699,7 +729,7 @@
         continue;
       // string request_type_url = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           auto str = _internal_mutable_request_type_url();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.request_type_url"));
@@ -709,7 +739,7 @@
         continue;
       // bool request_streaming = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
           request_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
         } else
@@ -717,7 +747,7 @@
         continue;
       // string response_type_url = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
           auto str = _internal_mutable_response_type_url();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Method.response_type_url"));
@@ -727,7 +757,7 @@
         continue;
       // bool response_streaming = 5;
       case 5:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
           response_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
         } else
@@ -735,7 +765,7 @@
         continue;
       // repeated .google.protobuf.Option options = 6;
       case 6:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -748,8 +778,8 @@
         continue;
       // .google.protobuf.Syntax syntax = 7;
       case 7:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val));
         } else
@@ -778,10 +808,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Method::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Method::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Method)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // string name = 1;
@@ -853,7 +883,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Method)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -920,7 +950,7 @@
 void Method::MergeFrom(const Method& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Method)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   options_.MergeFrom(from.options_);
@@ -1010,11 +1040,17 @@
   : ::PROTOBUF_NAMESPACE_ID::Message() {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_name().empty()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
   }
   root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_root().empty()) {
     root_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_root(), 
       GetArenaForAllocation());
@@ -1022,9 +1058,15 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Mixin)
 }
 
-void Mixin::SharedCtor() {
+inline void Mixin::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 root_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 }
 
 Mixin::~Mixin() {
@@ -1052,7 +1094,7 @@
 
 void Mixin::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Mixin)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1064,12 +1106,12 @@
 const char* Mixin::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Mixin.name"));
@@ -1079,7 +1121,7 @@
         continue;
       // string root = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           auto str = _internal_mutable_root();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Mixin.root"));
@@ -1110,10 +1152,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Mixin::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Mixin::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Mixin)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // string name = 1;
@@ -1148,7 +1190,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Mixin)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1185,7 +1227,7 @@
 void Mixin::MergeFrom(const Mixin& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Mixin)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (!from._internal_name().empty()) {
diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h
index 347a9f9..093a02e 100644
--- a/src/google/protobuf/api.pb.h
+++ b/src/google/protobuf/api.pb.h
@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3018000
+#if PROTOBUF_VERSION < 3019000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
@@ -52,7 +52,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
   static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
-  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+  static const uint32_t offsets[];
 };
 PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fapi_2eproto;
 PROTOBUF_NAMESPACE_OPEN
@@ -130,7 +130,12 @@
   }
   inline void Swap(Api* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -144,11 +149,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Api* New() const final {
-    return new Api();
-  }
-
-  Api* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Api* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Api>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -163,8 +164,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -172,6 +173,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Api* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Api";
@@ -262,7 +265,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -276,7 +279,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_version(ArgT0&& arg0, ArgT... args);
   std::string* mutable_version();
-  PROTOBUF_MUST_USE_RESULT std::string* release_version();
+  PROTOBUF_NODISCARD std::string* release_version();
   void set_allocated_version(std::string* version);
   private:
   const std::string& _internal_version() const;
@@ -291,7 +294,7 @@
   public:
   void clear_source_context();
   const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
   ::PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context();
   void set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context);
   private:
@@ -385,7 +388,12 @@
   }
   inline void Swap(Method* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -399,11 +407,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Method* New() const final {
-    return new Method();
-  }
-
-  Method* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Method* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Method>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -418,8 +422,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -427,6 +431,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Method* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Method";
@@ -481,7 +487,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -495,7 +501,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_request_type_url(ArgT0&& arg0, ArgT... args);
   std::string* mutable_request_type_url();
-  PROTOBUF_MUST_USE_RESULT std::string* release_request_type_url();
+  PROTOBUF_NODISCARD std::string* release_request_type_url();
   void set_allocated_request_type_url(std::string* request_type_url);
   private:
   const std::string& _internal_request_type_url() const;
@@ -509,7 +515,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_response_type_url(ArgT0&& arg0, ArgT... args);
   std::string* mutable_response_type_url();
-  PROTOBUF_MUST_USE_RESULT std::string* release_response_type_url();
+  PROTOBUF_NODISCARD std::string* release_response_type_url();
   void set_allocated_response_type_url(std::string* response_type_url);
   private:
   const std::string& _internal_response_type_url() const;
@@ -618,7 +624,12 @@
   }
   inline void Swap(Mixin* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -632,11 +643,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Mixin* New() const final {
-    return new Mixin();
-  }
-
-  Mixin* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Mixin* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Mixin>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -651,8 +658,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -660,6 +667,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Mixin* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Mixin";
@@ -691,7 +700,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -705,7 +714,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_root(ArgT0&& arg0, ArgT... args);
   std::string* mutable_root();
-  PROTOBUF_MUST_USE_RESULT std::string* release_root();
+  PROTOBUF_NODISCARD std::string* release_root();
   void set_allocated_root(std::string* root);
   private:
   const std::string& _internal_root() const;
@@ -779,6 +788,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.name)
 }
 
@@ -902,6 +916,11 @@
   }
   version_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), version,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (version_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    version_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Api.version)
 }
 
@@ -1098,6 +1117,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.name)
 }
 
@@ -1144,6 +1168,11 @@
   }
   request_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), request_type_url,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (request_type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    request_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.request_type_url)
 }
 
@@ -1210,6 +1239,11 @@
   }
   response_type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), response_type_url,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (response_type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    response_type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Method.response_type_url)
 }
 
@@ -1337,6 +1371,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.name)
 }
 
@@ -1383,6 +1422,11 @@
   }
   root_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), root,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (root_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    root_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Mixin.root)
 }
 
diff --git a/src/google/protobuf/arena.cc b/src/google/protobuf/arena.cc
index c12bf2b..7624e0b 100644
--- a/src/google/protobuf/arena.cc
+++ b/src/google/protobuf/arena.cc
@@ -216,31 +216,54 @@
 
 void ThreadSafeArena::InitializeFrom(void* mem, size_t size) {
   GOOGLE_DCHECK_EQ(reinterpret_cast<uintptr_t>(mem) & 7, 0u);
-  Init(false);
+  GOOGLE_DCHECK(!AllocPolicy());  // Reset should call InitializeWithPolicy instead.
+  Init();
 
   // Ignore initial block if it is too small.
   if (mem != nullptr && size >= kBlockHeaderSize + kSerialArenaSize) {
-    alloc_policy_ |= kUserOwnedInitialBlock;
+    alloc_policy_.set_is_user_owned_initial_block(true);
     SetInitialBlock(mem, size);
   }
 }
 
 void ThreadSafeArena::InitializeWithPolicy(void* mem, size_t size,
-                                           bool record_allocs,
                                            AllocationPolicy policy) {
-  GOOGLE_DCHECK_EQ(reinterpret_cast<uintptr_t>(mem) & 7, 0u);
+#ifndef NDEBUG
+  const uint64_t old_alloc_policy = alloc_policy_.get_raw();
+  // If there was a policy (e.g., in Reset()), make sure flags were preserved.
+#define GOOGLE_DCHECK_POLICY_FLAGS_() \
+  if (old_alloc_policy > 3)    \
+    GOOGLE_CHECK_EQ(old_alloc_policy & 3, alloc_policy_.get_raw() & 3)
+#else
+#define GOOGLE_DCHECK_POLICY_FLAGS_()
+#endif  // NDEBUG
 
-  Init(record_allocs);
+  if (policy.IsDefault()) {
+    // Legacy code doesn't use the API above, but provides the initial block
+    // through ArenaOptions. I suspect most do not touch the allocation
+    // policy parameters.
+    InitializeFrom(mem, size);
+    GOOGLE_DCHECK_POLICY_FLAGS_();
+    return;
+  }
+  GOOGLE_DCHECK_EQ(reinterpret_cast<uintptr_t>(mem) & 7, 0u);
+  Init();
 
   // Ignore initial block if it is too small. We include an optional
   // AllocationPolicy in this check, so that this can be allocated on the
   // first block.
   constexpr size_t kAPSize = internal::AlignUpTo8(sizeof(AllocationPolicy));
   constexpr size_t kMinimumSize = kBlockHeaderSize + kSerialArenaSize + kAPSize;
+
+  // The value for alloc_policy_ stores whether or not allocations should be
+  // recorded.
+  alloc_policy_.set_should_record_allocs(
+      policy.metrics_collector != nullptr &&
+      policy.metrics_collector->RecordAllocs());
+  // Make sure we have an initial block to store the AllocationPolicy.
   if (mem != nullptr && size >= kMinimumSize) {
-    alloc_policy_ = kUserOwnedInitialBlock;
+    alloc_policy_.set_is_user_owned_initial_block(true);
   } else {
-    alloc_policy_ = 0;
     auto tmp = AllocateMemory(&policy, 0, kMinimumSize);
     mem = tmp.ptr;
     size = tmp.size;
@@ -255,10 +278,18 @@
     return;
   }
   new (p) AllocationPolicy{policy};
-  alloc_policy_ |= reinterpret_cast<intptr_t>(p);
+  // Low bits store flags, so they mustn't be overwritten.
+  GOOGLE_DCHECK_EQ(0, reinterpret_cast<uintptr_t>(p) & 3);
+  alloc_policy_.set_policy(reinterpret_cast<AllocationPolicy*>(p));
+  GOOGLE_DCHECK_POLICY_FLAGS_();
+
+#undef GOOGLE_DCHECK_POLICY_FLAGS_
 }
 
-void ThreadSafeArena::Init(bool record_allocs) {
+void ThreadSafeArena::Init() {
+#ifndef NDEBUG
+  const bool was_message_owned = IsMessageOwned();
+#endif  // NDEBUG
   ThreadCache& tc = thread_cache();
   auto id = tc.next_lifecycle_id;
   // We increment lifecycle_id's by multiples of two so we can use bit 0 as
@@ -273,9 +304,14 @@
     id = lifecycle_id_generator_.id.fetch_add(1, relaxed) * kInc;
   }
   tc.next_lifecycle_id = id + kDelta;
-  tag_and_id_ = id | (record_allocs ? kRecordAllocs : 0);
+  // Message ownership is stored in tag_and_id_, and is set in the constructor.
+  // This flag bit must be preserved, even across calls to Reset().
+  tag_and_id_ = id | (tag_and_id_ & kMessageOwnedArena);
   hint_.store(nullptr, std::memory_order_relaxed);
   threads_.store(nullptr, std::memory_order_relaxed);
+#ifndef NDEBUG
+  GOOGLE_CHECK_EQ(was_message_owned, IsMessageOwned());
+#endif  // NDEBUG
 }
 
 void ThreadSafeArena::SetInitialBlock(void* mem, size_t size) {
@@ -294,13 +330,13 @@
   auto mem = Free(&space_allocated);
 
   // Policy is about to get deleted.
-  auto p = AllocPolicy();
+  auto* p = alloc_policy_.get();
   ArenaMetricsCollector* collector = p ? p->metrics_collector : nullptr;
 
-  if (alloc_policy_ & kUserOwnedInitialBlock) {
+  if (alloc_policy_.is_user_owned_initial_block()) {
     space_allocated += mem.size;
   } else {
-    GetDeallocator(AllocPolicy(), &space_allocated)(mem);
+    GetDeallocator(alloc_policy_.get(), &space_allocated)(mem);
   }
 
   if (collector) collector->OnDestroy(space_allocated);
@@ -308,7 +344,7 @@
 
 SerialArena::Memory ThreadSafeArena::Free(size_t* space_allocated) {
   SerialArena::Memory mem = {nullptr, 0};
-  auto deallocator = GetDeallocator(AllocPolicy(), space_allocated);
+  auto deallocator = GetDeallocator(alloc_policy_.get(), space_allocated);
   PerSerialArena([deallocator, &mem](SerialArena* a) {
     if (mem.ptr) deallocator(mem);
     mem = a->Free(deallocator);
@@ -325,26 +361,28 @@
   size_t space_allocated = 0;
   auto mem = Free(&space_allocated);
 
-  if (AllocPolicy()) {
-    auto saved_policy = *AllocPolicy();
-    if (alloc_policy_ & kUserOwnedInitialBlock) {
+  AllocationPolicy* policy = alloc_policy_.get();
+  if (policy) {
+    auto saved_policy = *policy;
+    if (alloc_policy_.is_user_owned_initial_block()) {
       space_allocated += mem.size;
     } else {
-      GetDeallocator(AllocPolicy(), &space_allocated)(mem);
+      GetDeallocator(alloc_policy_.get(), &space_allocated)(mem);
       mem.ptr = nullptr;
       mem.size = 0;
     }
     ArenaMetricsCollector* collector = saved_policy.metrics_collector;
     if (collector) collector->OnReset(space_allocated);
-    InitializeWithPolicy(mem.ptr, mem.size, ShouldRecordAlloc(), saved_policy);
+    InitializeWithPolicy(mem.ptr, mem.size, saved_policy);
   } else {
+    GOOGLE_DCHECK(!alloc_policy_.should_record_allocs());
     // Nullptr policy
-    if (alloc_policy_ & kUserOwnedInitialBlock) {
+    if (alloc_policy_.is_user_owned_initial_block()) {
       space_allocated += mem.size;
       InitializeFrom(mem.ptr, mem.size);
     } else {
-      GetDeallocator(AllocPolicy(), &space_allocated)(mem);
-      Init(false);
+      GetDeallocator(alloc_policy_.get(), &space_allocated)(mem);
+      Init();
     }
   }
 
@@ -355,8 +393,9 @@
 ThreadSafeArena::AllocateAlignedWithCleanup(size_t n,
                                             const std::type_info* type) {
   SerialArena* arena;
-  if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(tag_and_id_, &arena))) {
-    return arena->AllocateAlignedWithCleanup(n, AllocPolicy());
+  if (PROTOBUF_PREDICT_TRUE(!alloc_policy_.should_record_allocs() &&
+                            GetSerialArenaFast(&arena))) {
+    return arena->AllocateAlignedWithCleanup(n, alloc_policy_.get());
   } else {
     return AllocateAlignedWithCleanupFallback(n, type);
   }
@@ -364,46 +403,39 @@
 
 void ThreadSafeArena::AddCleanup(void* elem, void (*cleanup)(void*)) {
   SerialArena* arena;
-  if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(LifeCycleId(), &arena))) {
-    arena->AddCleanup(elem, cleanup, AllocPolicy());
-  } else {
-    return AddCleanupFallback(elem, cleanup);
+  if (PROTOBUF_PREDICT_FALSE(!GetSerialArenaFast(&arena))) {
+    arena = GetSerialArenaFallback(&thread_cache());
   }
+  arena->AddCleanup(elem, cleanup, AllocPolicy());
 }
 
 PROTOBUF_NOINLINE
 void* ThreadSafeArena::AllocateAlignedFallback(size_t n,
                                                const std::type_info* type) {
-  if (ShouldRecordAlloc()) {
-    RecordAlloc(type, n);
+  if (alloc_policy_.should_record_allocs()) {
+    alloc_policy_.RecordAlloc(type, n);
     SerialArena* arena;
-    if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(LifeCycleId(), &arena))) {
-      return arena->AllocateAligned(n, AllocPolicy());
+    if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(&arena))) {
+      return arena->AllocateAligned(n, alloc_policy_.get());
     }
   }
   return GetSerialArenaFallback(&thread_cache())
-      ->AllocateAligned(n, AllocPolicy());
+      ->AllocateAligned(n, alloc_policy_.get());
 }
 
 PROTOBUF_NOINLINE
 std::pair<void*, SerialArena::CleanupNode*>
 ThreadSafeArena::AllocateAlignedWithCleanupFallback(
     size_t n, const std::type_info* type) {
-  if (ShouldRecordAlloc()) {
-    RecordAlloc(type, n);
+  if (alloc_policy_.should_record_allocs()) {
+    alloc_policy_.RecordAlloc(type, n);
     SerialArena* arena;
-    if (GetSerialArenaFast(LifeCycleId(), &arena)) {
-      return arena->AllocateAlignedWithCleanup(n, AllocPolicy());
+    if (GetSerialArenaFast(&arena)) {
+      return arena->AllocateAlignedWithCleanup(n, alloc_policy_.get());
     }
   }
   return GetSerialArenaFallback(&thread_cache())
-      ->AllocateAlignedWithCleanup(n, AllocPolicy());
-}
-
-PROTOBUF_NOINLINE
-void ThreadSafeArena::AddCleanupFallback(void* elem, void (*cleanup)(void*)) {
-  GetSerialArenaFallback(&thread_cache())
-      ->AddCleanup(elem, cleanup, AllocPolicy());
+      ->AllocateAlignedWithCleanup(n, alloc_policy_.get());
 }
 
 uint64_t ThreadSafeArena::SpaceAllocated() const {
@@ -421,7 +453,7 @@
   for (; serial; serial = serial->next()) {
     space_used += serial->SpaceUsed();
   }
-  return space_used - (AllocPolicy() ? sizeof(AllocationPolicy) : 0);
+  return space_used - (alloc_policy_.get() ? sizeof(AllocationPolicy) : 0);
 }
 
 void ThreadSafeArena::CleanupList() {
@@ -442,7 +474,7 @@
     // This thread doesn't have any SerialArena, which also means it doesn't
     // have any blocks yet.  So we'll allocate its first block now.
     serial = SerialArena::New(
-        AllocateMemory(AllocPolicy(), 0, kSerialArenaSize), me);
+        AllocateMemory(alloc_policy_.get(), 0, kSerialArenaSize), me);
 
     SerialArena* head = threads_.load(std::memory_order_relaxed);
     do {
diff --git a/src/google/protobuf/arena.h b/src/google/protobuf/arena.h
index 8b1a6b5..6dd6467 100644
--- a/src/google/protobuf/arena.h
+++ b/src/google/protobuf/arena.h
@@ -65,13 +65,6 @@
 namespace protobuf {
 
 struct ArenaOptions;  // defined below
-
-}  // namespace protobuf
-}  // namespace google
-
-namespace google {
-namespace protobuf {
-
 class Arena;    // defined below
 class Message;  // defined in message.h
 class MessageLite;
@@ -414,6 +407,16 @@
           p, std::is_convertible<T*, MessageLite*>());
     }
 
+    // Creates message-owned arena.
+    static Arena* CreateMessageOwnedArena() {
+      return new Arena(internal::MessageOwned{});
+    }
+
+    // Checks whether the given arena is message-owned.
+    static bool IsMessageOwnedArena(Arena* arena) {
+      return arena->IsMessageOwned();
+    }
+
    private:
     static Arena* GetArenaForAllocationInternal(
         const T* p, std::true_type /*is_derived_from<MessageLite>*/) {
@@ -487,7 +490,7 @@
       return new (ptr) T(static_cast<Args&&>(args)...);
     }
 
-    static T* New() {
+    static inline PROTOBUF_ALWAYS_INLINE T* New() {
       return new T(nullptr);
     }
 
@@ -521,6 +524,14 @@
   template <typename T>
   struct has_get_arena : InternalHelper<T>::has_get_arena {};
 
+  // Constructor solely used by message-owned arena.
+  inline Arena(internal::MessageOwned) : impl_(internal::MessageOwned{}) {}
+
+  // Checks whether this arena is message-owned.
+  PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const {
+    return impl_.IsMessageOwned();
+  }
+
   template <typename T, typename... Args>
   PROTOBUF_NDEBUG_INLINE static T* CreateMessageInternal(Arena* arena,
                                                          Args&&... args) {
diff --git a/src/google/protobuf/arena_impl.h b/src/google/protobuf/arena_impl.h
index b47bad7..2ffac31 100644
--- a/src/google/protobuf/arena_impl.h
+++ b/src/google/protobuf/arena_impl.h
@@ -108,6 +108,75 @@
   }
 };
 
+// Tagged pointer to an AllocationPolicy.
+class TaggedAllocationPolicyPtr {
+ public:
+  constexpr TaggedAllocationPolicyPtr() : policy_(0) {}
+
+  explicit TaggedAllocationPolicyPtr(AllocationPolicy* policy)
+      : policy_(reinterpret_cast<uintptr_t>(policy)) {}
+
+  void set_policy(AllocationPolicy* policy) {
+    auto bits = policy_ & kTagsMask;
+    policy_ = reinterpret_cast<uintptr_t>(policy) | bits;
+  }
+
+  AllocationPolicy* get() {
+    return reinterpret_cast<AllocationPolicy*>(policy_ & kPtrMask);
+  }
+  const AllocationPolicy* get() const {
+    return reinterpret_cast<const AllocationPolicy*>(policy_ & kPtrMask);
+  }
+
+  AllocationPolicy& operator*() { return *get(); }
+  const AllocationPolicy& operator*() const { return *get(); }
+
+  AllocationPolicy* operator->() { return get(); }
+  const AllocationPolicy* operator->() const { return get(); }
+
+  bool is_user_owned_initial_block() const {
+    return static_cast<bool>(get_mask<kUserOwnedInitialBlock>());
+  }
+  void set_is_user_owned_initial_block(bool v) {
+    set_mask<kUserOwnedInitialBlock>(v);
+  }
+
+  bool should_record_allocs() const {
+    return static_cast<bool>(get_mask<kRecordAllocs>());
+  }
+  void set_should_record_allocs(bool v) { set_mask<kRecordAllocs>(v); }
+
+  uintptr_t get_raw() const { return policy_; }
+
+  inline void RecordAlloc(const std::type_info* allocated_type,
+                          size_t n) const {
+    get()->metrics_collector->OnAlloc(allocated_type, n);
+  }
+
+ private:
+  enum : uintptr_t {
+    kUserOwnedInitialBlock = 1,
+    kRecordAllocs = 2,
+  };
+
+  static constexpr uintptr_t kTagsMask = 7;
+  static constexpr uintptr_t kPtrMask = ~kTagsMask;
+
+  template <uintptr_t kMask>
+  uintptr_t get_mask() const {
+    return policy_ & kMask;
+  }
+  template <uintptr_t kMask>
+  void set_mask(bool v) {
+    if (v) {
+      policy_ |= kMask;
+    } else {
+      policy_ &= ~kMask;
+    }
+  }
+  uintptr_t policy_;
+};
+
 // A simple arena allocator. Calls to allocate functions must be properly
 // serialized by the caller, hence this class cannot be used as a general
 // purpose allocator in a multi-threaded program. It serves as a building block
@@ -133,13 +202,6 @@
     void (*cleanup)(void*);  // Function pointer to the destructor or deleter.
   };
 
-  // Creates a new SerialArena inside mem using the remaining memory as for
-  // future allocations.
-  static SerialArena* New(SerialArena::Memory mem, void* owner);
-  // Free SerialArena returning the memory passed in to New
-  template <typename Deallocator>
-  Memory Free(Deallocator deallocator);
-
   void CleanupList();
   uint64_t SpaceAllocated() const {
     return space_allocated_.load(std::memory_order_relaxed);
@@ -179,6 +241,7 @@
 
   std::pair<void*, CleanupNode*> AllocateAlignedWithCleanup(
       size_t n, const AllocationPolicy* policy) {
+    GOOGLE_DCHECK_EQ(internal::AlignUpTo8(n), n);  // Must be already aligned.
     if (PROTOBUF_PREDICT_FALSE(!HasSpace(n + kCleanupSize))) {
       return AllocateAlignedWithCleanupFallback(n, policy);
     }
@@ -211,6 +274,16 @@
   void set_next(SerialArena* next) { next_ = next; }
 
  private:
+  friend class ThreadSafeArena;
+  friend class ArenaBenchmark;
+
+  // Creates a new SerialArena inside mem using the remaining memory as for
+  // future allocations.
+  static SerialArena* New(SerialArena::Memory mem, void* owner);
+  // Free SerialArena returning the memory passed in to New
+  template <typename Deallocator>
+  Memory Free(Deallocator deallocator);
+
   // Blocks are variable length malloc-ed objects.  The following structure
   // describes the common header for all blocks.
   struct Block {
@@ -255,6 +328,13 @@
   static constexpr size_t kCleanupSize = AlignUpTo8(sizeof(CleanupNode));
 };
 
+// Tag type used to invoke the constructor of message-owned arena.
+// Only message-owned arenas use this constructor for creation.
+// Such constructors are internal implementation details of the library.
+struct MessageOwned {
+  explicit MessageOwned() = default;
+};
+
 // This class provides the core Arena memory allocation library. Different
 // implementations only need to implement the public interface below.
 // Arena is not a template type as that would only be useful if all protos
@@ -263,22 +343,18 @@
 // use #ifdef the select the best implementation based on hardware / OS.
 class PROTOBUF_EXPORT ThreadSafeArena {
  public:
-  ThreadSafeArena() { Init(false); }
+  ThreadSafeArena() { Init(); }
+
+  // Constructor solely used by message-owned arena.
+  ThreadSafeArena(internal::MessageOwned) : tag_and_id_(kMessageOwnedArena) {
+    Init();
+  }
 
   ThreadSafeArena(char* mem, size_t size) { InitializeFrom(mem, size); }
 
   explicit ThreadSafeArena(void* mem, size_t size,
                            const AllocationPolicy& policy) {
-    if (policy.IsDefault()) {
-      // Legacy code doesn't use the API above, but provides the initial block
-      // through ArenaOptions. I suspect most do not touch the allocation
-      // policy parameters.
-      InitializeFrom(mem, size);
-    } else {
-      auto collector = policy.metrics_collector;
-      bool record_allocs = collector && collector->RecordAllocs();
-      InitializeWithPolicy(mem, size, record_allocs, policy);
-    }
+    InitializeWithPolicy(mem, size, policy);
   }
 
   // Destructor deletes all owned heap allocated objects, and destructs objects
@@ -294,7 +370,8 @@
 
   void* AllocateAligned(size_t n, const std::type_info* type) {
     SerialArena* arena;
-    if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFast(tag_and_id_, &arena))) {
+    if (PROTOBUF_PREDICT_TRUE(!alloc_policy_.should_record_allocs() &&
+                              GetSerialArenaFast(&arena))) {
       return arena->AllocateAligned(n, AllocPolicy());
     } else {
       return AllocateAlignedFallback(n, type);
@@ -308,7 +385,8 @@
   // code for the happy path.
   PROTOBUF_NDEBUG_INLINE bool MaybeAllocateAligned(size_t n, void** out) {
     SerialArena* a;
-    if (PROTOBUF_PREDICT_TRUE(GetSerialArenaFromThreadCache(tag_and_id_, &a))) {
+    if (PROTOBUF_PREDICT_TRUE(!alloc_policy_.should_record_allocs() &&
+                              GetSerialArenaFromThreadCache(&a))) {
       return a->MaybeAllocateAligned(n, out);
     }
     return false;
@@ -320,51 +398,43 @@
   // Add object pointer and cleanup function pointer to the list.
   void AddCleanup(void* elem, void (*cleanup)(void*));
 
+  // Checks whether this arena is message-owned.
+  PROTOBUF_ALWAYS_INLINE bool IsMessageOwned() const {
+    return tag_and_id_ & kMessageOwnedArena;
+  }
+
  private:
   // Unique for each arena. Changes on Reset().
-  uint64_t tag_and_id_;
-  // The LSB of tag_and_id_ indicates if allocs in this arena are recorded.
-  enum { kRecordAllocs = 1 };
+  uint64_t tag_and_id_ = 0;
+  // The LSB of tag_and_id_ indicates if the arena is message-owned.
+  enum : uint64_t { kMessageOwnedArena = 1 };
 
-  intptr_t alloc_policy_ = 0;  // Tagged pointer to AllocPolicy.
-  // The LSB of alloc_policy_ indicates if the user owns the initial block.
-  enum { kUserOwnedInitialBlock = 1 };
+  TaggedAllocationPolicyPtr alloc_policy_;  // Tagged pointer to AllocPolicy.
 
   // Pointer to a linked list of SerialArena.
   std::atomic<SerialArena*> threads_;
   std::atomic<SerialArena*> hint_;  // Fast thread-local block access
 
-  const AllocationPolicy* AllocPolicy() const {
-    return reinterpret_cast<const AllocationPolicy*>(alloc_policy_ & -8);
-  }
+  const AllocationPolicy* AllocPolicy() const { return alloc_policy_.get(); }
   void InitializeFrom(void* mem, size_t size);
-  void InitializeWithPolicy(void* mem, size_t size, bool record_allocs,
-                            AllocationPolicy policy);
+  void InitializeWithPolicy(void* mem, size_t size, AllocationPolicy policy);
   void* AllocateAlignedFallback(size_t n, const std::type_info* type);
   std::pair<void*, SerialArena::CleanupNode*>
   AllocateAlignedWithCleanupFallback(size_t n, const std::type_info* type);
-  void AddCleanupFallback(void* elem, void (*cleanup)(void*));
 
-  void Init(bool record_allocs);
+  void Init();
   void SetInitialBlock(void* mem, size_t size);
 
   // Delete or Destruct all objects owned by the arena.
   void CleanupList();
 
-  inline bool ShouldRecordAlloc() const { return tag_and_id_ & kRecordAllocs; }
-
   inline uint64_t LifeCycleId() const {
-    return tag_and_id_ & (-kRecordAllocs - 1);
-  }
-
-  inline void RecordAlloc(const std::type_info* allocated_type,
-                          size_t n) const {
-    AllocPolicy()->metrics_collector->OnAlloc(allocated_type, n);
+    return tag_and_id_ & ~kMessageOwnedArena;
   }
 
   inline void CacheSerialArena(SerialArena* serial) {
     thread_cache().last_serial_arena = serial;
-    thread_cache().last_lifecycle_id_seen = LifeCycleId();
+    thread_cache().last_lifecycle_id_seen = tag_and_id_;
     // TODO(haberman): evaluate whether we would gain efficiency by getting rid
     // of hint_.  It's the only write we do to ThreadSafeArena in the allocation
     // path, which will dirty the cache line.
@@ -372,10 +442,8 @@
     hint_.store(serial, std::memory_order_release);
   }
 
-  PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(uint64_t lifecycle_id,
-                                                 SerialArena** arena) {
-    if (GetSerialArenaFromThreadCache(lifecycle_id, arena)) return true;
-    if (lifecycle_id & kRecordAllocs) return false;
+  PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFast(SerialArena** arena) {
+    if (GetSerialArenaFromThreadCache(arena)) return true;
 
     // Check whether we own the last accessed SerialArena on this arena.  This
     // fast path optimizes the case where a single thread uses multiple arenas.
@@ -389,12 +457,12 @@
   }
 
   PROTOBUF_NDEBUG_INLINE bool GetSerialArenaFromThreadCache(
-      uint64_t lifecycle_id, SerialArena** arena) {
+      SerialArena** arena) {
     // If this thread already owns a block in this arena then try to use that.
     // This fast path optimizes the case where multiple threads allocate from
     // the same arena.
     ThreadCache* tc = &thread_cache();
-    if (PROTOBUF_PREDICT_TRUE(tc->last_lifecycle_id_seen == lifecycle_id)) {
+    if (PROTOBUF_PREDICT_TRUE(tc->last_lifecycle_id_seen == tag_and_id_)) {
       *arena = tc->last_serial_arena;
       return true;
     }
@@ -455,9 +523,8 @@
   };
   static CacheAlignedLifecycleIdGenerator lifecycle_id_generator_;
 #if defined(GOOGLE_PROTOBUF_NO_THREADLOCAL)
-  // Android ndk does not support __thread keyword so we use a custom thread
-  // local storage class we implemented.
-  // iOS also does not support the __thread keyword.
+  // iOS does not support __thread keyword so we use a custom thread local
+  // storage class we implemented.
   static ThreadCache& thread_cache();
 #elif defined(PROTOBUF_USE_DLLS)
   // Thread local variables cannot be exposed through DLL interface but we can
diff --git a/src/google/protobuf/arena_unittest.cc b/src/google/protobuf/arena_unittest.cc
index b6fbd1f..76d9126 100644
--- a/src/google/protobuf/arena_unittest.cc
+++ b/src/google/protobuf/arena_unittest.cc
@@ -759,6 +759,7 @@
 }
 
 TEST(ArenaTest, RepeatedPtrFieldAddClearedTest) {
+#ifndef PROTOBUF_FUTURE_BREAKING_CHANGES
   {
     RepeatedPtrField<TestAllTypes> repeated_field;
     EXPECT_TRUE(repeated_field.empty());
@@ -769,6 +770,7 @@
     EXPECT_TRUE(repeated_field.empty());
     EXPECT_EQ(0, repeated_field.size());
   }
+#endif  // !PROTOBUF_FUTURE_BREAKING_CHANGES
   {
     RepeatedPtrField<TestAllTypes> repeated_field;
     EXPECT_TRUE(repeated_field.empty());
@@ -1151,7 +1153,7 @@
 
     // Fill some repeated fields on the arena to test for leaks. Also verify no
     // memory allocations.
-    RepeatedField<int32> repeated_int32(&arena);
+    RepeatedField<int32_t> repeated_int32(&arena);
     RepeatedPtrField<TestAllTypes> repeated_message(&arena);
     for (int i = 0; i < 100; i++) {
       repeated_int32.Add(42);
diff --git a/src/google/protobuf/arenastring.cc b/src/google/protobuf/arenastring.cc
index 7608b13..169f527 100644
--- a/src/google/protobuf/arenastring.cc
+++ b/src/google/protobuf/arenastring.cc
@@ -256,6 +256,12 @@
   }
 }
 
+inline void SetStrWithHeapBuffer(std::string* str, ArenaStringPtr* s) {
+  TaggedPtr<std::string> res;
+  res.Set(str);
+  s->UnsafeSetTaggedPointer(res);
+}
+
 const char* EpsCopyInputStream::ReadArenaString(const char* ptr,
                                                 ArenaStringPtr* s,
                                                 Arena* arena) {
@@ -264,13 +270,11 @@
   int size = ReadSize(&ptr);
   if (!ptr) return nullptr;
 
-  auto str = Arena::Create<std::string>(arena);
+  auto* str = Arena::Create<std::string>(arena);
   ptr = ReadString(ptr, size, str);
   GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
 
-  TaggedPtr<std::string> res;
-  res.Set(str);
-  s->UnsafeSetTaggedPointer(res);
+  SetStrWithHeapBuffer(str, s);
 
   return ptr;
 }
diff --git a/src/google/protobuf/arenastring.h b/src/google/protobuf/arenastring.h
index 2477369..38c3637 100644
--- a/src/google/protobuf/arenastring.h
+++ b/src/google/protobuf/arenastring.h
@@ -142,7 +142,7 @@
 //   free()/destructor-call list) as appropriate.
 //
 // - Pointer set to 'DonatedString' tag (LSB is 1): points to a std::string
-//   instance with a buffer on the arena (arena != NULL, always, in this case).
+//   instance with a buffer on the arena (arena is never nullptr in this case).
 //
 // For fields with a non-empty string default value, there are three distinct
 // states:
@@ -158,7 +158,7 @@
 //   free()/destructor-call list) as appropriate.
 //
 // - Pointer set to 'DonatedString' tag (LSB is 1): points to a std::string
-//   instance with a buffer on the arena (arena != NULL, always, in this case).
+//   instance with a buffer on the arena (arena is never nullptr in this case).
 //
 // Generated code and reflection code both ensure that ptr_ is never null for
 // fields with an empty default.
@@ -240,12 +240,12 @@
   std::string* Mutable(const LazyString& default_value, ::google::protobuf::Arena* arena);
 
   // Release returns a std::string* instance that is heap-allocated and is not
-  // Own()'d by any arena. If the field is not set, this returns NULL. The
-  // caller retains ownership. Clears this field back to NULL state. Used to
+  // Own()'d by any arena. If the field is not set, this returns nullptr. The
+  // caller retains ownership. Clears this field back to nullptr state. Used to
   // implement release_<field>() methods on generated classes.
-  PROTOBUF_MUST_USE_RESULT std::string* Release(
-      const std::string* default_value, ::google::protobuf::Arena* arena);
-  PROTOBUF_MUST_USE_RESULT std::string* ReleaseNonDefault(
+  PROTOBUF_NODISCARD std::string* Release(const std::string* default_value,
+                                          ::google::protobuf::Arena* arena);
+  PROTOBUF_NODISCARD std::string* ReleaseNonDefault(
       const std::string* default_value, ::google::protobuf::Arena* arena);
 
   // Takes a std::string that is heap-allocated, and takes ownership. The
@@ -276,9 +276,9 @@
   // string default.
   void ClearNonDefaultToEmpty();
 
-  // Clears content, but keeps allocated std::string if arena != NULL, to avoid
-  // the overhead of heap operations. After this returns, the content (as seen
-  // by the user) will always be equal to |default_value|.
+  // Clears content, but keeps allocated std::string if arena != nullptr, to
+  // avoid the overhead of heap operations. After this returns, the content
+  // (as seen by the user) will always be equal to |default_value|.
   void ClearToDefault(const LazyString& default_value, ::google::protobuf::Arena* arena);
 
   // Called from generated code / reflection runtime only. Resets value to point
diff --git a/src/google/protobuf/compiler/annotation_test_util.h b/src/google/protobuf/compiler/annotation_test_util.h
index fa87c6c..551f224 100644
--- a/src/google/protobuf/compiler/annotation_test_util.h
+++ b/src/google/protobuf/compiler/annotation_test_util.h
@@ -78,7 +78,7 @@
 bool DecodeMetadata(const std::string& path, GeneratedCodeInfo* info);
 
 // Finds all of the Annotations for a given source file and path.
-// See Location.path in http://google3/net/proto2/proto/descriptor.proto for
+// See Location.path in https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto for
 // explanation of what path vector is.
 void FindAnnotationsOnPath(
     const GeneratedCodeInfo& info, const std::string& source_file,
@@ -88,7 +88,7 @@
 // Finds the Annotation for a given source file and path (or returns null if it
 // couldn't). If there are several annotations for given path, returns the first
 // one. See Location.path in
-// http://google3/net/proto2/proto/descriptor.proto for explanation of what path
+// https://github.com/protocolbuffers/protobuf/blob/master/src/google/protobuf/descriptor.proto for explanation of what path
 // vector is.
 const GeneratedCodeInfo::Annotation* FindAnnotationOnPath(
     const GeneratedCodeInfo& info, const std::string& source_file,
diff --git a/src/google/protobuf/compiler/command_line_interface.cc b/src/google/protobuf/compiler/command_line_interface.cc
index a68a604..bfc6b05 100644
--- a/src/google/protobuf/compiler/command_line_interface.cc
+++ b/src/google/protobuf/compiler/command_line_interface.cc
@@ -402,8 +402,8 @@
   // implements GeneratorContext --------------------------------------
   io::ZeroCopyOutputStream* Open(const std::string& filename) override;
   io::ZeroCopyOutputStream* OpenForAppend(const std::string& filename) override;
-  io::ZeroCopyOutputStream* OpenForInsert(const std::string& filename,
-                                          const std::string& insertion_point) override;
+  io::ZeroCopyOutputStream* OpenForInsert(
+      const std::string& filename, const std::string& insertion_point) override;
   io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo(
       const std::string& filename, const std::string& insertion_point,
       const google::protobuf::GeneratedCodeInfo& info) override;
@@ -2423,8 +2423,8 @@
     to_output.insert(parsed_files.begin(), parsed_files.end());
     for (int i = 0; i < parsed_files.size(); i++) {
       const FileDescriptor* file = parsed_files[i];
-      for (int i = 0; i < file->dependency_count(); i++) {
-        const FileDescriptor* dependency = file->dependency(i);
+      for (int j = 0; j < file->dependency_count(); j++) {
+        const FileDescriptor* dependency = file->dependency(j);
         // if the dependency isn't in parsed files, mark it as already seen
         if (to_output.find(dependency) == to_output.end()) {
           already_seen.insert(dependency);
diff --git a/src/google/protobuf/compiler/cpp/cpp_enum.cc b/src/google/protobuf/compiler/cpp/cpp_enum.cc
index c9b9c20..6ae5cf4 100644
--- a/src/google/protobuf/compiler/cpp/cpp_enum.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_enum.cc
@@ -409,10 +409,10 @@
     std::string parent = ClassName(descriptor_->containing_type(), false);
     // Before C++17, we must define the static constants which were
     // declared in the header, to give the linker a place to put them.
-    // But pre-2015 MSVC++ insists that we not.
+    // But MSVC++ pre-2015 and post-2017 (version 15.5+) insists that we not.
     format(
         "#if (__cplusplus < 201703) && "
-        "(!defined(_MSC_VER) || _MSC_VER >= 1900)\n");
+        "(!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))\n");
 
     for (int i = 0; i < descriptor_->value_count(); i++) {
       format("constexpr $classname$ $1$::$2$;\n", parent,
@@ -428,7 +428,7 @@
 
     format(
         "#endif  // (__cplusplus < 201703) && "
-        "(!defined(_MSC_VER) || _MSC_VER >= 1900)\n");
+        "(!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))\n");
   }
 }
 
diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
index cdcd9a6..70311dd 100644
--- a/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.cc
@@ -334,106 +334,6 @@
   // Not needed for repeated fields.
 }
 
-void RepeatedEnumFieldGenerator::GenerateMergeFromCodedStream(
-    io::Printer* printer) const {
-  Formatter format(printer, variables_);
-  // Don't use ReadRepeatedPrimitive here so that the enum can be validated.
-  format(
-      "int value = 0;\n"
-      "DO_((::$proto_ns$::internal::WireFormatLite::ReadPrimitive<\n"
-      "         int, ::$proto_ns$::internal::WireFormatLite::TYPE_ENUM>(\n"
-      "       input, &value)));\n");
-  if (HasPreservingUnknownEnumSemantics(descriptor_)) {
-    format("add_$name$(static_cast< $type$ >(value));\n");
-  } else {
-    format(
-        "if ($type$_IsValid(value)) {\n"
-        "  add_$name$(static_cast< $type$ >(value));\n");
-    if (UseUnknownFieldSet(descriptor_->file(), options_)) {
-      format(
-          "} else {\n"
-          "  mutable_unknown_fields()->AddVarint(\n"
-          "      $number$, static_cast<$uint64$>(value));\n");
-    } else {
-      format(
-          "} else {\n"
-          "  unknown_fields_stream.WriteVarint32(tag);\n"
-          "  unknown_fields_stream.WriteVarint32(\n"
-          "      static_cast<$uint32$>(value));\n");
-    }
-    format("}\n");
-  }
-}
-
-void RepeatedEnumFieldGenerator::GenerateMergeFromCodedStreamWithPacking(
-    io::Printer* printer) const {
-  Formatter format(printer, variables_);
-  if (!descriptor_->is_packed()) {
-    // This path is rarely executed, so we use a non-inlined implementation.
-    if (HasPreservingUnknownEnumSemantics(descriptor_)) {
-      format(
-          "DO_((::$proto_ns$::internal::"
-          "WireFormatLite::ReadPackedEnumPreserveUnknowns(\n"
-          "       input,\n"
-          "       $number$,\n"
-          "       nullptr,\n"
-          "       nullptr,\n"
-          "       this->_internal_mutable_$name$())));\n");
-    } else if (UseUnknownFieldSet(descriptor_->file(), options_)) {
-      format(
-          "DO_((::$proto_ns$::internal::WireFormat::"
-          "ReadPackedEnumPreserveUnknowns(\n"
-          "       input,\n"
-          "       $number$,\n"
-          "       $type$_IsValid,\n"
-          "       mutable_unknown_fields(),\n"
-          "       this->_internal_mutable_$name$())));\n");
-    } else {
-      format(
-          "DO_((::$proto_ns$::internal::"
-          "WireFormatLite::ReadPackedEnumPreserveUnknowns(\n"
-          "       input,\n"
-          "       $number$,\n"
-          "       $type$_IsValid,\n"
-          "       &unknown_fields_stream,\n"
-          "       this->_internal_mutable_$name$())));\n");
-    }
-  } else {
-    format(
-        "$uint32$ length;\n"
-        "DO_(input->ReadVarint32(&length));\n"
-        "::$proto_ns$::io::CodedInputStream::Limit limit = "
-        "input->PushLimit(static_cast<int>(length));\n"
-        "while (input->BytesUntilLimit() > 0) {\n"
-        "  int value = 0;\n"
-        "  DO_((::$proto_ns$::internal::WireFormatLite::ReadPrimitive<\n"
-        "         int, ::$proto_ns$::internal::WireFormatLite::TYPE_ENUM>(\n"
-        "       input, &value)));\n");
-    if (HasPreservingUnknownEnumSemantics(descriptor_)) {
-      format("  add_$name$(static_cast< $type$ >(value));\n");
-    } else {
-      format(
-          "  if ($type$_IsValid(value)) {\n"
-          "    _internal_add_$name$(static_cast< $type$ >(value));\n"
-          "  } else {\n");
-      if (UseUnknownFieldSet(descriptor_->file(), options_)) {
-        format(
-            "  mutable_unknown_fields()->AddVarint(\n"
-            "      $number$, static_cast<$uint64$>(value));\n");
-      } else {
-        format(
-            "    unknown_fields_stream.WriteVarint32(tag);\n"
-            "    unknown_fields_stream.WriteVarint32(\n"
-            "        static_cast<$uint32$>(value));\n");
-      }
-      format("  }\n");
-    }
-    format(
-        "}\n"
-        "input->PopLimit(limit);\n");
-  }
-}
-
 void RepeatedEnumFieldGenerator::GenerateSerializeWithCachedSizesToArray(
     io::Printer* printer) const {
   Formatter format(printer, variables_);
diff --git a/src/google/protobuf/compiler/cpp/cpp_enum_field.h b/src/google/protobuf/compiler/cpp/cpp_enum_field.h
index 793ab2d..e65ec0f 100644
--- a/src/google/protobuf/compiler/cpp/cpp_enum_field.h
+++ b/src/google/protobuf/compiler/cpp/cpp_enum_field.h
@@ -98,8 +98,6 @@
   void GenerateSwappingCode(io::Printer* printer) const override;
   void GenerateConstructorCode(io::Printer* printer) const override;
   void GenerateCopyConstructorCode(io::Printer* printer) const override {}
-  void GenerateMergeFromCodedStream(io::Printer* printer) const;
-  void GenerateMergeFromCodedStreamWithPacking(io::Printer* printer) const;
   void GenerateSerializeWithCachedSizesToArray(
       io::Printer* printer) const override;
   void GenerateByteSize(io::Printer* printer) const override;
diff --git a/src/google/protobuf/compiler/cpp/cpp_extension.cc b/src/google/protobuf/compiler/cpp/cpp_extension.cc
index 670c37f..8604da5 100644
--- a/src/google/protobuf/compiler/cpp/cpp_extension.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_extension.cc
@@ -44,18 +44,6 @@
 namespace compiler {
 namespace cpp {
 
-namespace {
-
-// Returns the fully-qualified class name of the message that this field
-// extends. This function is used in the Google-internal code to handle some
-// legacy cases.
-std::string ExtendeeClassName(const FieldDescriptor* descriptor) {
-  const Descriptor* extendee = descriptor->containing_type();
-  return ClassName(extendee, true);
-}
-
-}  // anonymous namespace
-
 ExtensionGenerator::ExtensionGenerator(const FieldDescriptor* descriptor,
                                        const Options& options,
                                        MessageSCCAnalyzer* scc_analyzer)
@@ -88,7 +76,8 @@
       break;
   }
   SetCommonVars(options, &variables_);
-  variables_["extendee"] = ExtendeeClassName(descriptor_);
+  variables_["extendee"] =
+      QualifiedClassName(descriptor_->containing_type(), options_);
   variables_["type_traits"] = type_traits_;
   std::string name = descriptor_->name();
   variables_["name"] = ResolveKeyword(name);
@@ -169,7 +158,7 @@
   // Likewise, class members need to declare the field constant variable.
   if (IsScoped()) {
     format(
-        "#if !defined(_MSC_VER) || _MSC_VER >= 1900\n"
+        "#if !defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)\n"
         "const int $scope$$constant_name$;\n"
         "#endif\n");
   }
diff --git a/src/google/protobuf/compiler/cpp/cpp_field.cc b/src/google/protobuf/compiler/cpp/cpp_field.cc
index 48ae290..a95dd33 100644
--- a/src/google/protobuf/compiler/cpp/cpp_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_field.cc
@@ -340,7 +340,7 @@
     switch (field->cpp_type()) {
       case FieldDescriptor::CPPTYPE_MESSAGE:
         if (field->is_map()) {
-          return new MapFieldGenerator(field, options);
+          return new MapFieldGenerator(field, options, scc_analyzer);
         } else {
           return new RepeatedMessageFieldGenerator(field, options,
                                                    scc_analyzer);
diff --git a/src/google/protobuf/compiler/cpp/cpp_field.h b/src/google/protobuf/compiler/cpp/cpp_field.h
index 185fa8c..e0eb679 100644
--- a/src/google/protobuf/compiler/cpp/cpp_field.h
+++ b/src/google/protobuf/compiler/cpp/cpp_field.h
@@ -181,6 +181,10 @@
   // are placed in the message's ByteSize() method.
   virtual void GenerateByteSize(io::Printer* printer) const = 0;
 
+  // Generates lines to call IsInitialized() for eligible message fields. Non
+  // message fields won't need to override this function.
+  virtual void GenerateIsInitialized(io::Printer* printer) const {}
+
   virtual bool IsInlined() const { return false; }
 
   void SetHasBitIndex(int32_t has_bit_index);
diff --git a/src/google/protobuf/compiler/cpp/cpp_file.cc b/src/google/protobuf/compiler/cpp/cpp_file.cc
index 3de7294..c7816b5 100644
--- a/src/google/protobuf/compiler/cpp/cpp_file.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_file.cc
@@ -154,8 +154,8 @@
   for (int i = 0; i < fields.size(); i++) {
     const std::string& name = fields[i]->name();
     static const char* kMacroNames[] = {"major", "minor"};
-    for (int i = 0; i < GOOGLE_ARRAYSIZE(kMacroNames); ++i) {
-      if (name == kMacroNames[i]) {
+    for (int j = 0; j < GOOGLE_ARRAYSIZE(kMacroNames); ++j) {
+      if (name == kMacroNames[j]) {
         names_to_undef.push_back(name);
         break;
       }
@@ -1178,7 +1178,8 @@
   IncludeFile("net/proto2/io/public/coded_stream.h", printer);
   IncludeFile("net/proto2/public/arena.h", printer);
   IncludeFile("net/proto2/public/arenastring.h", printer);
-  if (options_.force_inline_string || options_.profile_driven_inline_string) {
+  if ((options_.force_inline_string || options_.profile_driven_inline_string) &&
+      !options_.opensource_runtime) {
     IncludeFile("net/proto2/public/inlined_string_field.h", printer);
   }
   if (HasSimpleBaseClasses(file_, options_)) {
diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.cc b/src/google/protobuf/compiler/cpp/cpp_helpers.cc
index 937a42a..9fe47bf 100644
--- a/src/google/protobuf/compiler/cpp/cpp_helpers.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_helpers.cc
@@ -58,6 +58,7 @@
 #include <google/protobuf/stubs/substitute.h>
 #include <google/protobuf/stubs/hash.h>
 
+// Must be last.
 #include <google/protobuf/port_def.inc>
 
 namespace google {
@@ -170,11 +171,7 @@
 static std::unordered_set<std::string>& kKeywords = *MakeKeywordsMap();
 
 std::string IntTypeName(const Options& options, const std::string& type) {
-  if (options.opensource_runtime) {
-    return "::PROTOBUF_NAMESPACE_ID::" + type;
-  } else {
-    return "::" + type;
-  }
+  return type + "_t";
 }
 
 void SetIntVar(const Options& options, const std::string& type,
@@ -456,6 +453,19 @@
   return result;
 }
 
+std::string OneofCaseConstantName(const FieldDescriptor* field) {
+  GOOGLE_DCHECK(field->containing_oneof());
+  std::string field_name = UnderscoresToCamelCase(field->name(), true);
+  return "k" + field_name;
+}
+
+std::string QualifiedOneofCaseConstantName(const FieldDescriptor* field) {
+  GOOGLE_DCHECK(field->containing_oneof());
+  const std::string qualification =
+      QualifiedClassName(field->containing_type());
+  return StrCat(qualification, "::", OneofCaseConstantName(field));
+}
+
 std::string EnumValueName(const EnumValueDescriptor* enum_value) {
   std::string result = enum_value->name();
   if (kKeywords.count(result) > 0) {
@@ -522,13 +532,13 @@
 const char* PrimitiveTypeName(FieldDescriptor::CppType type) {
   switch (type) {
     case FieldDescriptor::CPPTYPE_INT32:
-      return "::google::protobuf::int32";
+      return "int32_t";
     case FieldDescriptor::CPPTYPE_INT64:
-      return "::google::protobuf::int64";
+      return "int64_t";
     case FieldDescriptor::CPPTYPE_UINT32:
-      return "::google::protobuf::uint32";
+      return "uint32_t";
     case FieldDescriptor::CPPTYPE_UINT64:
-      return "::google::protobuf::uint64";
+      return "uint64_t";
     case FieldDescriptor::CPPTYPE_DOUBLE:
       return "double";
     case FieldDescriptor::CPPTYPE_FLOAT:
@@ -777,8 +787,10 @@
   return function_name;
 }
 
-bool IsStringInlined(const FieldDescriptor* /* descriptor */,
-                     const Options& /* options */) {
+bool IsStringInlined(const FieldDescriptor* descriptor,
+                     const Options& options) {
+  (void)descriptor;
+  (void)options;
   return false;
 }
 
@@ -939,15 +951,19 @@
   return false;
 }
 
-bool ShouldVerify(const Descriptor* /* descriptor */,
-                  const Options& /* options */,
-                  MessageSCCAnalyzer* /* scc_analyzer */) {
+bool ShouldVerify(const Descriptor* descriptor, const Options& options,
+                  MessageSCCAnalyzer* scc_analyzer) {
+  (void)descriptor;
+  (void)options;
+  (void)scc_analyzer;
   return false;
 }
 
-bool ShouldVerify(const FileDescriptor* /* file */,
-                  const Options& /* options */,
-                  MessageSCCAnalyzer* /* scc_analyzer */) {
+bool ShouldVerify(const FileDescriptor* file, const Options& options,
+                  MessageSCCAnalyzer* scc_analyzer) {
+  (void)file;
+  (void)options;
+  (void)scc_analyzer;
   return false;
 }
 
@@ -1152,8 +1168,8 @@
     if (descriptor->extension_range_count() > 0) {
       result.contains_extension = true;
     }
-    for (int i = 0; i < descriptor->field_count(); i++) {
-      const FieldDescriptor* field = descriptor->field(i);
+    for (int j = 0; j < descriptor->field_count(); j++) {
+      const FieldDescriptor* field = descriptor->field(j);
       if (field->is_required()) {
         result.contains_required = true;
       }
@@ -1470,7 +1486,8 @@
   return FileOptions::SPEED;
 }
 
-bool EnableMessageOwnedArena(const Descriptor* /* desc */) {
+bool EnableMessageOwnedArena(const Descriptor* desc) {
+  (void)desc;
   return false;
 }
 
diff --git a/src/google/protobuf/compiler/cpp/cpp_helpers.h b/src/google/protobuf/compiler/cpp/cpp_helpers.h
index e6359a1..bd4f48b 100644
--- a/src/google/protobuf/compiler/cpp/cpp_helpers.h
+++ b/src/google/protobuf/compiler/cpp/cpp_helpers.h
@@ -63,8 +63,8 @@
   return "PROTOBUF_NAMESPACE_ID";
 }
 
-inline std::string MacroPrefix(const Options& options) {
-  return options.opensource_runtime ? "GOOGLE_PROTOBUF" : "GOOGLE_PROTOBUF";
+inline std::string MacroPrefix(const Options& /* options */) {
+  return "GOOGLE_PROTOBUF";
 }
 
 inline std::string DeprecatedAttribute(const Options& /* options */,
@@ -743,6 +743,27 @@
   void Outdent() const { printer_->Outdent(); }
   io::Printer* printer() const { return printer_; }
 
+  class PROTOC_EXPORT ScopedIndenter {
+   public:
+    explicit ScopedIndenter(Formatter* format) : format_(format) {
+      format_->Indent();
+    }
+    ~ScopedIndenter() { format_->Outdent(); }
+
+   private:
+    Formatter* format_;
+  };
+
+  PROTOBUF_NODISCARD ScopedIndenter ScopedIndent() {
+    return ScopedIndenter(this);
+  }
+  template <typename... Args>
+  PROTOBUF_NODISCARD ScopedIndenter ScopedIndent(const char* format,
+                                                 const Args&&... args) {
+    (*this)(format, static_cast<Args&&>(args)...);
+    return ScopedIndenter(this);
+  }
+
   class PROTOC_EXPORT SaveState {
    public:
     explicit SaveState(Formatter* format)
diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
index 49f65f3..130e90e 100644
--- a/src/google/protobuf/compiler/cpp/cpp_map_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
@@ -84,8 +84,11 @@
 }
 
 MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor,
-                                     const Options& options)
-    : FieldGenerator(descriptor, options) {
+                                     const Options& options,
+                                     MessageSCCAnalyzer* scc_analyzer)
+    : FieldGenerator(descriptor, options),
+      has_required_fields_(
+          scc_analyzer->HasRequiredFields(descriptor->message_type())) {
   SetMessageVariables(descriptor, &variables_, options);
 }
 
@@ -293,6 +296,15 @@
       "}\n");
 }
 
+void MapFieldGenerator::GenerateIsInitialized(io::Printer* printer) const {
+  if (!has_required_fields_) return;
+
+  Formatter format(printer, variables_);
+  format(
+      "if (!::$proto_ns$::internal::AllAreInitialized($name$_)) return "
+      "false;\n");
+}
+
 void MapFieldGenerator::GenerateConstinitInitializer(
     io::Printer* printer) const {
   Formatter format(printer, variables_);
diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.h b/src/google/protobuf/compiler/cpp/cpp_map_field.h
index 5ea0429..c01ae49 100644
--- a/src/google/protobuf/compiler/cpp/cpp_map_field.h
+++ b/src/google/protobuf/compiler/cpp/cpp_map_field.h
@@ -34,6 +34,7 @@
 #include <map>
 #include <string>
 
+#include <google/protobuf/compiler/cpp/cpp_helpers.h>
 #include <google/protobuf/compiler/cpp/cpp_message_field.h>
 
 namespace google {
@@ -43,8 +44,9 @@
 
 class MapFieldGenerator : public FieldGenerator {
  public:
-  MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options);
-  ~MapFieldGenerator();
+  MapFieldGenerator(const FieldDescriptor* descriptor, const Options& options,
+                    MessageSCCAnalyzer* scc_analyzer);
+  ~MapFieldGenerator() override;
 
   // implements FieldGenerator ---------------------------------------
   void GeneratePrivateMembers(io::Printer* printer) const override;
@@ -58,10 +60,13 @@
   void GenerateSerializeWithCachedSizesToArray(
       io::Printer* printer) const override;
   void GenerateByteSize(io::Printer* printer) const override;
+  void GenerateIsInitialized(io::Printer* printer) const override;
   void GenerateConstinitInitializer(io::Printer* printer) const override;
   bool GenerateArenaDestructorCode(io::Printer* printer) const override;
 
  private:
+  const bool has_required_fields_;
+
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldGenerator);
 };
 
diff --git a/src/google/protobuf/compiler/cpp/cpp_message.cc b/src/google/protobuf/compiler/cpp/cpp_message.cc
index c29be76..70d8a57 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message.cc
@@ -230,12 +230,22 @@
     } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
       // Message fields still have has_$name$() methods.
       format("if ($prefix$_internal_has_$name$()) {\n");
-    } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_DOUBLE ||
-               field->cpp_type() == FieldDescriptor::CPPTYPE_FLOAT) {
-      // Handle float comparison to prevent -Wfloat-equal warnings
+    } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_FLOAT) {
       format(
-          "if (!($prefix$_internal_$name$() <= 0 && $prefix$_internal_$name$() "
-          ">= 0)) {\n");
+          "static_assert(sizeof(uint32_t) == sizeof(float), \"Code assumes "
+          "uint32_t and float are the same size.\");\n"
+          "float tmp_$name$ = $prefix$_internal_$name$();\n"
+          "uint32_t raw_$name$;\n"
+          "memcpy(&raw_$name$, &tmp_$name$, sizeof(tmp_$name$));\n"
+          "if (raw_$name$ != 0) {\n");
+    } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_DOUBLE) {
+      format(
+          "static_assert(sizeof(uint64_t) == sizeof(double), \"Code assumes "
+          "uint64_t and double are the same size.\");\n"
+          "double tmp_$name$ = $prefix$_internal_$name$();\n"
+          "uint64_t raw_$name$;\n"
+          "memcpy(&raw_$name$, &tmp_$name$, sizeof(tmp_$name$));\n"
+          "if (raw_$name$ != 0) {\n");
     } else {
       format("if ($prefix$_internal_$name$() != 0) {\n");
     }
@@ -974,7 +984,7 @@
 template <typename _proto_TypeTraits,
           ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
           bool _is_packed>
-inline PROTOBUF_MUST_USE_RESULT
+PROTOBUF_NODISCARD inline
     typename _proto_TypeTraits::Singular::MutableType
     ReleaseExtension(
         const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
@@ -1437,7 +1447,8 @@
   if (EnableMessageOwnedArena(descriptor_)) {
     format(
         "inline $classname$() : $classname$("
-        "new ::$proto_ns$::Arena(), true) {}\n");
+        "::$proto_ns$::Arena::InternalHelper<$classname$>::\n"
+        "    CreateMessageOwnedArena(), true) {}\n");
   } else {
     format("inline $classname$() : $classname$(nullptr) {}\n");
   }
@@ -1530,10 +1541,8 @@
     format("enum $1$Case {\n", UnderscoresToCamelCase(oneof->name(), true));
     format.Indent();
     for (auto field : FieldRange(oneof)) {
-      std::string oneof_enum_case_field_name =
-          UnderscoresToCamelCase(field->name(), true);
-      format("k$1$ = $2$,\n", oneof_enum_case_field_name,  // 1
-             field->number());                             // 2
+      format("$1$ = $2$,\n", OneofCaseConstantName(field),  // 1
+             field->number());                              // 2
     }
     format("$1$_NOT_SET = 0,\n", ToUpper(oneof->name()));
     format.Outdent();
@@ -1565,7 +1574,8 @@
           "bool PackFrom(const ::$proto_ns$::Message& message,\n"
           "              ::PROTOBUF_NAMESPACE_ID::ConstStringParam "
           "type_url_prefix) {\n"
-          "  return _any_metadata_.PackFrom(GetArena(), message, type_url_prefix);\n"
+          "  return _any_metadata_.PackFrom(GetArena(), message, "
+          "type_url_prefix);\n"
           "}\n"
           "bool UnpackTo(::$proto_ns$::Message* message) const {\n"
           "  return _any_metadata_.UnpackTo(message);\n"
@@ -1586,7 +1596,8 @@
           "bool PackFrom(const T& message,\n"
           "              ::PROTOBUF_NAMESPACE_ID::ConstStringParam "
           "type_url_prefix) {\n"
-          "  return _any_metadata_.PackFrom<T>(GetArena(), message, type_url_prefix);"
+          "  return _any_metadata_.PackFrom<T>(GetArena(), message, "
+          "type_url_prefix);"
           "}\n"
           "template <typename T, class = typename std::enable_if<"
           "!std::is_convertible<T, const ::$proto_ns$::Message&>"
@@ -1598,13 +1609,14 @@
       format(
           "template <typename T>\n"
           "bool PackFrom(const T& message) {\n"
-          "  return _any_metadata_.PackFrom(message);\n"
+          "  return _any_metadata_.PackFrom(GetArena(), message);\n"
           "}\n"
           "template <typename T>\n"
           "bool PackFrom(const T& message,\n"
           "              ::PROTOBUF_NAMESPACE_ID::ConstStringParam "
           "type_url_prefix) {\n"
-          "  return _any_metadata_.PackFrom(message, type_url_prefix);\n"
+          "  return _any_metadata_.PackFrom(GetArena(), message, "
+          "type_url_prefix);\n"
           "}\n"
           "template <typename T>\n"
           "bool UnpackTo(T* message) const {\n"
@@ -1626,12 +1638,12 @@
       "}\n"
       "inline void Swap($classname$* other) {\n"
       "  if (other == this) return;\n"
-#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+      "#ifdef PROTOBUF_FORCE_COPY_IN_SWAP\n"
       "  if (GetOwningArena() != nullptr &&\n"
-      "      GetOwningArena() == other->GetOwningArena()) {\n"
-#else   // PROTOBUF_FORCE_COPY_IN_SWAP
+      "      GetOwningArena() == other->GetOwningArena()) {\n "
+      "#else  // PROTOBUF_FORCE_COPY_IN_SWAP\n"
       "  if (GetOwningArena() == other->GetOwningArena()) {\n"
-#endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
+      "#endif  // !PROTOBUF_FORCE_COPY_IN_SWAP\n"
       "    InternalSwap(other);\n"
       "  } else {\n"
       "    ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);\n"
@@ -1647,11 +1659,7 @@
       "\n"
       "// implements Message ----------------------------------------------\n"
       "\n"
-      "inline $classname$* New() const final {\n"
-      "  return new $classname$();\n"
-      "}\n"
-      "\n"
-      "$classname$* New(::$proto_ns$::Arena* arena) const final {\n"
+      "$classname$* New(::$proto_ns$::Arena* arena = nullptr) const final {\n"
       "  return CreateMaybeMessage<$classname$>(arena);\n"
       "}\n");
 
@@ -1714,12 +1722,6 @@
           "$uint8$* _InternalSerialize(\n"
           "    $uint8$* target, ::$proto_ns$::io::EpsCopyOutputStream* stream) "
           "const final;\n");
-
-      // DiscardUnknownFields() is implemented in message.cc using reflections.
-      // We need to implement this function in generated code for messages.
-      if (!UseUnknownFieldSet(descriptor_->file(), options_)) {
-        format("void DiscardUnknownFields()$ full_final$;\n");
-      }
     }
   }
 
@@ -1740,6 +1742,7 @@
 
   format(
       // Friend AnyMetadata so that it can call this FullMessageName() method.
+      "\nprivate:\n"
       "friend class ::$proto_ns$::internal::AnyMetadata;\n"
       "static $1$ FullMessageName() {\n"
       "  return \"$full_name$\";\n"
@@ -2744,19 +2747,22 @@
 
     // Some information about a field is in the pdproto profile. The profile is
     // only available at compile time. So we embed such information in the
-    // offset of the field, so that the information is available when reflective
-    // accessing the field at run time.
+    // offset of the field, so that the information is available when
+    // reflectively accessing the field at run time.
     //
     // Embed whether the field is used to the MSB of the offset.
     if (!IsFieldUsed(field, options_)) {
-      format(" | 0x80000000u, // unused\n");
-    } else if (IsEagerlyVerifiedLazy(field, options_, scc_analyzer_)) {
-      format(" | 0x1u, // eagerly verified lazy\n");
-    } else if (IsStringInlined(field, options_)) {
-      format(" | 0x1u, // inlined\n");
-    } else {
-      format(",\n");
+      format(" | 0x80000000u  // unused\n");
     }
+
+    // Embed whether the field is eagerly verified lazy or inlined string to the
+    // LSB of the offset.
+    if (IsEagerlyVerifiedLazy(field, options_, scc_analyzer_)) {
+      format(" | 0x1u  // eagerly verified lazy\n");
+    } else if (IsStringInlined(field, options_)) {
+      format(" | 0x1u  // inlined\n");
+    }
+    format(",\n");
   }
 
   int count = 0;
@@ -2796,7 +2802,7 @@
   if (HasSimpleBaseClass(descriptor_, options_)) return;
   Formatter format(printer, variables_);
 
-  format("void $classname$::SharedCtor() {\n");
+  format("inline void $classname$::SharedCtor() {\n");
 
   std::vector<bool> processed(optimized_order_.size(), false);
   GenerateConstructorBody(printer, processed, false);
@@ -3119,7 +3125,9 @@
         "metadata_);\n");
 
     if (descriptor_->extension_range_count() > 0) {
-      format("_extensions_.MergeFrom(from._extensions_);\n");
+      format(
+          "_extensions_.MergeFrom(internal_default_instance(), "
+          "from._extensions_);\n");
     }
 
     GenerateConstructorBody(printer, processed, true);
@@ -3714,7 +3722,9 @@
   // Merging of extensions and unknown fields is done last, to maximize
   // the opportunity for tail calls.
   if (descriptor_->extension_range_count() > 0) {
-    format("_extensions_.MergeFrom(from._extensions_);\n");
+    format(
+        "_extensions_.MergeFrom(internal_default_instance(), "
+        "from._extensions_);\n");
   }
 
   format(
@@ -4516,42 +4526,7 @@
 
   // Now check that all non-oneof embedded messages are initialized.
   for (auto field : optimized_order_) {
-    // TODO(ckennelly): Push this down into a generator?
-    if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
-        !ShouldIgnoreRequiredFieldCheck(field, options_) &&
-        scc_analyzer_->HasRequiredFields(field->message_type())) {
-      if (field->is_repeated()) {
-        if (IsImplicitWeakField(field, options_, scc_analyzer_)) {
-          format(
-              "if "
-              "(!::$proto_ns$::internal::AllAreInitializedWeak($1$_.weak)"
-              ")"
-              " return false;\n",
-              FieldName(field));
-        } else {
-          format(
-              "if (!::$proto_ns$::internal::AllAreInitialized($1$_))"
-              " return false;\n",
-              FieldName(field));
-        }
-      } else if (field->options().weak()) {
-        continue;
-      } else if (IsEagerlyVerifiedLazy(field, options_, scc_analyzer_)) {
-        GOOGLE_CHECK(!field->real_containing_oneof());
-        format(
-            "if (_internal_has_$1$()) {\n"
-            "  if (!$1$().IsInitialized()) return false;\n"
-            "}\n",
-            FieldName(field));
-      } else {
-        GOOGLE_CHECK(!field->real_containing_oneof());
-        format(
-            "if (_internal_has_$1$()) {\n"
-            "  if (!$1$_->IsInitialized()) return false;\n"
-            "}\n",
-            FieldName(field));
-      }
-    }
+    field_generators_.get(field).GenerateIsInitialized(printer);
   }
   if (num_weak_fields_) {
     // For Weak fields.
@@ -4579,23 +4554,9 @@
     for (auto field : FieldRange(oneof)) {
       format("case k$1$: {\n", UnderscoresToCamelCase(field->name(), true));
       format.Indent();
-
-      if (!IsFieldStripped(field, options_) &&
-          field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
-          !ShouldIgnoreRequiredFieldCheck(field, options_) &&
-          scc_analyzer_->HasRequiredFields(field->message_type())) {
-        GOOGLE_CHECK(!(field->options().weak() || !field->real_containing_oneof()));
-        if (field->options().weak()) {
-          // Just skip.
-        } else {
-          format(
-              "if (has_$1$()) {\n"
-              "  if (!this->$1$().IsInitialized()) return false;\n"
-              "}\n",
-              FieldName(field));
-        }
+      if (!IsFieldStripped(field, options_)) {
+        field_generators_.get(field).GenerateIsInitialized(printer);
       }
-
       format("break;\n");
       format.Outdent();
       format("}\n");
diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.cc b/src/google/protobuf/compiler/cpp/cpp_message_field.cc
index ee677ea..6199903 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_message_field.cc
@@ -87,7 +87,9 @@
                                              MessageSCCAnalyzer* scc_analyzer)
     : FieldGenerator(descriptor, options),
       implicit_weak_field_(
-          IsImplicitWeakField(descriptor, options, scc_analyzer)) {
+          IsImplicitWeakField(descriptor, options, scc_analyzer)),
+      has_required_fields_(
+          scc_analyzer->HasRequiredFields(descriptor->message_type())) {
   SetMessageVariables(descriptor, options, implicit_weak_field_, &variables_);
 }
 
@@ -109,7 +111,7 @@
     format(
         "$deprecated_attr$const $type$& ${1$$name$$}$() const { "
         "__builtin_trap(); }\n"
-        "PROTOBUF_MUST_USE_RESULT $deprecated_attr$$type$* "
+        "PROTOBUF_NODISCARD $deprecated_attr$$type$* "
         "${1$$release_name$$}$() { "
         "__builtin_trap(); }\n"
         "$deprecated_attr$$type$* ${1$mutable_$name$$}$() { "
@@ -126,7 +128,7 @@
   }
   format(
       "$deprecated_attr$const $type$& ${1$$name$$}$() const;\n"
-      "PROTOBUF_MUST_USE_RESULT $deprecated_attr$$type$* "
+      "PROTOBUF_NODISCARD $deprecated_attr$$type$* "
       "${1$$release_name$$}$();\n"
       "$deprecated_attr$$type$* ${1$mutable_$name$$}$();\n"
       "$deprecated_attr$void ${1$set_allocated_$name$$}$"
@@ -480,6 +482,18 @@
       "    *$field_member$);\n");
 }
 
+void MessageFieldGenerator::GenerateIsInitialized(io::Printer* printer) const {
+  GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_));
+
+  if (!has_required_fields_) return;
+
+  Formatter format(printer, variables_);
+  format(
+      "if (_internal_has_$name$()) {\n"
+      "  if (!$name$_->IsInitialized()) return false;\n"
+      "}\n");
+}
+
 void MessageFieldGenerator::GenerateConstinitInitializer(
     io::Printer* printer) const {
   Formatter format(printer, variables_);
@@ -641,6 +655,17 @@
   // space only when this field is used.
 }
 
+void MessageOneofFieldGenerator::GenerateIsInitialized(
+    io::Printer* printer) const {
+  if (!has_required_fields_) return;
+
+  Formatter format(printer, variables_);
+  format(
+      "if (_internal_has_$name$()) {\n"
+      "  if (!$field_member$->IsInitialized()) return false;\n"
+      "}\n");
+}
+
 // ===================================================================
 
 RepeatedMessageFieldGenerator::RepeatedMessageFieldGenerator(
@@ -648,7 +673,9 @@
     MessageSCCAnalyzer* scc_analyzer)
     : FieldGenerator(descriptor, options),
       implicit_weak_field_(
-          IsImplicitWeakField(descriptor, options, scc_analyzer)) {
+          IsImplicitWeakField(descriptor, options, scc_analyzer)),
+      has_required_fields_(
+          scc_analyzer->HasRequiredFields(descriptor->message_type())) {
   SetMessageVariables(descriptor, options, implicit_weak_field_, &variables_);
 }
 
@@ -835,6 +862,24 @@
       "}\n");
 }
 
+void RepeatedMessageFieldGenerator::GenerateIsInitialized(
+    io::Printer* printer) const {
+  GOOGLE_CHECK(!IsFieldStripped(descriptor_, options_));
+
+  if (!has_required_fields_) return;
+
+  Formatter format(printer, variables_);
+  if (implicit_weak_field_) {
+    format(
+        "if (!::$proto_ns$::internal::AllAreInitializedWeak($name$_.weak))\n"
+        "  return false;\n");
+  } else {
+    format(
+        "if (!::$proto_ns$::internal::AllAreInitialized($name$_))\n"
+        "  return false;\n");
+  }
+}
+
 void RepeatedMessageFieldGenerator::GenerateConstinitInitializer(
     io::Printer* printer) const {
   Formatter format(printer, variables_);
diff --git a/src/google/protobuf/compiler/cpp/cpp_message_field.h b/src/google/protobuf/compiler/cpp/cpp_message_field.h
index 712ddbf..2beac62 100644
--- a/src/google/protobuf/compiler/cpp/cpp_message_field.h
+++ b/src/google/protobuf/compiler/cpp/cpp_message_field.h
@@ -50,7 +50,7 @@
   MessageFieldGenerator(const FieldDescriptor* descriptor,
                         const Options& options,
                         MessageSCCAnalyzer* scc_analyzer);
-  ~MessageFieldGenerator();
+  ~MessageFieldGenerator() override;
 
   // implements FieldGenerator ---------------------------------------
   void GeneratePrivateMembers(io::Printer* printer) const override;
@@ -71,10 +71,12 @@
   void GenerateSerializeWithCachedSizesToArray(
       io::Printer* printer) const override;
   void GenerateByteSize(io::Printer* printer) const override;
+  void GenerateIsInitialized(io::Printer* printer) const override;
   void GenerateConstinitInitializer(io::Printer* printer) const override;
 
  protected:
   const bool implicit_weak_field_;
+  const bool has_required_fields_;
 
  private:
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageFieldGenerator);
@@ -85,7 +87,7 @@
   MessageOneofFieldGenerator(const FieldDescriptor* descriptor,
                              const Options& options,
                              MessageSCCAnalyzer* scc_analyzer);
-  ~MessageOneofFieldGenerator();
+  ~MessageOneofFieldGenerator() override;
 
   // implements FieldGenerator ---------------------------------------
   void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
@@ -99,6 +101,7 @@
   void GenerateSwappingCode(io::Printer* printer) const override;
   void GenerateDestructorCode(io::Printer* printer) const override;
   void GenerateConstructorCode(io::Printer* printer) const override;
+  void GenerateIsInitialized(io::Printer* printer) const override;
 
  private:
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MessageOneofFieldGenerator);
@@ -109,7 +112,7 @@
   RepeatedMessageFieldGenerator(const FieldDescriptor* descriptor,
                                 const Options& options,
                                 MessageSCCAnalyzer* scc_analyzer);
-  ~RepeatedMessageFieldGenerator();
+  ~RepeatedMessageFieldGenerator() override;
 
   // implements FieldGenerator ---------------------------------------
   void GeneratePrivateMembers(io::Printer* printer) const override;
@@ -123,10 +126,12 @@
   void GenerateSerializeWithCachedSizesToArray(
       io::Printer* printer) const override;
   void GenerateByteSize(io::Printer* printer) const override;
+  void GenerateIsInitialized(io::Printer* printer) const override;
   void GenerateConstinitInitializer(io::Printer* printer) const override;
 
  private:
   const bool implicit_weak_field_;
+  const bool has_required_fields_;
 
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedMessageFieldGenerator);
 };
diff --git a/src/google/protobuf/compiler/cpp/cpp_names.h b/src/google/protobuf/compiler/cpp/cpp_names.h
index cbc69a7..6bcbff0 100644
--- a/src/google/protobuf/compiler/cpp/cpp_names.h
+++ b/src/google/protobuf/compiler/cpp/cpp_names.h
@@ -73,6 +73,12 @@
 // anyway, so normally this just returns field->name().
 std::string FieldName(const FieldDescriptor* field);
 
+// Requires that this field is in a oneof. Returns the (unqualified) case
+// constant for this field.
+std::string OneofCaseConstantName(const FieldDescriptor* field);
+// Returns the quafilied case constant for this field.
+std::string QualifiedOneofCaseConstantName(const FieldDescriptor* field);
+
 // Get the (unqualified) name that should be used for this enum value in C++
 // code.
 std::string EnumValueName(const EnumValueDescriptor* enum_value);
diff --git a/src/google/protobuf/compiler/cpp/cpp_options.h b/src/google/protobuf/compiler/cpp/cpp_options.h
index 57cef2f..d0f16d0 100644
--- a/src/google/protobuf/compiler/cpp/cpp_options.h
+++ b/src/google/protobuf/compiler/cpp/cpp_options.h
@@ -70,7 +70,7 @@
   bool opensource_runtime = false;
   bool annotate_accessor = false;
   bool unused_field_stripping = false;
-  bool profile_driven_inline_string = false;
+  bool profile_driven_inline_string = true;
   bool force_inline_string = false;
   std::string runtime_include_base;
   int num_cc_files = 0;
diff --git a/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc b/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
index 1a8468d..810f240 100644
--- a/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.cc
@@ -81,9 +81,9 @@
   return CodedTagType(TagSize(field->number()));
 }
 
-std::string TcParserBaseName(const Options& options) {
+std::string TcParserName(const Options& options) {
   return StrCat("::", ProtobufNamespace(options),
-                      "::internal::TcParserBase::");
+                      "::internal::TcParser::");
 }
 
 std::string MessageTcParseFunctionName(const FieldDescriptor* field,
@@ -93,8 +93,8 @@
     // For files with `option optimize_for = CODE_SIZE`, or which derive from
     // `ZeroFieldsBase`, we need to call the `_InternalParse` function, because
     // there is no generated tailcall function. For tailcall parsing, this is
-    // done by helpers in TcParserBase.
-    return StrCat(TcParserBaseName(options),
+    // done by helpers in TcParser.
+    return StrCat(TcParserName(options),
                         (field->is_repeated() ? "Repeated" : "Singular"),
                         "ParseMessage<",
                         QualifiedClassName(field->message_type()),  //
@@ -108,8 +108,7 @@
 }
 
 std::string FieldParseFunctionName(const FieldDescriptor* field,
-                                   const Options& options,
-                                   uint32_t table_size_log2);
+                                   const Options& options);
 
 }  // namespace
 
@@ -209,14 +208,14 @@
       case FieldDescriptor::TYPE_SINT64:
       case FieldDescriptor::TYPE_SINT32:
       case FieldDescriptor::TYPE_BOOL:
-        name = FieldParseFunctionName(field, options, table_size_log2);
+        name = FieldParseFunctionName(field, options);
         break;
 
       case FieldDescriptor::TYPE_BYTES:
         if (field->options().ctype() == FieldOptions::STRING &&
             field->default_value_string().empty() &&
             !IsStringInlined(field, options)) {
-          name = FieldParseFunctionName(field, options, table_size_log2);
+          name = FieldParseFunctionName(field, options);
         }
         break;
 
@@ -365,9 +364,8 @@
       "const char* $classname$::_InternalParse(\n"
       "    const char* ptr, ::$proto_ns$::internal::ParseContext* ctx) {\n"
       "$annotate_deserialize$"
-      "  ptr = ::$proto_ns$::internal::TcParser<$1$>::ParseLoop(\n"
-      "      this, ptr, ctx, &_table_.header);\n",
-      tc_table_info_->table_size_log2);
+      "  ptr = ::$proto_ns$::internal::TcParser::ParseLoop(\n"
+      "      this, ptr, ctx, &_table_.header);\n");
   format(
       "  return ptr;\n"
       "}\n\n");
@@ -426,9 +424,9 @@
         "return table->fallback(PROTOBUF_TC_PARAM_PASS);\n"
         "  ptr += $1$;\n"
         "  hasbits |= (uint64_t{1} << data.hasbit_idx());\n"
-        "  ::$proto_ns$::internal::TcParserBase::SyncHasbits"
+        "  ::$proto_ns$::internal::TcParser::SyncHasbits"
         "(msg, hasbits, table);\n"
-        "  auto& field = ::$proto_ns$::internal::TcParserBase::"
+        "  auto& field = ::$proto_ns$::internal::TcParser::"
         "RefAt<$classtype$*>(msg, data.offset());\n"
         "  if (field == nullptr)\n"
         "    field = CreateMaybeMessage<$classtype$>(ctx->data().arena);\n"
@@ -448,9 +446,9 @@
         "return table->fallback(PROTOBUF_TC_PARAM_PASS);\n"
         "  }\n"
         "  ptr += $1$;\n"
-        "  auto& field = ::$proto_ns$::internal::TcParserBase::RefAt<"
+        "  auto& field = ::$proto_ns$::internal::TcParser::RefAt<"
         "::$proto_ns$::RepeatedPtrField<$classname$>>(msg, data.offset());\n"
-        "  ::$proto_ns$::internal::TcParserBase::SyncHasbits"
+        "  ::$proto_ns$::internal::TcParser::SyncHasbits"
         "(msg, hasbits, table);\n"
         "  ptr = ctx->ParseMessage(field.Add(), ptr);\n"
         "  return ptr;\n"
@@ -471,7 +469,7 @@
     format.Indent();
   }
   format(
-      "static const ::$proto_ns$::internal::TailCallParseTable<$1$>\n"
+      "static const ::$proto_ns$::internal::TcParseTable<$1$>\n"
       "    _table_;\n",
       tc_table_info_->table_size_log2);
   if (should_generate_guarded_tctable()) {
@@ -546,7 +544,7 @@
   if (tc_table_info_->use_generated_fallback) {
     fallback = ClassName(descriptor_) + "::Tct_ParseFallback";
   } else {
-    fallback = TcParserBaseName(options_) + "GenericFallback";
+    fallback = TcParserName(options_) + "GenericFallback";
     if (GetOptimizeFor(descriptor_->file(), options_) ==
         FileOptions::LITE_RUNTIME) {
       fallback += "Lite";
@@ -561,33 +559,48 @@
   // the table is sufficient we can use a generic routine, that just handles
   // unknown fields and potentially an extension range.
   format(
-      "const ::$proto_ns$::internal::TailCallParseTable<$1$>\n"
+      "const ::$proto_ns$::internal::TcParseTable<$1$>\n"
       "    $classname$::_table_ = {\n",
       tc_table_info_->table_size_log2);
-  format.Indent();
-  format("{\n");
-  format.Indent();
-  if (num_hasbits_ > 0 || IsMapEntryMessage(descriptor_)) {
-    format("PROTOBUF_FIELD_OFFSET($classname$, _has_bits_),\n");
-  } else {
-    format("0,  // no _has_bits_\n");
+  {
+    auto table_scope = format.ScopedIndent();
+    format("{\n");
+    {
+      auto header_scope = format.ScopedIndent();
+      if (num_hasbits_ > 0 || IsMapEntryMessage(descriptor_)) {
+        format("PROTOBUF_FIELD_OFFSET($classname$, _has_bits_),\n");
+      } else {
+        format("0,  // no _has_bits_\n");
+      }
+      if (descriptor_->extension_range_count() == 1) {
+        format(
+            "PROTOBUF_FIELD_OFFSET($classname$, _extensions_),\n"
+            "$1$, $2$,  // extension_range_{low,high}\n",
+            descriptor_->extension_range(0)->start,
+            descriptor_->extension_range(0)->end);
+      } else {
+        format("0, 0, 0,  // no _extensions_\n");
+      }
+      format(
+          "$1$, 0, $2$,  // fast_idx_mask, reserved, num_fields\n"
+          "&$3$._instance,\n"
+          "$4$  // fallback\n",
+          (((1 << tc_table_info_->table_size_log2) - 1) << 3),
+          descriptor_->field_count(),
+          DefaultInstanceName(descriptor_, options_), fallback);
+    }
+    format("}, {\n");
+    {
+      auto fast_scope = format.ScopedIndent();
+      GenerateFastFieldEntries(format, fallback);
+    }
+    format("},\n");  // entries[]
   }
-  if (descriptor_->extension_range_count() == 1) {
-    format(
-        "PROTOBUF_FIELD_OFFSET($classname$, _extensions_),\n"
-        "$1$, $2$,  // extension_range_{low,high}\n",
-        descriptor_->extension_range(0)->start,
-        descriptor_->extension_range(0)->end);
-  } else {
-    format("0, 0, 0,  // no _extensions_\n");
-  }
-  format(
-      "&$1$._instance,\n"
-      "$2$  // fallback\n",
-      DefaultInstanceName(descriptor_, options_), fallback);
-  format.Outdent();
-  format("}, {\n");
-  format.Indent();
+  format("};\n\n");  // _table_
+}
+
+void ParseFunctionGenerator::GenerateFastFieldEntries(
+    Formatter& format, const std::string& fallback) {
   for (const auto& info : tc_table_info_->fast_path_fields) {
     if (info.field != nullptr) {
       PrintFieldComment(format, info.field);
@@ -604,10 +617,6 @@
     }
     format("},\n");
   }
-  format.Outdent();
-  format("},\n");  // entries[]
-  format.Outdent();
-  format("};\n\n");  // _table_
 }
 
 void ParseFunctionGenerator::GenerateArenaString(Formatter& format,
@@ -634,6 +643,8 @@
         ", ~0x$2$u",
         inlined_string_index / 32,
         strings::Hex(1u << (inlined_string_index % 32), strings::ZERO_PAD_8));
+  } else {
+    GOOGLE_DCHECK(field->default_value_string().empty());
   }
   format(
       ");\n"
@@ -766,15 +777,22 @@
                 "$msg$GetArenaForAllocation());\n"
                 "  $msg$set_has_$name$();\n"
                 "}\n"
-                "ptr = ctx->ParseMessage($msg$$1$_.$name$_, ptr);\n",
+                "auto* lazy_field = $msg$$1$_.$name$_;\n",
                 field->containing_oneof()->name());
           } else if (HasHasbit(field)) {
             format(
                 "_Internal::set_has_$name$(&$has_bits$);\n"
-                "ptr = ctx->ParseMessage(&$msg$$name$_, ptr);\n");
+                "auto* lazy_field = &$msg$$name$_;\n");
           } else {
-            format("ptr = ctx->ParseMessage(&$msg$$name$_, ptr);\n");
+            format("auto* lazy_field = &$msg$$name$_;\n");
           }
+          format(
+              "::$proto_ns$::internal::LazyFieldParseHelper<\n"
+              "  ::$proto_ns$::internal::LazyField> parse_helper(\n"
+              "    $1$::default_instance(),\n"
+              "    $msg$GetArenaForAllocation(), lazy_field);\n"
+              "ptr = ctx->ParseMessage(&parse_helper, ptr);\n",
+              FieldMessageTypeName(field, options_));
         } else if (IsImplicitWeakField(field, options_, scc_analyzer_)) {
           if (!field->is_repeated()) {
             format(
@@ -859,7 +877,8 @@
               field->number());
         }
       } else {
-        std::string size = (field->type() == FieldDescriptor::TYPE_SINT32 ||
+        std::string size = (field->type() == FieldDescriptor::TYPE_INT32 ||
+                            field->type() == FieldDescriptor::TYPE_SINT32 ||
                             field->type() == FieldDescriptor::TYPE_UINT32)
                                ? "32"
                                : "64";
@@ -1086,8 +1105,7 @@
 namespace {
 
 std::string FieldParseFunctionName(const FieldDescriptor* field,
-                                   const Options& options,
-                                   uint32_t table_size_log2) {
+                                   const Options& options) {
   ParseCardinality card =  //
       field->is_packed()               ? ParseCardinality::kPacked
       : field->is_repeated()           ? ParseCardinality::kRepeated
@@ -1146,9 +1164,8 @@
           type_format = TypeFormat::kStringValidateOnly;
           break;
         default:
-          GOOGLE_LOG(DFATAL)
-              << "Mode not handled: "
-              << static_cast<int>(GetUtf8CheckMode(field, options));
+          GOOGLE_LOG(DFATAL) << "Mode not handled: "
+                      << static_cast<int>(GetUtf8CheckMode(field, options));
           return "";
       }
       break;
@@ -1158,8 +1175,8 @@
       return "";
   }
 
-  return "::" + ProtobufNamespace(options) + "::internal::" +
-         GetTailCallFieldHandlerName(card, type_format, table_size_log2,
+  return "::" + ProtobufNamespace(options) + "::internal::TcParser::" +
+         GetTailCallFieldHandlerName(card, type_format,
                                      TagSize(field->number()), options);
 }
 
@@ -1167,32 +1184,10 @@
 
 std::string GetTailCallFieldHandlerName(ParseCardinality card,
                                         TypeFormat type_format,
-                                        int table_size_log2,
                                         int tag_length_bytes,
                                         const Options& options) {
   std::string name;
 
-  switch (card) {
-    case ParseCardinality::kPacked:
-    case ParseCardinality::kRepeated:
-      name = "TcParserBase::";
-      break;
-
-    case ParseCardinality::kSingular:
-    case ParseCardinality::kOneof:
-      switch (type_format) {
-        case TypeFormat::kBytes:
-        case TypeFormat::kString:
-        case TypeFormat::kStringValidateOnly:
-          name = "TcParserBase::";
-          break;
-
-        default:
-          name = StrCat("TcParser<", table_size_log2, ">::");
-          break;
-      }
-  }
-
   // The field implementation functions are prefixed by cardinality:
   //   `Singular` for optional or implicit fields.
   //   `Repeated` for non-packed repeated.
@@ -1274,26 +1269,24 @@
     case TypeFormat::kVar64:
     case TypeFormat::kVar32:
     case TypeFormat::kBool:
-      name.append(
-          StrCat(", ", TcParserBaseName(options), "kNoConversion"));
+      StrAppend(&name, ", ", TcParserName(options), "kNoConversion");
       break;
 
     case TypeFormat::kSInt64:
     case TypeFormat::kSInt32:
-      name.append(StrCat(", ", TcParserBaseName(options), "kZigZag"));
+      StrAppend(&name, ", ", TcParserName(options), "kZigZag");
       break;
 
     case TypeFormat::kBytes:
-      name.append(StrCat(", ", TcParserBaseName(options), "kNoUtf8"));
+      StrAppend(&name, ", ", TcParserName(options), "kNoUtf8");
       break;
 
     case TypeFormat::kString:
-      name.append(StrCat(", ", TcParserBaseName(options), "kUtf8"));
+      StrAppend(&name, ", ", TcParserName(options), "kUtf8");
       break;
 
     case TypeFormat::kStringValidateOnly:
-      name.append(
-          StrCat(", ", TcParserBaseName(options), "kUtf8ValidateOnly"));
+      StrAppend(&name, ", ", TcParserName(options), "kUtf8ValidateOnly");
       break;
 
     default:
diff --git a/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h b/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h
index 793e6ae..b921067 100644
--- a/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h
+++ b/src/google/protobuf/compiler/cpp/cpp_parse_function_generator.h
@@ -118,6 +118,7 @@
 
   // Generates the tail-call table definition.
   void GenerateTailCallTable(Formatter& format);
+  void GenerateFastFieldEntries(Formatter& format, const std::string& fallback);
 
   // Generates parsing code for an `ArenaString` field.
   void GenerateArenaString(Formatter& format, const FieldDescriptor* field);
@@ -187,7 +188,6 @@
 // parse_function_inc_generator_main.
 std::string GetTailCallFieldHandlerName(ParseCardinality card,
                                         TypeFormat type_format,
-                                        int table_size_log2,
                                         int tag_length_bytes,
                                         const Options& options);
 
diff --git a/src/google/protobuf/compiler/cpp/cpp_primitive_field.h b/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
index ce0f97d..ff7c208 100644
--- a/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
+++ b/src/google/protobuf/compiler/cpp/cpp_primitive_field.h
@@ -59,7 +59,8 @@
   void GenerateSwappingCode(io::Printer* printer) const override;
   void GenerateConstructorCode(io::Printer* printer) const override;
   void GenerateCopyConstructorCode(io::Printer* printer) const override;
-  void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const override;
+  void GenerateSerializeWithCachedSizesToArray(
+      io::Printer* printer) const override;
   void GenerateByteSize(io::Printer* printer) const override;
   void GenerateConstinitInitializer(io::Printer* printer) const override;
 
@@ -98,7 +99,8 @@
   void GenerateSwappingCode(io::Printer* printer) const override;
   void GenerateConstructorCode(io::Printer* printer) const override;
   void GenerateCopyConstructorCode(io::Printer* printer) const override;
-  void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const override;
+  void GenerateSerializeWithCachedSizesToArray(
+      io::Printer* printer) const override;
   void GenerateByteSize(io::Printer* printer) const override;
   void GenerateConstinitInitializer(io::Printer* printer) const override;
 
diff --git a/src/google/protobuf/compiler/cpp/cpp_service.cc b/src/google/protobuf/compiler/cpp/cpp_service.cc
index 994e653..6b1ca83 100644
--- a/src/google/protobuf/compiler/cpp/cpp_service.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_service.cc
@@ -241,12 +241,12 @@
 
   for (int i = 0; i < descriptor_->method_count(); i++) {
     const MethodDescriptor* method = descriptor_->method(i);
-    Formatter format(printer, vars_);
-    InitMethodVariables(method, options_, &format);
+    Formatter format_method(printer, vars_);
+    InitMethodVariables(method, options_, &format_method);
 
     // Note:  down_cast does not work here because it only works on pointers,
     //   not references.
-    format(
+    format_method(
         "    case $1$:\n"
         "      $name$(controller,\n"
         "             ::$proto_ns$::internal::DownCast<const $input_type$*>(\n"
diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
index be19310..607e815 100644
--- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc
@@ -170,7 +170,7 @@
       descriptor_);
   format(
       "$deprecated_attr$std::string* ${1$mutable_$name$$}$();\n"
-      "PROTOBUF_MUST_USE_RESULT $deprecated_attr$std::string* "
+      "PROTOBUF_NODISCARD $deprecated_attr$std::string* "
       "${1$$release_name$$}$();\n"
       "$deprecated_attr$void ${1$set_allocated_$name$$}$(std::string* "
       "$name$);\n",
@@ -290,8 +290,17 @@
         "  $clear_hasbit$\n");
     if (!inlined_) {
       format(
-          "  return $name$_.ReleaseNonDefault($init_value$, "
+          "  auto* p = $name$_.ReleaseNonDefault($init_value$, "
           "GetArenaForAllocation());\n");
+      if (descriptor_->default_value_string().empty()) {
+        format(
+            "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"
+            "  if ($name$_.IsDefault($init_value$)) {\n"
+            "    $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n"
+            "  }\n"
+            "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n");
+      }
+      format("  return p;\n");
     } else {
       format(
           "  return $name$_.Release(nullptr, GetArenaForAllocation(), "
@@ -314,6 +323,14 @@
     format(
         "  $name$_.SetAllocated($init_value$, $name$,\n"
         "      GetArenaForAllocation());\n");
+    if (descriptor_->default_value_string().empty()) {
+      format(
+          "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"
+          "  if ($name$_.IsDefault($init_value$)) {\n"
+          "    $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n"
+          "  }\n"
+          "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n");
+    }
   } else {
     // Currently, string fields with default value can't be inlined.
     format(
@@ -422,6 +439,13 @@
   }
   GOOGLE_DCHECK(!inlined_);
   format("$name$_.UnsafeSetDefault($init_value$);\n");
+  if (IsString(descriptor_, options_) &&
+      descriptor_->default_value_string().empty()) {
+    format(
+        "#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING\n"
+        "  $name$_.Set($init_value$, \"\", GetArenaForAllocation());\n"
+        "#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING\n");
+  }
 }
 
 void StringFieldGenerator::GenerateCopyConstructorCode(
diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.h b/src/google/protobuf/compiler/cpp/cpp_string_field.h
index 85689bb..3f05443 100644
--- a/src/google/protobuf/compiler/cpp/cpp_string_field.h
+++ b/src/google/protobuf/compiler/cpp/cpp_string_field.h
@@ -55,7 +55,8 @@
   void GenerateStaticMembers(io::Printer* printer) const override;
   void GenerateAccessorDeclarations(io::Printer* printer) const override;
   void GenerateInlineAccessorDefinitions(io::Printer* printer) const override;
-  void GenerateNonInlineAccessorDefinitions(io::Printer* printer) const override;
+  void GenerateNonInlineAccessorDefinitions(
+      io::Printer* printer) const override;
   void GenerateClearingCode(io::Printer* printer) const override;
   void GenerateMessageClearingCode(io::Printer* printer) const override;
   void GenerateMergingCode(io::Printer* printer) const override;
@@ -63,7 +64,8 @@
   void GenerateConstructorCode(io::Printer* printer) const override;
   void GenerateCopyConstructorCode(io::Printer* printer) const override;
   void GenerateDestructorCode(io::Printer* printer) const override;
-  void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const override;
+  void GenerateSerializeWithCachedSizesToArray(
+      io::Printer* printer) const override;
   void GenerateByteSize(io::Printer* printer) const override;
   void GenerateConstinitInitializer(io::Printer* printer) const override;
   bool IsInlined() const override { return inlined_; }
@@ -108,7 +110,8 @@
   void GenerateSwappingCode(io::Printer* printer) const override;
   void GenerateConstructorCode(io::Printer* printer) const override;
   void GenerateCopyConstructorCode(io::Printer* printer) const override;
-  void GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const override;
+  void GenerateSerializeWithCachedSizesToArray(
+      io::Printer* printer) const override;
   void GenerateByteSize(io::Printer* printer) const override;
   void GenerateConstinitInitializer(io::Printer* printer) const override;
 
diff --git a/src/google/protobuf/compiler/cpp/cpp_unittest.inc b/src/google/protobuf/compiler/cpp/cpp_unittest.inc
index bfdbfd1..782d226 100644
--- a/src/google/protobuf/compiler/cpp/cpp_unittest.inc
+++ b/src/google/protobuf/compiler/cpp/cpp_unittest.inc
@@ -1159,10 +1159,8 @@
 
     // implements TestService ----------------------------------------
 
-    void Foo(RpcController* controller,
-             const UNITTEST::FooRequest* request,
-             UNITTEST::FooResponse* response,
-             Closure* done) override {
+    void Foo(RpcController* controller, const UNITTEST::FooRequest* request,
+             UNITTEST::FooResponse* response, Closure* done) override {
       ASSERT_FALSE(called_);
       called_ = true;
       method_ = "Foo";
@@ -1172,10 +1170,8 @@
       done_ = done;
     }
 
-    void Bar(RpcController* controller,
-             const UNITTEST::BarRequest* request,
-             UNITTEST::BarResponse* response,
-             Closure* done) override {
+    void Bar(RpcController* controller, const UNITTEST::BarRequest* request,
+             UNITTEST::BarResponse* response, Closure* done) override {
       ASSERT_FALSE(called_);
       called_ = true;
       method_ = "Bar";
@@ -1214,10 +1210,8 @@
 
     // implements TestService ----------------------------------------
 
-    void CallMethod(const MethodDescriptor* method,
-                    RpcController* controller,
-                    const Message* request,
-                    Message* response,
+    void CallMethod(const MethodDescriptor* method, RpcController* controller,
+                    const Message* request, Message* response,
                     Closure* done) override {
       ASSERT_FALSE(called_);
       called_ = true;
@@ -1274,7 +1268,7 @@
       stub_(&mock_channel_),
       done_(::google::protobuf::NewPermanentCallback(&DoNothing)) {}
 
-  virtual void SetUp() override {
+  void SetUp() override {
     ASSERT_TRUE(foo_ != NULL);
     ASSERT_TRUE(bar_ != NULL);
   }
@@ -1437,8 +1431,7 @@
 
 class OneofTest : public testing::Test {
  protected:
-  virtual void SetUp() override {
-  }
+  void SetUp() override {}
 
   void ExpectEnumCasesWork(const UNITTEST::TestOneof2 &message) {
     switch (message.foo_case()) {
diff --git a/src/google/protobuf/compiler/importer.cc b/src/google/protobuf/compiler/importer.cc
index d0b3f4c..3bcb0c9 100644
--- a/src/google/protobuf/compiler/importer.cc
+++ b/src/google/protobuf/compiler/importer.cc
@@ -467,7 +467,7 @@
   for (const auto& mapping : mappings_) {
     std::string temp_disk_file;
     if (ApplyMapping(virtual_file, mapping.virtual_path, mapping.disk_path,
-          &temp_disk_file)) {
+                     &temp_disk_file)) {
       io::ZeroCopyInputStream* stream = OpenDiskFile(temp_disk_file);
       if (stream != NULL) {
         if (disk_file != NULL) {
diff --git a/src/google/protobuf/compiler/java/java_doc_comment.cc b/src/google/protobuf/compiler/java/java_doc_comment.cc
index 2376488..80b7902 100644
--- a/src/google/protobuf/compiler/java/java_doc_comment.cc
+++ b/src/google/protobuf/compiler/java/java_doc_comment.cc
@@ -36,6 +36,7 @@
 
 #include <vector>
 
+#include <google/protobuf/descriptor.pb.h>
 #include <google/protobuf/io/printer.h>
 #include <google/protobuf/stubs/strutil.h>
 
@@ -186,6 +187,21 @@
   printer->Print(" */\n");
 }
 
+void WriteDeprecatedJavadoc(io::Printer* printer, const FieldDescriptor* field,
+                            const FieldAccessorType type) {
+  if (!field->options().deprecated()) {
+    return;
+  }
+
+  // Lite codegen does not annotate set & clear methods with @Deprecated.
+  if (field->file()->options().optimize_for() == FileOptions::LITE_RUNTIME &&
+      (type == SETTER || type == CLEARER)) {
+    return;
+  }
+
+  printer->Print(" * @deprecated\n");
+}
+
 void WriteFieldAccessorDocComment(io::Printer* printer,
                                   const FieldDescriptor* field,
                                   const FieldAccessorType type,
@@ -194,6 +210,7 @@
   WriteDocCommentBody(printer, field);
   printer->Print(" * <code>$def$</code>\n", "def",
                  EscapeJavadoc(FirstLineOf(field->DebugString())));
+  WriteDeprecatedJavadoc(printer, field, type);
   switch (type) {
     case HAZZER:
       printer->Print(" * @return Whether the $name$ field is set.\n", "name",
@@ -252,6 +269,7 @@
   WriteDocCommentBody(printer, field);
   printer->Print(" * <code>$def$</code>\n", "def",
                  EscapeJavadoc(FirstLineOf(field->DebugString())));
+  WriteDeprecatedJavadoc(printer, field, type);
   switch (type) {
     case HAZZER:
       // Should never happen
@@ -321,6 +339,7 @@
   WriteDocCommentBody(printer, field);
   printer->Print(" * <code>$def$</code>\n", "def",
                  EscapeJavadoc(FirstLineOf(field->DebugString())));
+  WriteDeprecatedJavadoc(printer, field, type);
   switch (type) {
     case HAZZER:
       // Should never happen
diff --git a/src/google/protobuf/compiler/java/java_enum_field.cc b/src/google/protobuf/compiler/java/java_enum_field.cc
index e68eb77..0dad42a 100644
--- a/src/google/protobuf/compiler/java/java_enum_field.cc
+++ b/src/google/protobuf/compiler/java/java_enum_field.cc
@@ -280,7 +280,7 @@
     io::Printer* printer) const {
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$var $kt_name$: $kt_type$\n"
+                 "$kt_deprecation$public var $kt_name$: $kt_type$\n"
                  "  @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
                  "  get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
                  "  @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
@@ -291,16 +291,17 @@
   WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
                                /* builder */ false);
   printer->Print(variables_,
-                 "fun ${$clear$kt_capitalized_name$$}$() {\n"
+                 "public fun ${$clear$kt_capitalized_name$$}$() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
                  "}\n");
 
   if (HasHazzer(descriptor_)) {
     WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
-    printer->Print(variables_,
-                   "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
-                   "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
-                   "}\n");
+    printer->Print(
+        variables_,
+        "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+        "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+        "}\n");
   }
 }
 
@@ -1081,12 +1082,12 @@
       " */\n"
       "@kotlin.OptIn"
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
-      "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+      "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
       " : com.google.protobuf.kotlin.DslProxy()\n");
 
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$ val $kt_name$: "
+                 "$kt_deprecation$ public val $kt_name$: "
                  "com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
                  "  @kotlin.jvm.JvmSynthetic\n"
@@ -1099,7 +1100,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "add(value: $kt_type$) {\n"
                  "  $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
@@ -1110,7 +1111,8 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
-                 "inline operator fun com.google.protobuf.kotlin.DslList"
+                 "@Suppress(\"NOTHING_TO_INLINE\")\n"
+                 "public inline operator fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "plusAssign(value: $kt_type$) {\n"
                  "  add(value)\n"
@@ -1121,7 +1123,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
                  "  $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
@@ -1133,7 +1135,8 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
-      "inline operator fun com.google.protobuf.kotlin.DslList"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun com.google.protobuf.kotlin.DslList"
       "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
       "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
       "  addAll(values)\n"
@@ -1145,7 +1148,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
-      "operator fun com.google.protobuf.kotlin.DslList"
+      "public operator fun com.google.protobuf.kotlin.DslList"
       "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
       "set(index: kotlin.Int, value: $kt_type$) {\n"
       "  $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
@@ -1156,7 +1159,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "clear() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/java_enum_field_lite.cc b/src/google/protobuf/compiler/java/java_enum_field_lite.cc
index f154f95..ca3a2e8 100644
--- a/src/google/protobuf/compiler/java/java_enum_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_enum_field_lite.cc
@@ -285,7 +285,7 @@
     io::Printer* printer) const {
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$var $kt_name$: $kt_type$\n"
+                 "$kt_deprecation$public var $kt_name$: $kt_type$\n"
                  "  @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
                  "  get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
                  "  @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
@@ -296,16 +296,17 @@
   WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
                                /* builder */ false);
   printer->Print(variables_,
-                 "fun ${$clear$kt_capitalized_name$$}$() {\n"
+                 "public fun ${$clear$kt_capitalized_name$$}$() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
                  "}\n");
 
   if (HasHazzer(descriptor_)) {
     WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
-    printer->Print(variables_,
-                   "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
-                   "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
-                   "}\n");
+    printer->Print(
+        variables_,
+        "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+        "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+        "}\n");
   }
 }
 
@@ -823,12 +824,12 @@
       " */\n"
       "@kotlin.OptIn"
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
-      "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+      "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
       " : com.google.protobuf.kotlin.DslProxy()\n");
 
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$ val $kt_name$: "
+                 "$kt_deprecation$ public val $kt_name$: "
                  "com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
                  "  @kotlin.jvm.JvmSynthetic\n"
@@ -841,7 +842,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "add(value: $kt_type$) {\n"
                  "  $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
@@ -852,7 +853,8 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
-                 "inline operator fun com.google.protobuf.kotlin.DslList"
+                 "@Suppress(\"NOTHING_TO_INLINE\")\n"
+                 "public inline operator fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "plusAssign(value: $kt_type$) {\n"
                  "  add(value)\n"
@@ -863,7 +865,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
                  "  $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
@@ -875,7 +877,8 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
-      "inline operator fun com.google.protobuf.kotlin.DslList"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun com.google.protobuf.kotlin.DslList"
       "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
       "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
       "  addAll(values)\n"
@@ -887,7 +890,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
-      "operator fun com.google.protobuf.kotlin.DslList"
+      "public operator fun com.google.protobuf.kotlin.DslList"
       "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
       "set(index: kotlin.Int, value: $kt_type$) {\n"
       "  $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
@@ -898,7 +901,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "clear() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/java_extension.h b/src/google/protobuf/compiler/java/java_extension.h
index 164edfb..f928a78 100644
--- a/src/google/protobuf/compiler/java/java_extension.h
+++ b/src/google/protobuf/compiler/java/java_extension.h
@@ -94,9 +94,9 @@
                                        Context* context);
   virtual ~ImmutableExtensionGenerator();
 
-  virtual void Generate(io::Printer* printer) override;
-  virtual int GenerateNonNestedInitializationCode(io::Printer* printer) override;
-  virtual int GenerateRegistrationCode(io::Printer* printer) override;
+  void Generate(io::Printer* printer) override;
+  int GenerateNonNestedInitializationCode(io::Printer* printer) override;
+  int GenerateRegistrationCode(io::Printer* printer) override;
 
  protected:
   const FieldDescriptor* descriptor_;
diff --git a/src/google/protobuf/compiler/java/java_extension_lite.h b/src/google/protobuf/compiler/java/java_extension_lite.h
index beda4f9..7696156 100644
--- a/src/google/protobuf/compiler/java/java_extension_lite.h
+++ b/src/google/protobuf/compiler/java/java_extension_lite.h
@@ -51,14 +51,13 @@
                                            Context* context);
   virtual ~ImmutableExtensionLiteGenerator();
 
-  virtual void Generate(io::Printer* printer) override;
+  void Generate(io::Printer* printer) override;
 
   // Returns an estimate of the number of bytes the printed code will compile to
-  virtual int GenerateNonNestedInitializationCode(
-      io::Printer* printer) override;
+  int GenerateNonNestedInitializationCode(io::Printer* printer) override;
 
   // Returns an estimate of the number of bytes the printed code will compile to
-  virtual int GenerateRegistrationCode(io::Printer* printer) override;
+  int GenerateRegistrationCode(io::Printer* printer) override;
 
  private:
   const FieldDescriptor* descriptor_;
diff --git a/src/google/protobuf/compiler/java/java_generator_factory.h b/src/google/protobuf/compiler/java/java_generator_factory.h
index e64a45d..831d9dd 100644
--- a/src/google/protobuf/compiler/java/java_generator_factory.h
+++ b/src/google/protobuf/compiler/java/java_generator_factory.h
@@ -80,13 +80,13 @@
   ImmutableGeneratorFactory(Context* context);
   virtual ~ImmutableGeneratorFactory();
 
-  virtual MessageGenerator* NewMessageGenerator(
+  MessageGenerator* NewMessageGenerator(
       const Descriptor* descriptor) const override;
 
-  virtual ExtensionGenerator* NewExtensionGenerator(
+  ExtensionGenerator* NewExtensionGenerator(
       const FieldDescriptor* descriptor) const override;
 
-  virtual ServiceGenerator* NewServiceGenerator(
+  ServiceGenerator* NewServiceGenerator(
       const ServiceDescriptor* descriptor) const override;
 
  private:
diff --git a/src/google/protobuf/compiler/java/java_helpers.h b/src/google/protobuf/compiler/java/java_helpers.h
index 5dc25d6..28cac6a 100644
--- a/src/google/protobuf/compiler/java/java_helpers.h
+++ b/src/google/protobuf/compiler/java/java_helpers.h
@@ -155,7 +155,7 @@
 // Whether we should generate multiple java files for messages.
 inline bool MultipleJavaFiles(const FileDescriptor* descriptor,
                               bool immutable) {
-  (void) immutable;
+  (void)immutable;
   return descriptor->options().java_multiple_files();
 }
 
diff --git a/src/google/protobuf/compiler/java/java_map_field.cc b/src/google/protobuf/compiler/java/java_map_field.cc
index a4ec2ff..8a89100 100644
--- a/src/google/protobuf/compiler/java/java_map_field.cc
+++ b/src/google/protobuf/compiler/java/java_map_field.cc
@@ -111,11 +111,13 @@
   (*variables)["key_default_value"] = DefaultValue(key, true, name_resolver);
   (*variables)["key_null_check"] =
       IsReferenceType(keyJavaType)
-          ? "if (key == null) { throw new java.lang.NullPointerException(); }"
+          ? "if (key == null) { throw new NullPointerException(\"map key\"); }"
           : "";
   (*variables)["value_null_check"] =
-      IsReferenceType(valueJavaType)
-          ? "if (value == null) { throw new java.lang.NullPointerException(); }"
+      valueJavaType != JAVATYPE_ENUM && IsReferenceType(valueJavaType)
+          ? "if (value == null) {\n"
+            "  throw new NullPointerException(\"map value\");\n"
+            "}\n"
           : "";
   if (valueJavaType == JAVATYPE_ENUM) {
     // We store enums as Integers internally.
@@ -435,6 +437,7 @@
           "    $key_type$ key,\n"
           "    $value_type$ value) {\n"
           "  $key_null_check$\n"
+          "  $value_null_check$\n"
           "  internalGetMutable$capitalized_name$().getMutableMap()\n"
           "      .put(key, value);\n"
           "  return this;\n"
@@ -679,13 +682,13 @@
       " */\n"
       "@kotlin.OptIn"
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
-      "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+      "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
       " : com.google.protobuf.kotlin.DslProxy()\n");
 
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(
       variables_,
-      "$kt_deprecation$ val $kt_name$: "
+      "$kt_deprecation$ public val $kt_name$: "
       "com.google.protobuf.kotlin.DslMap"
       "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  @kotlin.jvm.JvmSynthetic\n"
@@ -698,7 +701,7 @@
   printer->Print(
       variables_,
       "@JvmName(\"put$kt_capitalized_name$\")\n"
-      "fun com.google.protobuf.kotlin.DslMap"
+      "public fun com.google.protobuf.kotlin.DslMap"
       "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  .put(key: $kt_key_type$, value: $kt_value_type$) {\n"
       "     $kt_dsl_builder$.${$put$capitalized_name$$}$(key, value)\n"
@@ -709,7 +712,8 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@JvmName(\"set$kt_capitalized_name$\")\n"
-      "inline operator fun com.google.protobuf.kotlin.DslMap"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun com.google.protobuf.kotlin.DslMap"
       "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  .set(key: $kt_key_type$, value: $kt_value_type$) {\n"
       "     put(key, value)\n"
@@ -720,7 +724,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@JvmName(\"remove$kt_capitalized_name$\")\n"
-      "fun com.google.protobuf.kotlin.DslMap"
+      "public fun com.google.protobuf.kotlin.DslMap"
       "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  .remove(key: $kt_key_type$) {\n"
       "     $kt_dsl_builder$.${$remove$capitalized_name$$}$(key)\n"
@@ -731,7 +735,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@JvmName(\"putAll$kt_capitalized_name$\")\n"
-      "fun com.google.protobuf.kotlin.DslMap"
+      "public fun com.google.protobuf.kotlin.DslMap"
       "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  .putAll(map: kotlin.collections.Map<$kt_key_type$, $kt_value_type$>) "
       "{\n"
@@ -743,7 +747,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@JvmName(\"clear$kt_capitalized_name$\")\n"
-      "fun com.google.protobuf.kotlin.DslMap"
+      "public fun com.google.protobuf.kotlin.DslMap"
       "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  .clear() {\n"
       "     $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/java_map_field_lite.cc b/src/google/protobuf/compiler/java/java_map_field_lite.cc
index 023b4fc..e711168 100644
--- a/src/google/protobuf/compiler/java/java_map_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_map_field_lite.cc
@@ -822,13 +822,13 @@
       " */\n"
       "@kotlin.OptIn"
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
-      "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+      "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
       " : com.google.protobuf.kotlin.DslProxy()\n");
 
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(
       variables_,
-      "$kt_deprecation$ val $kt_name$: "
+      "$kt_deprecation$ public val $kt_name$: "
       "com.google.protobuf.kotlin.DslMap"
       "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  @kotlin.jvm.JvmSynthetic\n"
@@ -841,7 +841,7 @@
   printer->Print(
       variables_,
       "@JvmName(\"put$kt_capitalized_name$\")\n"
-      "fun com.google.protobuf.kotlin.DslMap"
+      "public fun com.google.protobuf.kotlin.DslMap"
       "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  .put(key: $kt_key_type$, value: $kt_value_type$) {\n"
       "     $kt_dsl_builder$.${$put$capitalized_name$$}$(key, value)\n"
@@ -852,7 +852,8 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@JvmName(\"set$kt_capitalized_name$\")\n"
-      "inline operator fun com.google.protobuf.kotlin.DslMap"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun com.google.protobuf.kotlin.DslMap"
       "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  .set(key: $kt_key_type$, value: $kt_value_type$) {\n"
       "     put(key, value)\n"
@@ -863,7 +864,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@JvmName(\"remove$kt_capitalized_name$\")\n"
-      "fun com.google.protobuf.kotlin.DslMap"
+      "public fun com.google.protobuf.kotlin.DslMap"
       "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  .remove(key: $kt_key_type$) {\n"
       "     $kt_dsl_builder$.${$remove$capitalized_name$$}$(key)\n"
@@ -874,7 +875,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@JvmName(\"putAll$kt_capitalized_name$\")\n"
-      "fun com.google.protobuf.kotlin.DslMap"
+      "public fun com.google.protobuf.kotlin.DslMap"
       "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  .putAll(map: kotlin.collections.Map<$kt_key_type$, $kt_value_type$>) "
       "{\n"
@@ -886,7 +887,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@JvmName(\"clear$kt_capitalized_name$\")\n"
-      "fun com.google.protobuf.kotlin.DslMap"
+      "public fun com.google.protobuf.kotlin.DslMap"
       "<$kt_key_type$, $kt_value_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  .clear() {\n"
       "     $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/java_message.cc b/src/google/protobuf/compiler/java/java_message.cc
index e30e9f9..27d1014 100644
--- a/src/google/protobuf/compiler/java/java_message.cc
+++ b/src/google/protobuf/compiler/java/java_message.cc
@@ -1407,10 +1407,10 @@
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
       "@com.google.protobuf.kotlin.ProtoDslMarker\n");
   printer->Print(
-      "class Dsl private constructor(\n"
+      "public class Dsl private constructor(\n"
       "  private val _builder: $message$.Builder\n"
       ") {\n"
-      "  companion object {\n"
+      "  public companion object {\n"
       "    @kotlin.jvm.JvmSynthetic\n"
       "    @kotlin.PublishedApi\n"
       "    internal fun _create(builder: $message$.Builder): Dsl = "
@@ -1432,10 +1432,10 @@
 
   for (auto oneof : oneofs_) {
     printer->Print(
-        "val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n"
+        "public val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n"
         "  @JvmName(\"get$oneof_capitalized_name$Case\")\n"
         "  get() = _builder.get$oneof_capitalized_name$Case()\n\n"
-        "fun clear$oneof_capitalized_name$() {\n"
+        "public fun clear$oneof_capitalized_name$() {\n"
         "  _builder.clear$oneof_capitalized_name$()\n"
         "}\n",
         "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name,
@@ -1456,7 +1456,8 @@
     io::Printer* printer) const {
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> kotlin.Unit): "
+      "public inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> "
+      "kotlin.Unit): "
       "$message$ "
       "=\n"
       "  $message_kt$.Dsl._create($message$.newBuilder()).apply { block() "
@@ -1465,7 +1466,7 @@
       "message_kt", name_resolver_->GetKotlinExtensionsClassName(descriptor_),
       "message", name_resolver_->GetClassName(descriptor_, true));
 
-  printer->Print("object $name$Kt {\n", "name", descriptor_->name());
+  printer->Print("public object $name$Kt {\n", "name", descriptor_->name());
   printer->Indent();
   GenerateKotlinDsl(printer);
   for (int i = 0; i < descriptor_->nested_type_count(); i++) {
@@ -1481,7 +1482,8 @@
     io::Printer* printer) const {
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline fun $message$.copy(block: $message_kt$.Dsl.() -> kotlin.Unit): "
+      "public inline fun $message$.copy(block: $message_kt$.Dsl.() -> "
+      "kotlin.Unit): "
       "$message$ =\n"
       "  $message_kt$.Dsl._create(this.toBuilder()).apply { block() "
       "}._build()\n",
@@ -1502,7 +1504,7 @@
   printer->Print(
       "@Suppress(\"UNCHECKED_CAST\")\n"
       "@kotlin.jvm.JvmSynthetic\n"
-      "operator fun <T> get(extension: "
+      "public operator fun <T> get(extension: "
       "com.google.protobuf.ExtensionLite<$message$, T>): T {\n"
       "  return if (extension.isRepeated) {\n"
       "    get(extension as com.google.protobuf.ExtensionLite<$message$, "
@@ -1518,7 +1520,7 @@
       "@kotlin.OptIn"
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
       "@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n"
-      "operator fun <E> get(\n"
+      "public operator fun <E> get(\n"
       "  extension: com.google.protobuf.ExtensionLite<$message$, List<E>>\n"
       "): com.google.protobuf.kotlin.ExtensionList<E, $message$> {\n"
       "  return com.google.protobuf.kotlin.ExtensionList(extension, "
@@ -1528,7 +1530,7 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "operator fun contains(extension: "
+      "public operator fun contains(extension: "
       "com.google.protobuf.ExtensionLite<$message$, *>): "
       "Boolean {\n"
       "  return _builder.hasExtension(extension)\n"
@@ -1537,7 +1539,8 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "fun clear(extension: com.google.protobuf.ExtensionLite<$message$, *>) "
+      "public fun clear(extension: "
+      "com.google.protobuf.ExtensionLite<$message$, *>) "
       "{\n"
       "  _builder.clearExtension(extension)\n"
       "}\n\n",
@@ -1555,7 +1558,8 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline operator fun <T : Comparable<T>> set(\n"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun <T : Comparable<T>> set(\n"
       "  extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
       "  value: T\n"
       ") {\n"
@@ -1565,7 +1569,8 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline operator fun set(\n"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun set(\n"
       "  extension: com.google.protobuf.ExtensionLite<$message$, "
       "com.google.protobuf.ByteString>,\n"
       "  value: com.google.protobuf.ByteString\n"
@@ -1576,7 +1581,8 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline operator fun <T : com.google.protobuf.MessageLite> set(\n"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun <T : com.google.protobuf.MessageLite> set(\n"
       "  extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
       "  value: T\n"
       ") {\n"
@@ -1586,7 +1592,7 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+      "public fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
       "$message$>.add(value: E) {\n"
       "  _builder.addExtension(this.extension, value)\n"
       "}\n\n",
@@ -1594,7 +1600,9 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun <E> "
+      "com.google.protobuf.kotlin.ExtensionList<E, "
       "$message$>.plusAssign"
       "(value: E) {\n"
       "  add(value)\n"
@@ -1603,7 +1611,7 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+      "public fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
       "$message$>.addAll(values: Iterable<E>) {\n"
       "  for (value in values) {\n"
       "    add(value)\n"
@@ -1613,7 +1621,9 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun <E> "
+      "com.google.protobuf.kotlin.ExtensionList<E, "
       "$message$>.plusAssign(values: "
       "Iterable<E>) {\n"
       "  addAll(values)\n"
@@ -1622,7 +1632,7 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+      "public operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
       "$message$>.set(index: Int, value: "
       "E) {\n"
       "  _builder.setExtension(this.extension, index, value)\n"
@@ -1631,7 +1641,8 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline fun com.google.protobuf.kotlin.ExtensionList<*, "
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline fun com.google.protobuf.kotlin.ExtensionList<*, "
       "$message$>.clear() {\n"
       "  clear(extension)\n"
       "}\n\n",
diff --git a/src/google/protobuf/compiler/java/java_message_field.cc b/src/google/protobuf/compiler/java/java_message_field.cc
index a6d5dfe..8aae961 100644
--- a/src/google/protobuf/compiler/java/java_message_field.cc
+++ b/src/google/protobuf/compiler/java/java_message_field.cc
@@ -417,7 +417,7 @@
     io::Printer* printer) const {
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$var $kt_name$: $kt_type$\n"
+                 "$kt_deprecation$public var $kt_name$: $kt_type$\n"
                  "  @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
                  "  get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
                  "  @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
@@ -428,15 +428,16 @@
   WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
                                /* builder */ false);
   printer->Print(variables_,
-                 "fun ${$clear$kt_capitalized_name$$}$() {\n"
+                 "public fun ${$clear$kt_capitalized_name$$}$() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
                  "}\n");
 
   WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
-  printer->Print(variables_,
-                 "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
-                 "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
-                 "}\n");
+  printer->Print(
+      variables_,
+      "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+      "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+      "}\n");
 }
 
 void ImmutableMessageFieldGenerator::GenerateFieldBuilderInitializationCode(
@@ -1403,12 +1404,12 @@
       " */\n"
       "@kotlin.OptIn"
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
-      "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+      "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
       " : com.google.protobuf.kotlin.DslProxy()\n");
 
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$ val $kt_name$: "
+                 "$kt_deprecation$ public val $kt_name$: "
                  "com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
                  "  @kotlin.jvm.JvmSynthetic\n"
@@ -1421,7 +1422,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "add(value: $kt_type$) {\n"
                  "  $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
@@ -1432,7 +1433,8 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
-                 "inline operator fun com.google.protobuf.kotlin.DslList"
+                 "@Suppress(\"NOTHING_TO_INLINE\")\n"
+                 "public inline operator fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "plusAssign(value: $kt_type$) {\n"
                  "  add(value)\n"
@@ -1443,7 +1445,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
                  "  $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
@@ -1455,7 +1457,8 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
-      "inline operator fun com.google.protobuf.kotlin.DslList"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun com.google.protobuf.kotlin.DslList"
       "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
       "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
       "  addAll(values)\n"
@@ -1467,7 +1470,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
-      "operator fun com.google.protobuf.kotlin.DslList"
+      "public operator fun com.google.protobuf.kotlin.DslList"
       "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
       "set(index: kotlin.Int, value: $kt_type$) {\n"
       "  $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
@@ -1478,7 +1481,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "clear() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/java_message_field.h b/src/google/protobuf/compiler/java/java_message_field.h
index 60acb19..8588100 100644
--- a/src/google/protobuf/compiler/java/java_message_field.h
+++ b/src/google/protobuf/compiler/java/java_message_field.h
@@ -78,7 +78,8 @@
   void GenerateParsingDoneCode(io::Printer* printer) const override;
   void GenerateSerializationCode(io::Printer* printer) const override;
   void GenerateSerializedSizeCode(io::Printer* printer) const override;
-  void GenerateFieldBuilderInitializationCode(io::Printer* printer) const override;
+  void GenerateFieldBuilderInitializationCode(
+      io::Printer* printer) const override;
   void GenerateEqualsCode(io::Printer* printer) const override;
   void GenerateHashCode(io::Printer* printer) const override;
   void GenerateKotlinDslMembers(io::Printer* printer) const override;
diff --git a/src/google/protobuf/compiler/java/java_message_field_lite.cc b/src/google/protobuf/compiler/java/java_message_field_lite.cc
index adb91a3..1c4d016 100644
--- a/src/google/protobuf/compiler/java/java_message_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_message_field_lite.cc
@@ -287,7 +287,7 @@
     io::Printer* printer) const {
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$var $kt_name$: $kt_type$\n"
+                 "$kt_deprecation$public var $kt_name$: $kt_type$\n"
                  "  @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
                  "  get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
                  "  @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
@@ -298,15 +298,16 @@
   WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
                                /* builder */ false);
   printer->Print(variables_,
-                 "fun ${$clear$kt_capitalized_name$$}$() {\n"
+                 "public fun ${$clear$kt_capitalized_name$$}$() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
                  "}\n");
 
   WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
-  printer->Print(variables_,
-                 "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
-                 "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
-                 "}\n");
+  printer->Print(
+      variables_,
+      "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+      "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+      "}\n");
 }
 
 void ImmutableMessageFieldLiteGenerator::GenerateFieldInfo(
@@ -793,12 +794,12 @@
       " */\n"
       "@kotlin.OptIn"
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
-      "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+      "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
       " : com.google.protobuf.kotlin.DslProxy()\n");
 
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$ val $kt_name$: "
+                 "$kt_deprecation$ public val $kt_name$: "
                  "com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
                  "  @kotlin.jvm.JvmSynthetic\n"
@@ -811,7 +812,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "add(value: $kt_type$) {\n"
                  "  $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
@@ -822,7 +823,8 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
-                 "inline operator fun com.google.protobuf.kotlin.DslList"
+                 "@Suppress(\"NOTHING_TO_INLINE\")\n"
+                 "public inline operator fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "plusAssign(value: $kt_type$) {\n"
                  "  add(value)\n"
@@ -833,7 +835,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
                  "  $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
@@ -845,7 +847,8 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
-      "inline operator fun com.google.protobuf.kotlin.DslList"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun com.google.protobuf.kotlin.DslList"
       "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
       "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
       "  addAll(values)\n"
@@ -857,7 +860,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
-      "operator fun com.google.protobuf.kotlin.DslList"
+      "public operator fun com.google.protobuf.kotlin.DslList"
       "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
       "set(index: kotlin.Int, value: $kt_type$) {\n"
       "  $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
@@ -868,7 +871,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "clear() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/java_message_lite.cc b/src/google/protobuf/compiler/java/java_message_lite.cc
index 8f93499..c2c2788 100644
--- a/src/google/protobuf/compiler/java/java_message_lite.cc
+++ b/src/google/protobuf/compiler/java/java_message_lite.cc
@@ -731,10 +731,10 @@
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
       "@com.google.protobuf.kotlin.ProtoDslMarker\n");
   printer->Print(
-      "class Dsl private constructor(\n"
+      "public class Dsl private constructor(\n"
       "  private val _builder: $message$.Builder\n"
       ") {\n"
-      "  companion object {\n"
+      "  public companion object {\n"
       "    @kotlin.jvm.JvmSynthetic\n"
       "    @kotlin.PublishedApi\n"
       "    internal fun _create(builder: $message$.Builder): Dsl = "
@@ -756,10 +756,10 @@
 
   for (auto oneof : oneofs_) {
     printer->Print(
-        "val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n"
+        "public val $oneof_name$Case: $message$.$oneof_capitalized_name$Case\n"
         "  @JvmName(\"get$oneof_capitalized_name$Case\")\n"
         "  get() = _builder.get$oneof_capitalized_name$Case()\n\n"
-        "fun clear$oneof_capitalized_name$() {\n"
+        "public fun clear$oneof_capitalized_name$() {\n"
         "  _builder.clear$oneof_capitalized_name$()\n"
         "}\n",
         "oneof_name", context_->GetOneofGeneratorInfo(oneof)->name,
@@ -780,7 +780,8 @@
     io::Printer* printer) const {
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> kotlin.Unit): "
+      "public inline fun $camelcase_name$(block: $message_kt$.Dsl.() -> "
+      "kotlin.Unit): "
       "$message$ =\n"
       "  $message_kt$.Dsl._create($message$.newBuilder()).apply { block() "
       "}._build()\n",
@@ -788,7 +789,7 @@
       "message_kt", name_resolver_->GetKotlinExtensionsClassName(descriptor_),
       "message", name_resolver_->GetClassName(descriptor_, true));
 
-  printer->Print("object $name$Kt {\n", "name", descriptor_->name());
+  printer->Print("public object $name$Kt {\n", "name", descriptor_->name());
   printer->Indent();
   GenerateKotlinDsl(printer);
   for (int i = 0; i < descriptor_->nested_type_count(); i++) {
@@ -803,7 +804,8 @@
 void ImmutableMessageLiteGenerator::GenerateTopLevelKotlinMembers(
     io::Printer* printer) const {
   printer->Print(
-      "inline fun $message$.copy(block: $message_kt$.Dsl.() -> kotlin.Unit): "
+      "public inline fun $message$.copy(block: $message_kt$.Dsl.() -> "
+      "kotlin.Unit): "
       "$message$ =\n"
       "  $message_kt$.Dsl._create(this.toBuilder()).apply { block() "
       "}._build()\n",
@@ -824,7 +826,7 @@
   printer->Print(
       "@Suppress(\"UNCHECKED_CAST\")\n"
       "@kotlin.jvm.JvmSynthetic\n"
-      "operator fun <T> get(extension: "
+      "public operator fun <T> get(extension: "
       "com.google.protobuf.ExtensionLite<$message$, T>): T {\n"
       "  return if (extension.isRepeated) {\n"
       "    get(extension as com.google.protobuf.ExtensionLite<$message$, "
@@ -840,7 +842,7 @@
       "@kotlin.OptIn"
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
       "@kotlin.jvm.JvmName(\"-getRepeatedExtension\")\n"
-      "operator fun <E> get(\n"
+      "public operator fun <E> get(\n"
       "  extension: com.google.protobuf.ExtensionLite<$message$, List<E>>\n"
       "): com.google.protobuf.kotlin.ExtensionList<E, $message$> {\n"
       "  return com.google.protobuf.kotlin.ExtensionList(extension, "
@@ -850,7 +852,7 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "operator fun contains(extension: "
+      "public operator fun contains(extension: "
       "com.google.protobuf.ExtensionLite<$message$, *>): "
       "Boolean {\n"
       "  return _builder.hasExtension(extension)\n"
@@ -859,7 +861,8 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "fun clear(extension: com.google.protobuf.ExtensionLite<$message$, *>) "
+      "public fun clear(extension: "
+      "com.google.protobuf.ExtensionLite<$message$, *>) "
       "{\n"
       "  _builder.clearExtension(extension)\n"
       "}\n\n",
@@ -877,7 +880,8 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline operator fun <T : Comparable<T>> set(\n"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun <T : Comparable<T>> set(\n"
       "  extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
       "  value: T\n"
       ") {\n"
@@ -887,7 +891,8 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline operator fun set(\n"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun set(\n"
       "  extension: com.google.protobuf.ExtensionLite<$message$, "
       "com.google.protobuf.ByteString>,\n"
       "  value: com.google.protobuf.ByteString\n"
@@ -898,7 +903,8 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline operator fun <T : com.google.protobuf.MessageLite> set(\n"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun <T : com.google.protobuf.MessageLite> set(\n"
       "  extension: com.google.protobuf.ExtensionLite<$message$, T>,\n"
       "  value: T\n"
       ") {\n"
@@ -908,7 +914,7 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+      "public fun<E> com.google.protobuf.kotlin.ExtensionList<E, "
       "$message$>.add(value: E) {\n"
       "  _builder.addExtension(this.extension, value)\n"
       "}\n\n",
@@ -916,7 +922,9 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun <E> "
+      "com.google.protobuf.kotlin.ExtensionList<E, "
       "$message$>.plusAssign"
       "(value: E) {\n"
       "  add(value)\n"
@@ -925,7 +933,7 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+      "public fun<E> com.google.protobuf.kotlin.ExtensionList<E, "
       "$message$>.addAll(values: Iterable<E>) {\n"
       "  for (value in values) {\n"
       "    add(value)\n"
@@ -935,7 +943,9 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun <E> "
+      "com.google.protobuf.kotlin.ExtensionList<E, "
       "$message$>.plusAssign(values: "
       "Iterable<E>) {\n"
       "  addAll(values)\n"
@@ -944,7 +954,7 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
+      "public operator fun <E> com.google.protobuf.kotlin.ExtensionList<E, "
       "$message$>.set(index: Int, value: "
       "E) {\n"
       "  _builder.setExtension(this.extension, index, value)\n"
@@ -953,7 +963,8 @@
 
   printer->Print(
       "@kotlin.jvm.JvmSynthetic\n"
-      "inline fun com.google.protobuf.kotlin.ExtensionList<*, "
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline fun com.google.protobuf.kotlin.ExtensionList<*, "
       "$message$>.clear() {\n"
       "  clear(extension)\n"
       "}\n\n",
diff --git a/src/google/protobuf/compiler/java/java_message_lite.h b/src/google/protobuf/compiler/java/java_message_lite.h
index 0af0cb8..adb0df7 100644
--- a/src/google/protobuf/compiler/java/java_message_lite.h
+++ b/src/google/protobuf/compiler/java/java_message_lite.h
@@ -50,12 +50,12 @@
   ImmutableMessageLiteGenerator(const Descriptor* descriptor, Context* context);
   virtual ~ImmutableMessageLiteGenerator();
 
-  virtual void Generate(io::Printer* printer) override;
-  virtual void GenerateInterface(io::Printer* printer) override;
-  virtual void GenerateExtensionRegistrationCode(io::Printer* printer) override;
-  virtual void GenerateStaticVariables(io::Printer* printer,
-                                       int* bytecode_estimate) override;
-  virtual int GenerateStaticVariableInitializers(io::Printer* printer) override;
+  void Generate(io::Printer* printer) override;
+  void GenerateInterface(io::Printer* printer) override;
+  void GenerateExtensionRegistrationCode(io::Printer* printer) override;
+  void GenerateStaticVariables(io::Printer* printer,
+                               int* bytecode_estimate) override;
+  int GenerateStaticVariableInitializers(io::Printer* printer) override;
   void GenerateKotlinDsl(io::Printer* printer) const override;
   void GenerateKotlinMembers(io::Printer* printer) const override;
   void GenerateTopLevelKotlinMembers(io::Printer* printer) const override;
diff --git a/src/google/protobuf/compiler/java/java_primitive_field.cc b/src/google/protobuf/compiler/java/java_primitive_field.cc
index dfd7188..f67f6d3 100644
--- a/src/google/protobuf/compiler/java/java_primitive_field.cc
+++ b/src/google/protobuf/compiler/java/java_primitive_field.cc
@@ -159,12 +159,25 @@
     (*variables)["set_has_field_bit_builder"] = "";
     (*variables)["clear_has_field_bit_builder"] = "";
 
-    if (descriptor->type() == FieldDescriptor::TYPE_BYTES) {
-      (*variables)["is_field_present_message"] =
-          "!" + (*variables)["name"] + "_.isEmpty()";
-    } else {
-      (*variables)["is_field_present_message"] =
-          (*variables)["name"] + "_ != " + (*variables)["default"];
+    switch (descriptor->type()) {
+      case FieldDescriptor::TYPE_BYTES:
+        (*variables)["is_field_present_message"] =
+            "!" + (*variables)["name"] + "_.isEmpty()";
+        break;
+      case FieldDescriptor::TYPE_FLOAT:
+        (*variables)["is_field_present_message"] =
+            "java.lang.Float.floatToRawIntBits(" + (*variables)["name"] +
+            "_) != 0";
+        break;
+      case FieldDescriptor::TYPE_DOUBLE:
+        (*variables)["is_field_present_message"] =
+            "java.lang.Double.doubleToRawLongBits(" + (*variables)["name"] +
+            "_) != 0";
+        break;
+      default:
+        (*variables)["is_field_present_message"] =
+            (*variables)["name"] + "_ != " + (*variables)["default"];
+        break;
     }
   }
 
@@ -307,7 +320,7 @@
     io::Printer* printer) const {
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$var $kt_name$: $kt_type$\n"
+                 "$kt_deprecation$public var $kt_name$: $kt_type$\n"
                  "  @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
                  "  get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
                  "  @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
@@ -318,16 +331,17 @@
   WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
                                /* builder */ false);
   printer->Print(variables_,
-                 "fun ${$clear$kt_capitalized_name$$}$() {\n"
+                 "public fun ${$clear$kt_capitalized_name$$}$() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
                  "}\n");
 
   if (HasHazzer(descriptor_)) {
     WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
-    printer->Print(variables_,
-                   "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
-                   "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
-                   "}\n");
+    printer->Print(
+        variables_,
+        "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+        "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+        "}\n");
   }
 }
 
@@ -617,8 +631,8 @@
 void ImmutablePrimitiveOneofFieldGenerator::GenerateParsingCode(
     io::Printer* printer) const {
   printer->Print(variables_,
-                 "$set_oneof_case_message$;\n"
-                 "$oneof_name$_ = input.read$capitalized_type$();\n");
+                 "$oneof_name$_ = input.read$capitalized_type$();\n"
+                 "$set_oneof_case_message$;\n");
 }
 
 void ImmutablePrimitiveOneofFieldGenerator::GenerateSerializationCode(
@@ -835,12 +849,12 @@
       " */\n"
       "@kotlin.OptIn"
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
-      "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+      "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
       " : com.google.protobuf.kotlin.DslProxy()\n");
 
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$ val $kt_name$: "
+                 "$kt_deprecation$ public val $kt_name$: "
                  "com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
                  "  @kotlin.jvm.JvmSynthetic\n"
@@ -853,7 +867,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "add(value: $kt_type$) {\n"
                  "  $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
@@ -864,7 +878,8 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
-                 "inline operator fun com.google.protobuf.kotlin.DslList"
+                 "@Suppress(\"NOTHING_TO_INLINE\")\n"
+                 "public inline operator fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "plusAssign(value: $kt_type$) {\n"
                  "  add(value)\n"
@@ -875,7 +890,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
                  "  $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
@@ -887,7 +902,8 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
-      "inline operator fun com.google.protobuf.kotlin.DslList"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun com.google.protobuf.kotlin.DslList"
       "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
       "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
       "  addAll(values)\n"
@@ -899,7 +915,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
-      "operator fun com.google.protobuf.kotlin.DslList"
+      "public operator fun com.google.protobuf.kotlin.DslList"
       "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
       "set(index: kotlin.Int, value: $kt_type$) {\n"
       "  $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
@@ -910,7 +926,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "clear() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/java_primitive_field_lite.cc b/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
index cc589f3..5441d01 100644
--- a/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_primitive_field_lite.cc
@@ -164,12 +164,25 @@
     (*variables)["set_has_field_bit_message"] = "";
     (*variables)["clear_has_field_bit_message"] = "";
 
-    if (descriptor->type() == FieldDescriptor::TYPE_BYTES) {
-      (*variables)["is_field_present_message"] =
-          "!" + (*variables)["name"] + "_.isEmpty()";
-    } else {
-      (*variables)["is_field_present_message"] =
-          (*variables)["name"] + "_ != " + (*variables)["default"];
+    switch (descriptor->type()) {
+      case FieldDescriptor::TYPE_BYTES:
+        (*variables)["is_field_present_message"] =
+            "!" + (*variables)["name"] + "_.isEmpty()";
+        break;
+      case FieldDescriptor::TYPE_FLOAT:
+        (*variables)["is_field_present_message"] =
+            "java.lang.Float.floatToRawIntBits(" + (*variables)["name"] +
+            "_) != 0";
+        break;
+      case FieldDescriptor::TYPE_DOUBLE:
+        (*variables)["is_field_present_message"] =
+            "java.lang.Double.doubleToRawLongBits(" + (*variables)["name"] +
+            "_) != 0";
+        break;
+      default:
+        (*variables)["is_field_present_message"] =
+            (*variables)["name"] + "_ != " + (*variables)["default"];
+        break;
     }
   }
 
@@ -313,7 +326,7 @@
     io::Printer* printer) const {
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$var $kt_name$: $kt_type$\n"
+                 "$kt_deprecation$public var $kt_name$: $kt_type$\n"
                  "  @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
                  "  get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
                  "  @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
@@ -324,16 +337,17 @@
   WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
                                /* builder */ false);
   printer->Print(variables_,
-                 "fun ${$clear$kt_capitalized_name$$}$() {\n"
+                 "public fun ${$clear$kt_capitalized_name$$}$() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
                  "}\n");
 
   if (HasHazzer(descriptor_)) {
     WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
-    printer->Print(variables_,
-                   "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
-                   "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
-                   "}\n");
+    printer->Print(
+        variables_,
+        "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+        "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+        "}\n");
   }
 }
 
@@ -658,12 +672,12 @@
       " */\n"
       "@kotlin.OptIn"
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
-      "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+      "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
       " : com.google.protobuf.kotlin.DslProxy()\n");
 
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$ val $kt_name$: "
+                 "$kt_deprecation$ public val $kt_name$: "
                  "com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>\n"
                  "  @kotlin.jvm.JvmSynthetic\n"
@@ -676,7 +690,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "add(value: $kt_type$) {\n"
                  "  $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
@@ -687,7 +701,8 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
-                 "inline operator fun com.google.protobuf.kotlin.DslList"
+                 "@Suppress(\"NOTHING_TO_INLINE\")\n"
+                 "public inline operator fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "plusAssign(value: $kt_type$) {\n"
                  "  add(value)\n"
@@ -698,7 +713,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "addAll(values: kotlin.collections.Iterable<$kt_type$>) {\n"
                  "  $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
@@ -710,7 +725,8 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
-      "inline operator fun com.google.protobuf.kotlin.DslList"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun com.google.protobuf.kotlin.DslList"
       "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
       "plusAssign(values: kotlin.collections.Iterable<$kt_type$>) {\n"
       "  addAll(values)\n"
@@ -722,7 +738,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
-      "operator fun com.google.protobuf.kotlin.DslList"
+      "public operator fun com.google.protobuf.kotlin.DslList"
       "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
       "set(index: kotlin.Int, value: $kt_type$) {\n"
       "  $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
@@ -733,7 +749,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<$kt_type$, ${$$kt_capitalized_name$Proxy$}$>."
                  "clear() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/java_service.h b/src/google/protobuf/compiler/java/java_service.h
index fa9c92c..81db519 100644
--- a/src/google/protobuf/compiler/java/java_service.h
+++ b/src/google/protobuf/compiler/java/java_service.h
@@ -80,7 +80,7 @@
                             Context* context);
   virtual ~ImmutableServiceGenerator();
 
-  virtual void Generate(io::Printer* printer) override;
+  void Generate(io::Printer* printer) override;
 
  private:
   // Generate the getDescriptorForType() method.
diff --git a/src/google/protobuf/compiler/java/java_string_field.cc b/src/google/protobuf/compiler/java/java_string_field.cc
index 9ebb771..1a0959e 100644
--- a/src/google/protobuf/compiler/java/java_string_field.cc
+++ b/src/google/protobuf/compiler/java/java_string_field.cc
@@ -81,7 +81,8 @@
       "    throw new NullPointerException();\n"
       "  }\n";
   (*variables)["isStringEmpty"] = "com.google.protobuf.GeneratedMessage" +
-                                GeneratedCodeVersionSuffix() + ".isStringEmpty";
+                                  GeneratedCodeVersionSuffix() +
+                                  ".isStringEmpty";
   (*variables)["writeString"] = "com.google.protobuf.GeneratedMessage" +
                                 GeneratedCodeVersionSuffix() + ".writeString";
   (*variables)["computeStringSize"] = "com.google.protobuf.GeneratedMessage" +
@@ -119,7 +120,7 @@
     (*variables)["clear_has_field_bit_builder"] = "";
 
     (*variables)["is_field_present_message"] =
-       "!" + (*variables)["isStringEmpty"] + "(" + (*variables)["name"] + "_)";
+        "!" + (*variables)["isStringEmpty"] + "(" + (*variables)["name"] + "_)";
   }
 
   // For repeated builders, one bit is used for whether the array is immutable.
@@ -378,7 +379,7 @@
     io::Printer* printer) const {
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$var $kt_name$: kotlin.String\n"
+                 "$kt_deprecation$public var $kt_name$: kotlin.String\n"
                  "  @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
                  "  get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
                  "  @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
@@ -389,16 +390,17 @@
   WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
                                /* builder */ false);
   printer->Print(variables_,
-                 "fun ${$clear$kt_capitalized_name$$}$() {\n"
+                 "public fun ${$clear$kt_capitalized_name$$}$() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
                  "}\n");
 
   if (HasHazzer(descriptor_)) {
     WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
-    printer->Print(variables_,
-                   "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
-                   "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
-                   "}\n");
+    printer->Print(
+        variables_,
+        "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+        "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+        "}\n");
   }
 }
 
@@ -961,21 +963,19 @@
       " */\n"
       "@kotlin.OptIn"
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
-      "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+      "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
       " : com.google.protobuf.kotlin.DslProxy()\n");
 
   // property for List<String>
   WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER);
-  printer->Print(
-      variables_,
-      "val $kt_name$: "
-      "com.google.protobuf.kotlin.DslList"
-      "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>\n"
-      "  @kotlin.OptIn"
-      "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
-      "  get() = com.google.protobuf.kotlin.DslList(\n"
-      "    $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n"
-      "  )\n");
+  printer->Print(variables_,
+                 "$kt_deprecation$public val $kt_name$: "
+                 "com.google.protobuf.kotlin.DslList"
+                 "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>\n"
+                 "  @kotlin.jvm.JvmSynthetic\n"
+                 "  get() = com.google.protobuf.kotlin.DslList(\n"
+                 "    $kt_dsl_builder$.${$get$capitalized_name$List$}$()\n"
+                 "  )\n");
 
   // List<String>.add(String)
   WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
@@ -983,7 +983,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
                  "add(value: kotlin.String) {\n"
                  "  $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
@@ -992,13 +992,14 @@
   // List<String> += String
   WriteFieldAccessorDocComment(printer, descriptor_, LIST_ADDER,
                                /* builder */ false);
-  printer->Print(variables_,
+   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
-                 "operator fun com.google.protobuf.kotlin.DslList"
+                 "@Suppress(\"NOTHING_TO_INLINE\")\n"
+                 "public inline operator fun com.google.protobuf.kotlin.DslList"
                  "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
                  "plusAssign(value: kotlin.String) {\n"
-                 "  $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
+                 "  add(value)\n"
                  "}\n");
 
   // List<String>.addAll(Iterable<String>)
@@ -1008,7 +1009,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
-      "fun com.google.protobuf.kotlin.DslList"
+      "public fun com.google.protobuf.kotlin.DslList"
       "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
       "addAll(values: kotlin.collections.Iterable<kotlin.String>) {\n"
       "  $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
@@ -1021,10 +1022,11 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
-      "operator fun com.google.protobuf.kotlin.DslList"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun com.google.protobuf.kotlin.DslList"
       "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
       "plusAssign(values: kotlin.collections.Iterable<kotlin.String>) {\n"
-      "  $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
+      "  addAll(values)\n"
       "}\n");
 
   // List<String>[Int] = String
@@ -1034,7 +1036,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
-      "operator fun com.google.protobuf.kotlin.DslList"
+      "public operator fun com.google.protobuf.kotlin.DslList"
       "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
       "set(index: kotlin.Int, value: kotlin.String) {\n"
       "  $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
@@ -1045,7 +1047,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
                  "clear() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/java/java_string_field.h b/src/google/protobuf/compiler/java/java_string_field.h
index 369dcda..efab5fe 100644
--- a/src/google/protobuf/compiler/java/java_string_field.h
+++ b/src/google/protobuf/compiler/java/java_string_field.h
@@ -78,7 +78,8 @@
   void GenerateParsingDoneCode(io::Printer* printer) const override;
   void GenerateSerializationCode(io::Printer* printer) const override;
   void GenerateSerializedSizeCode(io::Printer* printer) const override;
-  void GenerateFieldBuilderInitializationCode(io::Printer* printer) const override;
+  void GenerateFieldBuilderInitializationCode(
+      io::Printer* printer) const override;
   void GenerateEqualsCode(io::Printer* printer) const override;
   void GenerateHashCode(io::Printer* printer) const override;
   void GenerateKotlinDslMembers(io::Printer* printer) const override;
diff --git a/src/google/protobuf/compiler/java/java_string_field_lite.cc b/src/google/protobuf/compiler/java/java_string_field_lite.cc
index f22fc4b..1833903 100644
--- a/src/google/protobuf/compiler/java/java_string_field_lite.cc
+++ b/src/google/protobuf/compiler/java/java_string_field_lite.cc
@@ -313,7 +313,7 @@
     io::Printer* printer) const {
   WriteFieldDocComment(printer, descriptor_);
   printer->Print(variables_,
-                 "$kt_deprecation$var $kt_name$: kotlin.String\n"
+                 "$kt_deprecation$public var $kt_name$: kotlin.String\n"
                  "  @JvmName(\"${$get$kt_capitalized_name$$}$\")\n"
                  "  get() = $kt_dsl_builder$.${$get$capitalized_name$$}$()\n"
                  "  @JvmName(\"${$set$kt_capitalized_name$$}$\")\n"
@@ -324,16 +324,17 @@
   WriteFieldAccessorDocComment(printer, descriptor_, CLEARER,
                                /* builder */ false);
   printer->Print(variables_,
-                 "fun ${$clear$kt_capitalized_name$$}$() {\n"
+                 "public fun ${$clear$kt_capitalized_name$$}$() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
                  "}\n");
 
   if (HasHazzer(descriptor_)) {
     WriteFieldAccessorDocComment(printer, descriptor_, HAZZER);
-    printer->Print(variables_,
-                   "fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
-                   "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
-                   "}\n");
+    printer->Print(
+        variables_,
+        "public fun ${$has$kt_capitalized_name$$}$(): kotlin.Boolean {\n"
+        "  return $kt_dsl_builder$.${$has$capitalized_name$$}$()\n"
+        "}\n");
   }
 }
 
@@ -747,14 +748,14 @@
       " */\n"
       "@kotlin.OptIn"
       "(com.google.protobuf.kotlin.OnlyForUseByGeneratedProtoCode::class)\n"
-      "class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
+      "public class ${$$kt_capitalized_name$Proxy$}$ private constructor()"
       " : com.google.protobuf.kotlin.DslProxy()\n");
 
   // property for List<String>
   WriteFieldAccessorDocComment(printer, descriptor_, LIST_GETTER);
   printer->Print(
       variables_,
-      "val $kt_name$: "
+      "$kt_deprecation$public val $kt_name$: "
       "com.google.protobuf.kotlin.DslList"
       "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>\n"
       "  @kotlin.OptIn"
@@ -769,7 +770,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"add$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
                  "add(value: kotlin.String) {\n"
                  "  $kt_dsl_builder$.${$add$capitalized_name$$}$(value)\n"
@@ -781,7 +782,8 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"plusAssign$kt_capitalized_name$\")\n"
-                 "inline operator fun com.google.protobuf.kotlin.DslList"
+                 "@Suppress(\"NOTHING_TO_INLINE\")\n"
+                 "public inline operator fun com.google.protobuf.kotlin.DslList"
                  "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
                  "plusAssign(value: kotlin.String) {\n"
                  "  add(value)\n"
@@ -794,7 +796,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"addAll$kt_capitalized_name$\")\n"
-      "fun com.google.protobuf.kotlin.DslList"
+      "public fun com.google.protobuf.kotlin.DslList"
       "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
       "addAll(values: kotlin.collections.Iterable<kotlin.String>) {\n"
       "  $kt_dsl_builder$.${$addAll$capitalized_name$$}$(values)\n"
@@ -807,7 +809,8 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"plusAssignAll$kt_capitalized_name$\")\n"
-      "inline operator fun com.google.protobuf.kotlin.DslList"
+      "@Suppress(\"NOTHING_TO_INLINE\")\n"
+      "public inline operator fun com.google.protobuf.kotlin.DslList"
       "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
       "plusAssign(values: kotlin.collections.Iterable<kotlin.String>) {\n"
       "  addAll(values)\n"
@@ -820,7 +823,7 @@
       variables_,
       "@kotlin.jvm.JvmSynthetic\n"
       "@kotlin.jvm.JvmName(\"set$kt_capitalized_name$\")\n"
-      "operator fun com.google.protobuf.kotlin.DslList"
+      "public operator fun com.google.protobuf.kotlin.DslList"
       "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
       "set(index: kotlin.Int, value: kotlin.String) {\n"
       "  $kt_dsl_builder$.${$set$capitalized_name$$}$(index, value)\n"
@@ -831,7 +834,7 @@
   printer->Print(variables_,
                  "@kotlin.jvm.JvmSynthetic\n"
                  "@kotlin.jvm.JvmName(\"clear$kt_capitalized_name$\")\n"
-                 "fun com.google.protobuf.kotlin.DslList"
+                 "public fun com.google.protobuf.kotlin.DslList"
                  "<kotlin.String, ${$$kt_capitalized_name$Proxy$}$>."
                  "clear() {\n"
                  "  $kt_dsl_builder$.${$clear$capitalized_name$$}$()\n"
diff --git a/src/google/protobuf/compiler/js/js_generator.cc b/src/google/protobuf/compiler/js/js_generator.cc
index cfd0e03..d2dac2f 100644
--- a/src/google/protobuf/compiler/js/js_generator.cc
+++ b/src/google/protobuf/compiler/js/js_generator.cc
@@ -3625,7 +3625,23 @@
     if (options.import_style == GeneratorOptions::kImportCommonJsStrict) {
       printer->Print("var proto = {};\n\n");
     } else {
-      printer->Print("var global = Function('return this')();\n\n");
+      // To get the global object we call a function with .call(null), this will set "this" inside the
+      // function to the global object.
+      // This does not work if we are running in strict mode ("use strict"),
+      // so we fallback to the following things (in order from first to last):
+      // - window: defined in browsers
+      // - global: defined in most server side environments like NodeJS
+      // - self: defined inside Web Workers (WorkerGlobalScope)
+      // - Function('return this')(): this will work on most platforms, but it may be blocked by things like CSP.
+      //   Function('') is almost the same as eval('')
+      printer->Print(
+          "var global = (function() {\n"
+          "  if (this) { return this; }\n"
+          "  if (typeof window !== 'undefined') { return window; }\n"
+          "  if (typeof global !== 'undefined') { return global; }\n"
+          "  if (typeof self !== 'undefined') { return self; }\n"
+          "  return Function('return this')();\n"
+          "}.call(null));\n\n");
     }
 
     for (int i = 0; i < file->dependency_count(); i++) {
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_enum.cc b/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
index 12c475f..ea8f394 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_enum.cc
@@ -127,7 +127,6 @@
     if (alias_values_to_skip_.find(all_values_[i]) != alias_values_to_skip_.end()) {
       continue;
     }
-    SourceLocation location;
     if (all_values_[i]->GetSourceLocation(&location)) {
       std::string comments = BuildCommentsString(location, true).c_str();
       if (comments.length() > 0) {
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_file.cc b/src/google/protobuf/compiler/objectivec/objectivec_file.cc
index be2be2c..d9f43a5 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_file.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_file.cc
@@ -52,7 +52,7 @@
 namespace {
 
 // This is also found in GPBBootstrap.h, and needs to be kept in sync.
-const int32 GOOGLE_PROTOBUF_OBJC_VERSION = 30004;
+const int32_t GOOGLE_PROTOBUF_OBJC_VERSION = 30004;
 
 const char* kHeaderExtension = ".pbobjc.h";
 
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_generator.cc b/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
index d5a2b6b..a03b860 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_generator.cc
@@ -44,6 +44,28 @@
 namespace compiler {
 namespace objectivec {
 
+namespace {
+
+// Convert a string with "yes"/"no" (case insensitive) to a boolean, returning
+// true/false for if the input string was a valid value. If the input string is
+// invalid, `result` is unchanged.
+bool StringToBool(const std::string& value, bool* result) {
+  std::string upper_value(value);
+  UpperString(&upper_value);
+  if (upper_value == "NO") {
+    *result = false;
+    return true;
+  }
+  if (upper_value == "YES") {
+    *result = true;
+    return true;
+  }
+
+  return false;
+}
+
+}  // namespace
+
 ObjectiveCGenerator::ObjectiveCGenerator() {}
 
 ObjectiveCGenerator::~ObjectiveCGenerator() {}
@@ -101,6 +123,31 @@
         generation_options.expected_prefixes_suppressions.push_back(
             std::string(split_piece));
       }
+    } else if (options[i].first == "prefixes_must_be_registered") {
+      // If objc prefix file option value must be registered to be used. This
+      // option has no meaning if an "expected_prefixes_path" isn't set. The
+      // available options are:
+      //   "no": They don't have to be registered.
+      //   "yes": They must be registered and an error will be raised if a files
+      //     tried to use a prefix that isn't registered.
+      // Default is "no".
+      if (!StringToBool(options[i].second,
+                        &generation_options.prefixes_must_be_registered)) {
+        *error = "error: Unknown value for prefixes_must_be_registered: " + options[i].second;
+        return false;
+      }
+    } else if (options[i].first == "require_prefixes") {
+      // If every file must have an objc prefix file option to be used. The
+      // available options are:
+      //   "no": Files can be generated without the prefix option.
+      //   "yes": Files must have the objc prefix option, and an error will be
+      //     raised if a files doesn't have one.
+      // Default is "no".
+      if (!StringToBool(options[i].second,
+                        &generation_options.require_prefixes)) {
+        *error = "error: Unknown value for require_prefixes: " + options[i].second;
+        return false;
+      }
     } else if (options[i].first == "generate_for_named_framework") {
       // The name of the framework that protos are being generated for. This
       // will cause the #import statements to be framework based using this
@@ -146,12 +193,9 @@
       // is just what to do if that isn't set. The available options are:
       //   "no": Not prefixed (the existing mode).
       //   "yes": Make a prefix out of the proto package.
-      std::string upper_value(options[i].second);
-      UpperString(&upper_value);
-      if (upper_value == "NO") {
-        SetUseProtoPackageAsDefaultPrefix(false);
-      } else if (upper_value == "YES") {
-        SetUseProtoPackageAsDefaultPrefix(true);
+      bool value = false;
+      if (StringToBool(options[i].second, &value)) {
+        SetUseProtoPackageAsDefaultPrefix(value);
       } else {
         *error = "error: Unknown use_package_as_prefix: " + options[i].second;
         return false;
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
index 78491d2..5f4b7f6 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
@@ -178,6 +178,8 @@
     expected_prefixes_suppressions =
         Split(suppressions, ";", true);
   }
+  prefixes_must_be_registered = false;
+  require_prefixes = false;
 }
 
 namespace {
@@ -992,7 +994,7 @@
 
         // Must convert to a standard byte order for packing length into
         // a cstring.
-        uint32 length = ghtonl(default_string.length());
+        uint32_t length = ghtonl(default_string.length());
         std::string bytes((const char*)&length, sizeof(length));
         bytes.append(default_string);
         return "(NSData*)\"" + EscapeTrigraphs(CEscape(bytes)) + "\"";
@@ -1227,6 +1229,7 @@
 bool ValidateObjCClassPrefix(
     const FileDescriptor* file, const std::string& expected_prefixes_path,
     const std::map<std::string, std::string>& expected_package_prefixes,
+    bool prefixes_must_be_registered, bool require_prefixes,
     std::string* out_error) {
   // Reminder: An explicit prefix option of "" is valid in case the default
   // prefixing is set to use the proto package and a file needs to be generated
@@ -1265,6 +1268,12 @@
 
   // If there was no prefix option, we're done at this point.
   if (!has_prefix) {
+    if (require_prefixes) {
+      *out_error =
+        "error: '" + file->name() + "' does not have a required 'option" +
+        " objc_class_prefix'.";
+      return false;
+    }
     return true;
   }
 
@@ -1344,9 +1353,18 @@
     std::cerr.flush();
   }
 
-  // Check: Warning - If the given package/prefix pair wasn't expected, issue a
-  // warning suggesting it gets added to the file.
+  // Check: Error/Warning - If the given package/prefix pair wasn't expected,
+  // issue a error/warning to added to the file.
   if (have_expected_prefix_file) {
+    if (prefixes_must_be_registered) {
+      *out_error =
+        "error: '" + file->name() + "' has 'option objc_class_prefix = \"" +
+        prefix + "\";', but it is not registered; add it to the expected " +
+        "prefixes file (" + expected_prefixes_path + ") for the package '" +
+        package + "'.";
+      return false;
+    }
+
     std::cerr
          << "protoc:0: warning: Found unexpected 'option objc_class_prefix = \""
          << prefix << "\";' in '" << file->name() << "';"
@@ -1391,6 +1409,8 @@
         ValidateObjCClassPrefix(files[i],
                                 generation_options.expected_prefixes_path,
                                 expected_package_prefixes,
+                                generation_options.prefixes_must_be_registered,
+                                generation_options.require_prefixes,
                                 out_error);
     if (!is_valid) {
       return false;
@@ -1403,7 +1423,7 @@
 
 TextFormatDecodeData::~TextFormatDecodeData() { }
 
-void TextFormatDecodeData::AddString(int32 key,
+void TextFormatDecodeData::AddString(int32_t key,
                                      const std::string& input_for_decode,
                                      const std::string& desired_output) {
   for (std::vector<DataEntry>::const_iterator i = entries_.begin();
@@ -1459,12 +1479,12 @@
   }
 
  private:
-  static constexpr uint8 kAddUnderscore = 0x80;
+  static constexpr uint8_t kAddUnderscore = 0x80;
 
-  static constexpr uint8 kOpAsIs = 0x00;
-  static constexpr uint8 kOpFirstUpper = 0x40;
-  static constexpr uint8 kOpFirstLower = 0x20;
-  static constexpr uint8 kOpAllUpper = 0x60;
+  static constexpr uint8_t kOpAsIs = 0x00;
+  static constexpr uint8_t kOpFirstUpper = 0x40;
+  static constexpr uint8_t kOpFirstLower = 0x20;
+  static constexpr uint8_t kOpAllUpper = 0x60;
 
   static constexpr int kMaxSegmentLen = 0x1f;
 
@@ -1474,7 +1494,7 @@
   }
 
   void Push() {
-    uint8 op = (op_ | segment_len_);
+    uint8_t op = (op_ | segment_len_);
     if (need_underscore_) op |= kAddUnderscore;
     if (op != 0) {
       decode_data_ += (char)op;
@@ -1506,7 +1526,7 @@
 
   bool need_underscore_;
   bool is_all_upper_;
-  uint8 op_;
+  uint8_t op_;
   int segment_len_;
 
   std::string decode_data_;
@@ -1618,71 +1638,71 @@
   Parser(LineConsumer* line_consumer)
       : line_consumer_(line_consumer), line_(0) {}
 
-  // Parses a check of input, returning success/failure.
-  bool ParseChunk(StringPiece chunk);
+  // Feeds in some input, parse what it can, returning success/failure. Calling
+  // again after an error is undefined.
+  bool ParseChunk(StringPiece chunk, std::string* out_error);
 
   // Should be called to finish parsing (after all input has been provided via
-  // ParseChunk()).  Returns success/failure.
-  bool Finish();
+  // successful calls to ParseChunk(), calling after a ParseChunk() failure is
+  // undefined). Returns success/failure.
+  bool Finish(std::string* out_error);
 
   int last_line() const { return line_; }
-  std::string error_str() const { return error_str_; }
 
  private:
-  bool ParseLoop();
-
   LineConsumer* line_consumer_;
   int line_;
-  std::string error_str_;
-  StringPiece p_;
   std::string leftover_;
 };
 
-bool Parser::ParseChunk(StringPiece chunk) {
+bool Parser::ParseChunk(StringPiece chunk, std::string* out_error) {
+  StringPiece full_chunk;
   if (!leftover_.empty()) {
     leftover_ += std::string(chunk);
-    p_ = StringPiece(leftover_);
+    full_chunk = StringPiece(leftover_);
   } else {
-    p_ = chunk;
+    full_chunk = chunk;
   }
-  bool result = ParseLoop();
-  if (p_.empty()) {
-    leftover_.clear();
-  } else {
-    leftover_ = std::string(p_);
-  }
-  return result;
-}
 
-bool Parser::Finish() {
-  if (leftover_.empty()) {
-    return true;
-  }
-  // Force a newline onto the end to finish parsing.
-  leftover_ += "\n";
-  p_ = StringPiece(leftover_);
-  if (!ParseLoop()) {
-    return false;
-  }
-  return p_.empty();  // Everything used?
-}
-
-bool Parser::ParseLoop() {
   StringPiece line;
-  while (ReadLine(&p_, &line)) {
+  while (ReadLine(&full_chunk, &line)) {
     ++line_;
     RemoveComment(&line);
     TrimWhitespace(&line);
-    if (line.empty()) {
-      continue;  // Blank line.
-    }
-    if (!line_consumer_->ConsumeLine(line, &error_str_)) {
+    if (!line.empty() && !line_consumer_->ConsumeLine(line, out_error)) {
+      if (out_error->empty()) {
+        *out_error = "ConsumeLine failed without setting an error.";
+      }
+      leftover_.clear();
       return false;
     }
   }
+
+  if (full_chunk.empty()) {
+    leftover_.clear();
+  } else {
+    leftover_ = std::string(full_chunk);
+  }
   return true;
 }
 
+bool Parser::Finish(std::string* out_error) {
+  // If there is still something to go, flush it with a newline.
+  if (!leftover_.empty() && !ParseChunk("\n", out_error)) {
+    return false;
+  }
+  // This really should never fail if ParseChunk succeeded, but check to be sure.
+  if (!leftover_.empty()) {
+    *out_error = "ParseSimple Internal error: finished with pending data.";
+    return false;
+  }
+  return true;
+}
+
+std::string FullErrorString(const std::string& name, int line_num, const std::string& msg) {
+  return std::string("error: ") + name + " Line " + StrCat(line_num) + ", " + msg;
+}
+
 }  // namespace
 
 LineConsumer::LineConsumer() {}
@@ -1703,22 +1723,33 @@
   io::FileInputStream file_stream(fd);
   file_stream.SetCloseOnDelete(true);
 
+  return ParseSimpleStream(file_stream, path, line_consumer, out_error);
+}
+
+bool ParseSimpleStream(io::ZeroCopyInputStream& input_stream,
+                       const std::string& stream_name,
+                       LineConsumer* line_consumer,
+                       std::string* out_error) {
+  std::string local_error;
   Parser parser(line_consumer);
   const void* buf;
   int buf_len;
-  while (file_stream.Next(&buf, &buf_len)) {
+  while (input_stream.Next(&buf, &buf_len)) {
     if (buf_len == 0) {
       continue;
     }
 
-    if (!parser.ParseChunk(StringPiece(static_cast<const char*>(buf), buf_len))) {
-      *out_error =
-          std::string("error: ") + path +
-          " Line " + StrCat(parser.last_line()) + ", " + parser.error_str();
+    if (!parser.ParseChunk(StringPiece(static_cast<const char*>(buf), buf_len),
+                           &local_error)) {
+      *out_error = FullErrorString(stream_name, parser.last_line(), local_error);
       return false;
     }
   }
-  return parser.Finish();
+  if (!parser.Finish(&local_error)) {
+    *out_error = FullErrorString(stream_name, parser.last_line(), local_error);
+    return false;
+  }
+  return true;
 }
 
 ImportWriter::ImportWriter(
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
index 02615e0..13a1052 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
+++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers.h
@@ -38,6 +38,7 @@
 
 #include <google/protobuf/descriptor.h>
 #include <google/protobuf/descriptor.pb.h>
+#include <google/protobuf/io/zero_copy_stream.h>
 
 #include <google/protobuf/port_def.inc>
 
@@ -67,6 +68,8 @@
   std::string generate_for_named_framework;
   std::string named_framework_to_proto_path_mappings_path;
   std::string runtime_import_prefix;
+  bool prefixes_must_be_registered;
+  bool require_prefixes;
 };
 
 // Escape C++ trigraphs by escaping question marks to "\?".
@@ -260,7 +263,7 @@
   TextFormatDecodeData(const TextFormatDecodeData&) = delete;
   TextFormatDecodeData& operator=(const TextFormatDecodeData&) = delete;
 
-  void AddString(int32 key, const std::string& input_for_decode,
+  void AddString(int32_t key, const std::string& input_for_decode,
                  const std::string& desired_output);
   size_t num_entries() const { return entries_.size(); }
   std::string Data() const;
@@ -269,7 +272,7 @@
                                          const std::string& desired_output);
 
  private:
-  typedef std::pair<int32, std::string> DataEntry;
+  typedef std::pair<int32_t, std::string> DataEntry;
   std::vector<DataEntry> entries_;
 };
 
@@ -285,6 +288,11 @@
                                    LineConsumer* line_consumer,
                                    std::string* out_error);
 
+bool PROTOC_EXPORT ParseSimpleStream(io::ZeroCopyInputStream& input_stream,
+                                     const std::string& stream_name,
+                                     LineConsumer* line_consumer,
+                                     std::string* out_error);
+
 // Helper class for parsing framework import mappings and generating
 // import statements.
 class PROTOC_EXPORT ImportWriter {
diff --git a/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc b/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
index 0aef94f..3c5eda2 100644
--- a/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
+++ b/src/google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc
@@ -29,6 +29,7 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #include <google/protobuf/compiler/objectivec/objectivec_helpers.h>
+#include <google/protobuf/io/zero_copy_stream_impl_lite.h>
 #include <google/protobuf/testing/googletest.h>
 #include <gtest/gtest.h>
 
@@ -242,6 +243,133 @@
 }
 #endif  // PROTOBUF_HAS_DEATH_TEST
 
+class TestLineCollector : public LineConsumer {
+ public:
+  TestLineCollector(std::vector<std::string>* inout_lines,
+                    const std::string* reject_line = nullptr,
+                    bool skip_msg = false)
+    : lines_(inout_lines), reject_(reject_line), skip_msg_(skip_msg) {}
+
+  bool ConsumeLine(const StringPiece& line, std::string* out_error) override {
+    if (reject_ && *reject_ == line) {
+      if (!skip_msg_) {
+        *out_error = std::string("Rejected '") + *reject_ + "'";
+      }
+      return false;
+    }
+    if (lines_) {
+      lines_->emplace_back(line);
+    }
+    return true;
+  }
+
+ private:
+  std::vector<std::string>* lines_;
+  const std::string* reject_;
+  bool skip_msg_;
+};
+
+const int kBlockSizes[] = {-1, 1, 2, 5, 64};
+const int kBlockSizeCount = GOOGLE_ARRAYSIZE(kBlockSizes);
+
+TEST(ObjCHelper, ParseSimple_BasicsSuccess) {
+  const std::vector<std::pair<std::string, std::vector<std::string>>> tests = {
+    {"", {}},
+    {"a", {"a"}},
+    {"a c", {"a c"}},
+    {" a c ", {"a c"}},
+    {"\ta c ", {"a c"}},
+    {"abc\n", {"abc"}},
+    {"abc\nd f", {"abc", "d f"}},
+    {"\n abc \n def \n\n", {"abc", "def"}},
+  };
+
+  for (const auto& test : tests) {
+    for (int i = 0; i < kBlockSizeCount; i++) {
+      io::ArrayInputStream input(test.first.data(), test.first.size(), kBlockSizes[i]);
+      std::string err_str;
+      std::vector<std::string> lines;
+      TestLineCollector collector(&lines);
+      EXPECT_TRUE(ParseSimpleStream(input, "dummy", &collector, &err_str));
+      EXPECT_EQ(lines, test.second);
+      EXPECT_TRUE(err_str.empty());
+    }
+  }
+}
+
+TEST(ObjCHelper, ParseSimple_DropsComments) {
+  const std::vector<std::pair<std::string, std::vector<std::string>>> tests = {
+    {"# nothing", {}},
+    {"#", {}},
+    {"##", {}},
+    {"\n# nothing\n", {}},
+    {"a # same line", {"a"}},
+    {"a # same line\n", {"a"}},
+    {"a\n# line\nc", {"a", "c"}},
+    {"# n o t # h i n g #", {}},
+    {"## n o # t h i n g #", {}},
+    {"a# n o t # h i n g #", {"a"}},
+    {"a\n## n o # t h i n g #", {"a"}},
+  };
+
+  for (const auto& test : tests) {
+    for (int i = 0; i < kBlockSizeCount; i++) {
+      io::ArrayInputStream input(test.first.data(), test.first.size(), kBlockSizes[i]);
+      std::string err_str;
+      std::vector<std::string> lines;
+      TestLineCollector collector(&lines);
+      EXPECT_TRUE(ParseSimpleStream(input, "dummy", &collector, &err_str));
+      EXPECT_EQ(lines, test.second);
+      EXPECT_TRUE(err_str.empty());
+    }
+  }
+}
+
+TEST(ObjCHelper, ParseSimple_RejectLines) {
+  const std::vector<std::tuple<std::string, std::string, int>> tests = {
+    std::make_tuple("a\nb\nc", "a", 1),
+    std::make_tuple("a\nb\nc", "b", 2),
+    std::make_tuple("a\nb\nc", "c", 3),
+    std::make_tuple("a\nb\nc\n", "c", 3),
+  };
+
+  for (const auto& test : tests) {
+    for (int i = 0; i < kBlockSizeCount; i++) {
+      io::ArrayInputStream input(std::get<0>(test).data(), std::get<0>(test).size(),
+                                 kBlockSizes[i]);
+      std::string err_str;
+      TestLineCollector collector(nullptr, &std::get<1>(test));
+      EXPECT_FALSE(ParseSimpleStream(input, "dummy", &collector, &err_str));
+      std::string expected_err =
+        StrCat("error: dummy Line ", std::get<2>(test), ", Rejected '", std::get<1>(test), "'");
+      EXPECT_EQ(err_str, expected_err);
+    }
+  }
+}
+
+TEST(ObjCHelper, ParseSimple_RejectLinesNoMessage) {
+  const std::vector<std::tuple<std::string, std::string, int>> tests = {
+    std::make_tuple("a\nb\nc", "a", 1),
+    std::make_tuple("a\nb\nc", "b", 2),
+    std::make_tuple("a\nb\nc", "c", 3),
+    std::make_tuple("a\nb\nc\n", "c", 3),
+  };
+
+  for (const auto& test : tests) {
+    for (int i = 0; i < kBlockSizeCount; i++) {
+      io::ArrayInputStream input(std::get<0>(test).data(), std::get<0>(test).size(),
+                                 kBlockSizes[i]);
+      std::string err_str;
+      TestLineCollector collector(nullptr, &std::get<1>(test), true /* skip msg */);
+      EXPECT_FALSE(ParseSimpleStream(input, "dummy", &collector, &err_str));
+      std::string expected_err =
+        StrCat("error: dummy Line ", std::get<2>(test),
+               ", ConsumeLine failed without setting an error.");
+      EXPECT_EQ(err_str, expected_err);
+    }
+  }
+}
+
 // TODO(thomasvl): Should probably add some unittests for all the special cases
 // of name mangling (class name, field name, enum names).  Rather than doing
 // this with an ObjC test in the objectivec directory, we should be able to
diff --git a/src/google/protobuf/compiler/parser.cc b/src/google/protobuf/compiler/parser.cc
index b8659b7..49ddfce 100644
--- a/src/google/protobuf/compiler/parser.cc
+++ b/src/google/protobuf/compiler/parser.cc
@@ -1518,6 +1518,13 @@
         AddError("Unexpected end of stream while parsing option value.");
         return false;
 
+      case io::Tokenizer::TYPE_WHITESPACE:
+      case io::Tokenizer::TYPE_NEWLINE:
+        GOOGLE_CHECK(!input_->report_whitespace() && !input_->report_newlines())
+            << "Whitespace tokens were not requested.";
+        GOOGLE_LOG(FATAL) << "Tokenizer reported whitespace.";
+        return false;
+
       case io::Tokenizer::TYPE_IDENTIFIER: {
         value_location.AddPath(
             UninterpretedOption::kIdentifierValueFieldNumber);
@@ -1542,7 +1549,7 @@
           value_location.AddPath(
               UninterpretedOption::kNegativeIntValueFieldNumber);
           uninterpreted_option->set_negative_int_value(
-              static_cast<int64_t>(-value));
+              static_cast<int64_t>(0 - value));
         } else {
           value_location.AddPath(
               UninterpretedOption::kPositiveIntValueFieldNumber);
diff --git a/src/google/protobuf/compiler/parser_unittest.cc b/src/google/protobuf/compiler/parser_unittest.cc
index c942393..6973bc9 100644
--- a/src/google/protobuf/compiler/parser_unittest.cc
+++ b/src/google/protobuf/compiler/parser_unittest.cc
@@ -2588,7 +2588,7 @@
     return true;
   }
 
-  virtual void TearDown() override {
+  void TearDown() override {
     EXPECT_TRUE(spans_.empty()) << "Forgot to call HasSpan() for:\n"
                                 << spans_.begin()->second->DebugString();
   }
diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc
index 84bafdd..05f8aca 100644
--- a/src/google/protobuf/compiler/php/php_generator.cc
+++ b/src/google/protobuf/compiler/php/php_generator.cc
@@ -1119,9 +1119,9 @@
       file, &nodes_without_dependency, &deps, &dependency_count);
 
   while (!nodes_without_dependency.empty()) {
-    auto file = *nodes_without_dependency.begin();
-    nodes_without_dependency.erase(file);
-    for (auto dependent : deps[file]) {
+    auto file_node = *nodes_without_dependency.begin();
+    nodes_without_dependency.erase(file_node);
+    for (auto dependent : deps[file_node]) {
       if (dependency_count[dependent] == 1) {
         dependency_count.erase(dependent);
         nodes_without_dependency.insert(dependent);
@@ -1130,11 +1130,11 @@
       }
     }
 
-    bool needs_aggregate = NeedsUnwrapping(file, options);
+    bool needs_aggregate = NeedsUnwrapping(file_node, options);
 
     if (needs_aggregate) {
       auto file_proto = sorted_file_set.add_file();
-      file->CopyTo(file_proto);
+      file_node->CopyTo(file_proto);
 
       // Filter out descriptor.proto as it cannot be depended on for now.
       RepeatedPtrField<std::string>* dependency =
@@ -1156,7 +1156,7 @@
         it->clear_extension();
       }
     } else {
-      std::string dependency_filename = GeneratedMetadataFileName(file, false);
+      std::string dependency_filename = GeneratedMetadataFileName(file_node, false);
       printer->Print(
           "\\^name^::initOnce();\n",
           "name", FilenameToClassname(dependency_filename));
diff --git a/src/google/protobuf/compiler/plugin.cc b/src/google/protobuf/compiler/plugin.cc
index a8e40cd..7809968 100644
--- a/src/google/protobuf/compiler/plugin.cc
+++ b/src/google/protobuf/compiler/plugin.cc
@@ -72,21 +72,22 @@
 
   // implements GeneratorContext --------------------------------------
 
-  virtual io::ZeroCopyOutputStream* Open(const std::string& filename) override {
+  io::ZeroCopyOutputStream* Open(const std::string& filename) override {
     CodeGeneratorResponse::File* file = response_->add_file();
     file->set_name(filename);
     return new io::StringOutputStream(file->mutable_content());
   }
 
-  virtual io::ZeroCopyOutputStream* OpenForInsert(
-      const std::string& filename, const std::string& insertion_point) override {
+  io::ZeroCopyOutputStream* OpenForInsert(
+      const std::string& filename,
+      const std::string& insertion_point) override {
     CodeGeneratorResponse::File* file = response_->add_file();
     file->set_name(filename);
     file->set_insertion_point(insertion_point);
     return new io::StringOutputStream(file->mutable_content());
   }
 
-  virtual io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo(
+  io::ZeroCopyOutputStream* OpenForInsertWithGeneratedCodeInfo(
       const std::string& filename, const std::string& insertion_point,
       const google::protobuf::GeneratedCodeInfo& info) override {
     CodeGeneratorResponse::File* file = response_->add_file();
diff --git a/src/google/protobuf/compiler/plugin.pb.cc b/src/google/protobuf/compiler/plugin.pb.cc
index d7f4aea..e423e85 100644
--- a/src/google/protobuf/compiler/plugin.pb.cc
+++ b/src/google/protobuf/compiler/plugin.pb.cc
@@ -83,7 +83,7 @@
 static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto[1];
 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fcompiler_2fplugin_2eproto = nullptr;
 
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _has_bits_),
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::compiler::Version, _internal_metadata_),
   ~0u,  // no _extensions_
@@ -207,13 +207,13 @@
   }
 }
 
-#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::FEATURE_NONE;
 constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::FEATURE_PROTO3_OPTIONAL;
 constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::Feature_MIN;
 constexpr CodeGeneratorResponse_Feature CodeGeneratorResponse::Feature_MAX;
 constexpr int CodeGeneratorResponse::Feature_ARRAYSIZE;
-#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 
 // ===================================================================
 
@@ -248,6 +248,9 @@
       _has_bits_(from._has_bits_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_suffix()) {
     suffix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_suffix(), 
       GetArenaForAllocation());
@@ -258,8 +261,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.Version)
 }
 
-void Version::SharedCtor() {
+inline void Version::SharedCtor() {
 suffix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&major_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&patch_) -
@@ -290,7 +296,7 @@
 
 void Version::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.Version)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -311,39 +317,39 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional int32 major = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           _Internal::set_has_major(&has_bits);
-          major_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          major_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional int32 minor = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
           _Internal::set_has_minor(&has_bits);
-          minor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          minor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional int32 patch = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
           _Internal::set_has_patch(&has_bits);
-          patch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          patch_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional string suffix = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
           auto str = _internal_mutable_suffix();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -377,10 +383,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Version::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Version::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.Version)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -424,7 +430,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.Version)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -472,7 +478,7 @@
 void Version::MergeFrom(const Version& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.Version)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = from._has_bits_[0];
@@ -569,6 +575,9 @@
       proto_file_(from.proto_file_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_parameter()) {
     parameter_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_parameter(), 
       GetArenaForAllocation());
@@ -581,8 +590,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorRequest)
 }
 
-void CodeGeneratorRequest::SharedCtor() {
+inline void CodeGeneratorRequest::SharedCtor() {
 parameter_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 compiler_version_ = nullptr;
 }
 
@@ -611,7 +623,7 @@
 
 void CodeGeneratorRequest::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorRequest)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -635,12 +647,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // repeated string file_to_generate = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -657,7 +669,7 @@
         continue;
       // optional string parameter = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           auto str = _internal_mutable_parameter();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -669,7 +681,7 @@
         continue;
       // optional .google.protobuf.compiler.Version compiler_version = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           ptr = ctx->ParseMessage(_internal_mutable_compiler_version(), ptr);
           CHK_(ptr);
         } else
@@ -677,7 +689,7 @@
         continue;
       // repeated .google.protobuf.FileDescriptorProto proto_file = 15;
       case 15:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 122)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -712,10 +724,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorRequest::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* CodeGeneratorRequest::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorRequest)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // repeated string file_to_generate = 1;
@@ -767,7 +779,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorRequest)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -822,7 +834,7 @@
 void CodeGeneratorRequest::MergeFrom(const CodeGeneratorRequest& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorRequest)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   file_to_generate_.MergeFrom(from.file_to_generate_);
@@ -847,7 +859,8 @@
 }
 
 bool CodeGeneratorRequest::IsInitialized() const {
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(proto_file_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(proto_file_))
+    return false;
   return true;
 }
 
@@ -915,16 +928,25 @@
       _has_bits_(from._has_bits_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_name()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
   }
   insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_insertion_point()) {
     insertion_point_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_insertion_point(), 
       GetArenaForAllocation());
   }
   content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_content()) {
     content_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_content(), 
       GetArenaForAllocation());
@@ -937,10 +959,19 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse.File)
 }
 
-void CodeGeneratorResponse_File::SharedCtor() {
+inline void CodeGeneratorResponse_File::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 insertion_point_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 content_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 generated_code_info_ = nullptr;
 }
 
@@ -971,7 +1002,7 @@
 
 void CodeGeneratorResponse_File::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse.File)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -999,12 +1030,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -1016,7 +1047,7 @@
         continue;
       // optional string insertion_point = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           auto str = _internal_mutable_insertion_point();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -1028,7 +1059,7 @@
         continue;
       // optional string content = 15;
       case 15:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 122)) {
           auto str = _internal_mutable_content();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -1040,7 +1071,7 @@
         continue;
       // optional .google.protobuf.GeneratedCodeInfo generated_code_info = 16;
       case 16:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 130)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 130)) {
           ptr = ctx->ParseMessage(_internal_mutable_generated_code_info(), ptr);
           CHK_(ptr);
         } else
@@ -1070,10 +1101,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorResponse_File::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* CodeGeneratorResponse_File::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse.File)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -1127,7 +1158,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse.File)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1181,7 +1212,7 @@
 void CodeGeneratorResponse_File::MergeFrom(const CodeGeneratorResponse_File& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse.File)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = from._has_bits_[0];
@@ -1272,6 +1303,9 @@
       file_(from.file_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_error()) {
     error_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_error(), 
       GetArenaForAllocation());
@@ -1280,8 +1314,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.compiler.CodeGeneratorResponse)
 }
 
-void CodeGeneratorResponse::SharedCtor() {
+inline void CodeGeneratorResponse::SharedCtor() {
 error_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 supported_features_ = uint64_t{0u};
 }
 
@@ -1309,7 +1346,7 @@
 
 void CodeGeneratorResponse::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.compiler.CodeGeneratorResponse)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1327,12 +1364,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional string error = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_error();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -1344,7 +1381,7 @@
         continue;
       // optional uint64 supported_features = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
           _Internal::set_has_supported_features(&has_bits);
           supported_features_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -1353,7 +1390,7 @@
         continue;
       // repeated .google.protobuf.compiler.CodeGeneratorResponse.File file = 15;
       case 15:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 122)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 122)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -1388,10 +1425,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* CodeGeneratorResponse::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* CodeGeneratorResponse::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.compiler.CodeGeneratorResponse)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -1431,7 +1468,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.compiler.CodeGeneratorResponse)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1476,7 +1513,7 @@
 void CodeGeneratorResponse::MergeFrom(const CodeGeneratorResponse& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.compiler.CodeGeneratorResponse)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   file_.MergeFrom(from.file_);
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index baa72a2..d558f5b 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3018000
+#if PROTOBUF_VERSION < 3019000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
@@ -58,7 +58,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
   static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
-  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+  static const uint32_t offsets[];
 };
 PROTOC_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
 PROTOBUF_NAMESPACE_OPEN
@@ -173,7 +173,12 @@
   }
   inline void Swap(Version* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -187,11 +192,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Version* New() const final {
-    return new Version();
-  }
-
-  Version* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Version* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Version>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -206,8 +207,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -215,6 +216,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Version* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.compiler.Version";
@@ -252,7 +255,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_suffix(ArgT0&& arg0, ArgT... args);
   std::string* mutable_suffix();
-  PROTOBUF_MUST_USE_RESULT std::string* release_suffix();
+  PROTOBUF_NODISCARD std::string* release_suffix();
   void set_allocated_suffix(std::string* suffix);
   private:
   const std::string& _internal_suffix() const;
@@ -266,11 +269,11 @@
   bool _internal_has_major() const;
   public:
   void clear_major();
-  ::PROTOBUF_NAMESPACE_ID::int32 major() const;
-  void set_major(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t major() const;
+  void set_major(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_major() const;
-  void _internal_set_major(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_major() const;
+  void _internal_set_major(int32_t value);
   public:
 
   // optional int32 minor = 2;
@@ -279,11 +282,11 @@
   bool _internal_has_minor() const;
   public:
   void clear_minor();
-  ::PROTOBUF_NAMESPACE_ID::int32 minor() const;
-  void set_minor(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t minor() const;
+  void set_minor(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_minor() const;
-  void _internal_set_minor(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_minor() const;
+  void _internal_set_minor(int32_t value);
   public:
 
   // optional int32 patch = 3;
@@ -292,11 +295,11 @@
   bool _internal_has_patch() const;
   public:
   void clear_patch();
-  ::PROTOBUF_NAMESPACE_ID::int32 patch() const;
-  void set_patch(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t patch() const;
+  void set_patch(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_patch() const;
-  void _internal_set_patch(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_patch() const;
+  void _internal_set_patch(int32_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.compiler.Version)
@@ -309,9 +312,9 @@
   ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr suffix_;
-  ::PROTOBUF_NAMESPACE_ID::int32 major_;
-  ::PROTOBUF_NAMESPACE_ID::int32 minor_;
-  ::PROTOBUF_NAMESPACE_ID::int32 patch_;
+  int32_t major_;
+  int32_t minor_;
+  int32_t patch_;
   friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
 };
 // -------------------------------------------------------------------
@@ -378,7 +381,12 @@
   }
   inline void Swap(CodeGeneratorRequest* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -392,11 +400,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline CodeGeneratorRequest* New() const final {
-    return new CodeGeneratorRequest();
-  }
-
-  CodeGeneratorRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  CodeGeneratorRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<CodeGeneratorRequest>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -411,8 +415,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -420,6 +424,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(CodeGeneratorRequest* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.compiler.CodeGeneratorRequest";
@@ -499,7 +505,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_parameter(ArgT0&& arg0, ArgT... args);
   std::string* mutable_parameter();
-  PROTOBUF_MUST_USE_RESULT std::string* release_parameter();
+  PROTOBUF_NODISCARD std::string* release_parameter();
   void set_allocated_parameter(std::string* parameter);
   private:
   const std::string& _internal_parameter() const;
@@ -514,7 +520,7 @@
   public:
   void clear_compiler_version();
   const ::PROTOBUF_NAMESPACE_ID::compiler::Version& compiler_version() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::compiler::Version* release_compiler_version();
   ::PROTOBUF_NAMESPACE_ID::compiler::Version* mutable_compiler_version();
   void set_allocated_compiler_version(::PROTOBUF_NAMESPACE_ID::compiler::Version* compiler_version);
   private:
@@ -604,7 +610,12 @@
   }
   inline void Swap(CodeGeneratorResponse_File* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -618,11 +629,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline CodeGeneratorResponse_File* New() const final {
-    return new CodeGeneratorResponse_File();
-  }
-
-  CodeGeneratorResponse_File* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  CodeGeneratorResponse_File* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<CodeGeneratorResponse_File>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -637,8 +644,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -646,6 +653,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(CodeGeneratorResponse_File* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.compiler.CodeGeneratorResponse.File";
@@ -683,7 +692,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -701,7 +710,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_insertion_point(ArgT0&& arg0, ArgT... args);
   std::string* mutable_insertion_point();
-  PROTOBUF_MUST_USE_RESULT std::string* release_insertion_point();
+  PROTOBUF_NODISCARD std::string* release_insertion_point();
   void set_allocated_insertion_point(std::string* insertion_point);
   private:
   const std::string& _internal_insertion_point() const;
@@ -719,7 +728,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_content(ArgT0&& arg0, ArgT... args);
   std::string* mutable_content();
-  PROTOBUF_MUST_USE_RESULT std::string* release_content();
+  PROTOBUF_NODISCARD std::string* release_content();
   void set_allocated_content(std::string* content);
   private:
   const std::string& _internal_content() const;
@@ -734,7 +743,7 @@
   public:
   void clear_generated_code_info();
   const ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo& generated_code_info() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* release_generated_code_info();
   ::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* mutable_generated_code_info();
   void set_allocated_generated_code_info(::PROTOBUF_NAMESPACE_ID::GeneratedCodeInfo* generated_code_info);
   private:
@@ -824,7 +833,12 @@
   }
   inline void Swap(CodeGeneratorResponse* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -838,11 +852,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline CodeGeneratorResponse* New() const final {
-    return new CodeGeneratorResponse();
-  }
-
-  CodeGeneratorResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  CodeGeneratorResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<CodeGeneratorResponse>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -857,8 +867,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -866,6 +876,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(CodeGeneratorResponse* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.compiler.CodeGeneratorResponse";
@@ -952,7 +964,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_error(ArgT0&& arg0, ArgT... args);
   std::string* mutable_error();
-  PROTOBUF_MUST_USE_RESULT std::string* release_error();
+  PROTOBUF_NODISCARD std::string* release_error();
   void set_allocated_error(std::string* error);
   private:
   const std::string& _internal_error() const;
@@ -966,11 +978,11 @@
   bool _internal_has_supported_features() const;
   public:
   void clear_supported_features();
-  ::PROTOBUF_NAMESPACE_ID::uint64 supported_features() const;
-  void set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value);
+  uint64_t supported_features() const;
+  void set_supported_features(uint64_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::uint64 _internal_supported_features() const;
-  void _internal_set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value);
+  uint64_t _internal_supported_features() const;
+  void _internal_set_supported_features(uint64_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.compiler.CodeGeneratorResponse)
@@ -984,7 +996,7 @@
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
   ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::compiler::CodeGeneratorResponse_File > file_;
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr error_;
-  ::PROTOBUF_NAMESPACE_ID::uint64 supported_features_;
+  uint64_t supported_features_;
   friend struct ::TableStruct_google_2fprotobuf_2fcompiler_2fplugin_2eproto;
 };
 // ===================================================================
@@ -1010,18 +1022,18 @@
   major_ = 0;
   _has_bits_[0] &= ~0x00000002u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_major() const {
+inline int32_t Version::_internal_major() const {
   return major_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Version::major() const {
+inline int32_t Version::major() const {
   // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.major)
   return _internal_major();
 }
-inline void Version::_internal_set_major(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Version::_internal_set_major(int32_t value) {
   _has_bits_[0] |= 0x00000002u;
   major_ = value;
 }
-inline void Version::set_major(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Version::set_major(int32_t value) {
   _internal_set_major(value);
   // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.major)
 }
@@ -1038,18 +1050,18 @@
   minor_ = 0;
   _has_bits_[0] &= ~0x00000004u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_minor() const {
+inline int32_t Version::_internal_minor() const {
   return minor_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Version::minor() const {
+inline int32_t Version::minor() const {
   // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.minor)
   return _internal_minor();
 }
-inline void Version::_internal_set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Version::_internal_set_minor(int32_t value) {
   _has_bits_[0] |= 0x00000004u;
   minor_ = value;
 }
-inline void Version::set_minor(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Version::set_minor(int32_t value) {
   _internal_set_minor(value);
   // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.minor)
 }
@@ -1066,18 +1078,18 @@
   patch_ = 0;
   _has_bits_[0] &= ~0x00000008u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Version::_internal_patch() const {
+inline int32_t Version::_internal_patch() const {
   return patch_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Version::patch() const {
+inline int32_t Version::patch() const {
   // @@protoc_insertion_point(field_get:google.protobuf.compiler.Version.patch)
   return _internal_patch();
 }
-inline void Version::_internal_set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Version::_internal_set_patch(int32_t value) {
   _has_bits_[0] |= 0x00000008u;
   patch_ = value;
 }
-inline void Version::set_patch(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Version::set_patch(int32_t value) {
   _internal_set_patch(value);
   // @@protoc_insertion_point(field_set:google.protobuf.compiler.Version.patch)
 }
@@ -1127,7 +1139,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return suffix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = suffix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (suffix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void Version::set_allocated_suffix(std::string* suffix) {
   if (suffix != nullptr) {
@@ -1137,6 +1155,11 @@
   }
   suffix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), suffix,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (suffix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    suffix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.Version.suffix)
 }
 
@@ -1264,7 +1287,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return parameter_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = parameter_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (parameter_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void CodeGeneratorRequest::set_allocated_parameter(std::string* parameter) {
   if (parameter != nullptr) {
@@ -1274,6 +1303,11 @@
   }
   parameter_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), parameter,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (parameter_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    parameter_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorRequest.parameter)
 }
 
@@ -1453,7 +1487,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void CodeGeneratorResponse_File::set_allocated_name(std::string* name) {
   if (name != nullptr) {
@@ -1463,6 +1503,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.name)
 }
 
@@ -1511,7 +1556,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000002u;
-  return insertion_point_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = insertion_point_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (insertion_point_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void CodeGeneratorResponse_File::set_allocated_insertion_point(std::string* insertion_point) {
   if (insertion_point != nullptr) {
@@ -1521,6 +1572,11 @@
   }
   insertion_point_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), insertion_point,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (insertion_point_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    insertion_point_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.insertion_point)
 }
 
@@ -1569,7 +1625,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000004u;
-  return content_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = content_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (content_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void CodeGeneratorResponse_File::set_allocated_content(std::string* content) {
   if (content != nullptr) {
@@ -1579,6 +1641,11 @@
   }
   content_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), content,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (content_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    content_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.File.content)
 }
 
@@ -1719,7 +1786,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return error_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = error_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (error_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void CodeGeneratorResponse::set_allocated_error(std::string* error) {
   if (error != nullptr) {
@@ -1729,6 +1802,11 @@
   }
   error_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), error,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (error_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    error_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.compiler.CodeGeneratorResponse.error)
 }
 
@@ -1744,18 +1822,18 @@
   supported_features_ = uint64_t{0u};
   _has_bits_[0] &= ~0x00000002u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::uint64 CodeGeneratorResponse::_internal_supported_features() const {
+inline uint64_t CodeGeneratorResponse::_internal_supported_features() const {
   return supported_features_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::uint64 CodeGeneratorResponse::supported_features() const {
+inline uint64_t CodeGeneratorResponse::supported_features() const {
   // @@protoc_insertion_point(field_get:google.protobuf.compiler.CodeGeneratorResponse.supported_features)
   return _internal_supported_features();
 }
-inline void CodeGeneratorResponse::_internal_set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value) {
+inline void CodeGeneratorResponse::_internal_set_supported_features(uint64_t value) {
   _has_bits_[0] |= 0x00000002u;
   supported_features_ = value;
 }
-inline void CodeGeneratorResponse::set_supported_features(::PROTOBUF_NAMESPACE_ID::uint64 value) {
+inline void CodeGeneratorResponse::set_supported_features(uint64_t value) {
   _internal_set_supported_features(value);
   // @@protoc_insertion_point(field_set:google.protobuf.compiler.CodeGeneratorResponse.supported_features)
 }
diff --git a/src/google/protobuf/compiler/python/python_generator.cc b/src/google/protobuf/compiler/python/python_generator.cc
index 95de716..9ad7a33 100644
--- a/src/google/protobuf/compiler/python/python_generator.cc
+++ b/src/google/protobuf/compiler/python/python_generator.cc
@@ -180,6 +180,8 @@
   }
   printer->Print(
       "from google.protobuf import descriptor as _descriptor\n"
+      "from google.protobuf import descriptor_pool as "
+      "_descriptor_pool\n"
       "from google.protobuf import message as _message\n"
       "from google.protobuf import reflection as _reflection\n"
       "from google.protobuf import symbol_database as "
@@ -350,12 +352,32 @@
   PrintTopLevelEnums();
   PrintTopLevelExtensions();
   if (pure_python_workable_) {
-    PrintAllNestedEnumsInFile();
-    PrintMessageDescriptors();
-    FixForeignFieldsInDescriptors();
+    if (GeneratingDescriptorProto()) {
+      printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n");
+      printer_->Indent();
+      // Create enums before message descriptors
+      PrintAllNestedEnumsInFile(StripPrintDescriptor::kCreate);
+      PrintMessageDescriptors(StripPrintDescriptor::kCreate);
+      FixForeignFieldsInDescriptors();
+      printer_->Outdent();
+      printer_->Print("else:\n");
+      printer_->Indent();
+    }
+    // Find the message descriptors first and then use the message
+    // descriptor to find enums.
+    PrintMessageDescriptors(StripPrintDescriptor::kFind);
+    PrintAllNestedEnumsInFile(StripPrintDescriptor::kFind);
+    if (GeneratingDescriptorProto()) {
+      printer_->Outdent();
+    }
   }
   PrintMessages();
   if (pure_python_workable_) {
+    PrintServiceDescriptors();
+
+    printer.Print("if _descriptor._USE_C_DESCRIPTORS == False:\n");
+    printer_->Indent();
+
     // We have to fix up the extensions after the message classes themselves,
     // since they need to call static RegisterExtension() methods on these
     // classes.
@@ -366,7 +388,11 @@
     // custom options that may be unknown when we define the descriptors.
     // This does not apply to services because they are not used by extensions.
     FixAllDescriptorOptions();
-    PrintServiceDescriptors();
+
+    // Set serialized_start and serialized_end.
+    SetSerializedPbInterval();
+
+    printer_->Outdent();
   }
   if (HasGenericServices(file)) {
     PrintServices();
@@ -428,46 +454,65 @@
   m["package"] = file_->package();
   m["syntax"] = StringifySyntax(file_->syntax());
   m["options"] = OptionsValue(file_->options().SerializeAsString());
-  const char file_descriptor_template[] =
-      "$descriptor_name$ = _descriptor.FileDescriptor(\n"
-      "  name='$name$',\n"
-      "  package='$package$',\n"
-      "  syntax='$syntax$',\n"
-      "  serialized_options=$options$,\n"
-      "  create_key=_descriptor._internal_create_key,\n";
-  printer_->Print(m, file_descriptor_template);
-  printer_->Indent();
-  if (pure_python_workable_) {
-    printer_->Print("serialized_pb=b'$value$'\n", "value",
-                    strings::CHexEscape(file_descriptor_serialized_));
-    if (file_->dependency_count() != 0) {
-      printer_->Print(",\ndependencies=[");
-      for (int i = 0; i < file_->dependency_count(); ++i) {
-        std::string module_alias = ModuleAlias(file_->dependency(i)->name());
-        printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias",
-                        module_alias);
+  m["serialized_descriptor"] = strings::CHexEscape(file_descriptor_serialized_);
+  if (GeneratingDescriptorProto()) {
+    printer_->Print("if _descriptor._USE_C_DESCRIPTORS == False:\n");
+    printer_->Indent();
+    // Pure python's AddSerializedFile() depend on the generated
+    // descriptor_pb2.py thus we can not use AddSerializedFile() when
+    // generated descriptor.proto for pure python.
+    const char file_descriptor_template[] =
+        "$descriptor_name$ = _descriptor.FileDescriptor(\n"
+        "  name='$name$',\n"
+        "  package='$package$',\n"
+        "  syntax='$syntax$',\n"
+        "  serialized_options=$options$,\n"
+        "  create_key=_descriptor._internal_create_key,\n";
+    printer_->Print(m, file_descriptor_template);
+    printer_->Indent();
+    if (pure_python_workable_) {
+      printer_->Print("serialized_pb=b'$value$'\n", "value",
+                      strings::CHexEscape(file_descriptor_serialized_));
+      if (file_->dependency_count() != 0) {
+        printer_->Print(",\ndependencies=[");
+        for (int i = 0; i < file_->dependency_count(); ++i) {
+          std::string module_alias = ModuleAlias(file_->dependency(i)->name());
+          printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias",
+                          module_alias);
+        }
+        printer_->Print("]");
       }
-      printer_->Print("]");
-    }
-    if (file_->public_dependency_count() > 0) {
-      printer_->Print(",\npublic_dependencies=[");
-      for (int i = 0; i < file_->public_dependency_count(); ++i) {
-        std::string module_alias =
-            ModuleAlias(file_->public_dependency(i)->name());
-        printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias",
-                        module_alias);
+      if (file_->public_dependency_count() > 0) {
+        printer_->Print(",\npublic_dependencies=[");
+        for (int i = 0; i < file_->public_dependency_count(); ++i) {
+          std::string module_alias =
+              ModuleAlias(file_->public_dependency(i)->name());
+          printer_->Print("$module_alias$.DESCRIPTOR,", "module_alias",
+                          module_alias);
+        }
+        printer_->Print("]");
       }
-      printer_->Print("]");
+    } else {
+      printer_->Print("serialized_pb=''\n");
     }
-  } else {
-    printer_->Print("serialized_pb=''\n");
+
+    // TODO(falk): Also print options and fix the message_type, enum_type,
+    //             service and extension later in the generation.
+
+    printer_->Outdent();
+    printer_->Print(")\n");
+
+    printer_->Outdent();
+    printer_->Print("else:\n");
+    printer_->Indent();
   }
-
-  // TODO(falk): Also print options and fix the message_type, enum_type,
-  //             service and extension later in the generation.
-
-  printer_->Outdent();
-  printer_->Print(")\n");
+  printer_->Print(m,
+                  "$descriptor_name$ = "
+                  "_descriptor_pool.Default().AddSerializedFile(b'$serialized_"
+                  "descriptor$')\n");
+  if (GeneratingDescriptorProto()) {
+    printer_->Outdent();
+  }
   printer_->Print("\n");
 }
 
@@ -477,7 +522,7 @@
   std::vector<std::pair<std::string, int> > top_level_enum_values;
   for (int i = 0; i < file_->enum_type_count(); ++i) {
     const EnumDescriptor& enum_descriptor = *file_->enum_type(i);
-    PrintEnum(enum_descriptor);
+    PrintFindEnum(enum_descriptor);
     printer_->Print(
         "$name$ = "
         "enum_type_wrapper.EnumTypeWrapper($descriptor_name$)",
@@ -501,16 +546,17 @@
 }
 
 // Prints all enums contained in all message types in |file|.
-void Generator::PrintAllNestedEnumsInFile() const {
+void Generator::PrintAllNestedEnumsInFile(
+    StripPrintDescriptor print_mode) const {
   for (int i = 0; i < file_->message_type_count(); ++i) {
-    PrintNestedEnums(*file_->message_type(i));
+    PrintNestedEnums(*file_->message_type(i), print_mode);
   }
 }
 
 // Prints a Python statement assigning the appropriate module-level
 // enum name to a Python EnumDescriptor object equivalent to
 // enum_descriptor.
-void Generator::PrintEnum(const EnumDescriptor& enum_descriptor) const {
+void Generator::PrintCreateEnum(const EnumDescriptor& enum_descriptor) const {
   std::map<std::string, std::string> m;
   std::string module_level_descriptor_name =
       ModuleLevelDescriptorName(enum_descriptor);
@@ -545,7 +591,6 @@
   printer_->Print("serialized_options=$options_value$,\n", "options_value",
                   OptionsValue(options_string));
   EnumDescriptorProto edp;
-  PrintSerializedPbInterval(enum_descriptor, edp);
   printer_->Outdent();
   printer_->Print(")\n");
   if (pure_python_workable_) {
@@ -555,20 +600,41 @@
   printer_->Print("\n");
 }
 
+void Generator::PrintFindEnum(const EnumDescriptor& enum_descriptor) const {
+  std::map<std::string, std::string> m;
+  m["descriptor_name"] = ModuleLevelDescriptorName(enum_descriptor);
+  m["name"] = enum_descriptor.name();
+  m["file"] = kDescriptorKey;
+  if (enum_descriptor.containing_type()) {
+    m["containing_type"] =
+        ModuleLevelDescriptorName(*enum_descriptor.containing_type());
+    printer_->Print(m,
+                    "$descriptor_name$ = "
+                    "$containing_type$.enum_types_by_name['$name$']\n");
+  } else {
+    printer_->Print(
+        m, "$descriptor_name$ = $file$.enum_types_by_name['$name$']\n");
+  }
+}
+
 // Recursively prints enums in nested types within descriptor, then
 // prints enums contained at the top level in descriptor.
-void Generator::PrintNestedEnums(const Descriptor& descriptor) const {
+void Generator::PrintNestedEnums(const Descriptor& descriptor,
+                                 StripPrintDescriptor print_mode) const {
   for (int i = 0; i < descriptor.nested_type_count(); ++i) {
-    PrintNestedEnums(*descriptor.nested_type(i));
+    PrintNestedEnums(*descriptor.nested_type(i), print_mode);
   }
 
   for (int i = 0; i < descriptor.enum_type_count(); ++i) {
-    PrintEnum(*descriptor.enum_type(i));
+    if (print_mode == StripPrintDescriptor::kCreate) {
+      PrintCreateEnum(*descriptor.enum_type(i));
+    } else {
+      PrintFindEnum(*descriptor.enum_type(i));
+    }
   }
 }
 
 void Generator::PrintTopLevelExtensions() const {
-  const bool is_extension = true;
   for (int i = 0; i < file_->extension_count(); ++i) {
     const FieldDescriptor& extension_field = *file_->extension(i);
     std::string constant_name = extension_field.name() + "_FIELD_NUMBER";
@@ -576,27 +642,32 @@
     printer_->Print("$constant_name$ = $number$\n", "constant_name",
                     constant_name, "number",
                     StrCat(extension_field.number()));
-    printer_->Print("$name$ = ", "name",
-                    ResolveKeyword(extension_field.name()));
-    PrintFieldDescriptor(extension_field, is_extension);
-    printer_->Print("\n");
+    printer_->Print(
+        "$resolved_name$ = "
+        "$file$.extensions_by_name['$name$']\n",
+        "resolved_name", ResolveKeyword(extension_field.name()), "file",
+        kDescriptorKey, "name", extension_field.name());
   }
   printer_->Print("\n");
 }
 
 // Prints Python equivalents of all Descriptors in |file|.
-void Generator::PrintMessageDescriptors() const {
-  for (int i = 0; i < file_->message_type_count(); ++i) {
-    PrintDescriptor(*file_->message_type(i));
-    printer_->Print("\n");
+void Generator::PrintMessageDescriptors(StripPrintDescriptor print_mode) const {
+  if (print_mode == StripPrintDescriptor::kCreate) {
+    for (int i = 0; i < file_->message_type_count(); ++i) {
+      PrintCreateDescriptor(*file_->message_type(i));
+      printer_->Print("\n");
+    }
+  } else {
+    for (int i = 0; i < file_->message_type_count(); ++i) {
+      PrintFindDescriptor(*file_->message_type(i));
+    }
   }
 }
 
 void Generator::PrintServiceDescriptors() const {
   for (int i = 0; i < file_->service_count(); ++i) {
     PrintServiceDescriptor(*file_->service(i));
-    AddServiceToFileDescriptor(*file_->service(i));
-    printer_->Print("\n");
   }
 }
 
@@ -610,65 +681,11 @@
 
 void Generator::PrintServiceDescriptor(
     const ServiceDescriptor& descriptor) const {
-  printer_->Print("\n");
-  std::string service_name = ModuleLevelServiceDescriptorName(descriptor);
-  std::string options_string;
-  descriptor.options().SerializeToString(&options_string);
-
-  printer_->Print("$service_name$ = _descriptor.ServiceDescriptor(\n",
-                  "service_name", service_name);
-  printer_->Indent();
   std::map<std::string, std::string> m;
+  m["service_name"] = ModuleLevelServiceDescriptorName(descriptor);
   m["name"] = descriptor.name();
-  m["full_name"] = descriptor.full_name();
   m["file"] = kDescriptorKey;
-  m["index"] = StrCat(descriptor.index());
-  m["options_value"] = OptionsValue(options_string);
-  const char required_function_arguments[] =
-      "name='$name$',\n"
-      "full_name='$full_name$',\n"
-      "file=$file$,\n"
-      "index=$index$,\n"
-      "serialized_options=$options_value$,\n"
-      "create_key=_descriptor._internal_create_key,\n";
-  printer_->Print(m, required_function_arguments);
-
-  ServiceDescriptorProto sdp;
-  PrintSerializedPbInterval(descriptor, sdp);
-
-  printer_->Print("methods=[\n");
-  for (int i = 0; i < descriptor.method_count(); ++i) {
-    const MethodDescriptor* method = descriptor.method(i);
-    method->options().SerializeToString(&options_string);
-
-    m.clear();
-    m["name"] = method->name();
-    m["full_name"] = method->full_name();
-    m["index"] = StrCat(method->index());
-    m["serialized_options"] = CEscape(options_string);
-    m["input_type"] = ModuleLevelDescriptorName(*(method->input_type()));
-    m["output_type"] = ModuleLevelDescriptorName(*(method->output_type()));
-    m["options_value"] = OptionsValue(options_string);
-    printer_->Print("_descriptor.MethodDescriptor(\n");
-    printer_->Indent();
-    printer_->Print(m,
-                    "name='$name$',\n"
-                    "full_name='$full_name$',\n"
-                    "index=$index$,\n"
-                    "containing_service=None,\n"
-                    "input_type=$input_type$,\n"
-                    "output_type=$output_type$,\n"
-                    "serialized_options=$options_value$,\n"
-                    "create_key=_descriptor._internal_create_key,\n");
-    printer_->Outdent();
-    printer_->Print("),\n");
-  }
-
-  printer_->Outdent();
-  printer_->Print("])\n");
-  printer_->Print("_sym_db.RegisterServiceDescriptor($name$)\n", "name",
-                  service_name);
-  printer_->Print("\n");
+  printer_->Print(m, "$service_name$ = $file$.services_by_name['$name$']\n");
 }
 
 void Generator::PrintDescriptorKeyAndModuleName(
@@ -713,18 +730,20 @@
 // to a Python Descriptor object for message_descriptor.
 //
 // Mutually recursive with PrintNestedDescriptors().
-void Generator::PrintDescriptor(const Descriptor& message_descriptor) const {
-  PrintNestedDescriptors(message_descriptor);
+void Generator::PrintCreateDescriptor(
+    const Descriptor& message_descriptor) const {
+  std::map<std::string, std::string> m;
+  m["name"] = message_descriptor.name();
+  m["full_name"] = message_descriptor.full_name();
+  m["file"] = kDescriptorKey;
+
+  PrintNestedDescriptors(message_descriptor, StripPrintDescriptor::kCreate);
 
   printer_->Print("\n");
   printer_->Print("$descriptor_name$ = _descriptor.Descriptor(\n",
                   "descriptor_name",
                   ModuleLevelDescriptorName(message_descriptor));
   printer_->Indent();
-  std::map<std::string, std::string> m;
-  m["name"] = message_descriptor.name();
-  m["full_name"] = message_descriptor.full_name();
-  m["file"] = kDescriptorKey;
   const char required_function_arguments[] =
       "name='$name$',\n"
       "full_name='$full_name$',\n"
@@ -780,12 +799,11 @@
   printer_->Indent();
   for (int i = 0; i < message_descriptor.oneof_decl_count(); ++i) {
     const OneofDescriptor* desc = message_descriptor.oneof_decl(i);
-    std::map<std::string, std::string> m;
+    m.clear();
     m["name"] = desc->name();
     m["full_name"] = desc->full_name();
     m["index"] = StrCat(desc->index());
-    std::string options_string =
-        OptionsValue(desc->options().SerializeAsString());
+    options_string = OptionsValue(desc->options().SerializeAsString());
     if (options_string == "None") {
       m["serialized_options"] = "";
     } else {
@@ -800,22 +818,46 @@
   }
   printer_->Outdent();
   printer_->Print("],\n");
-  // Serialization of proto
-  DescriptorProto edp;
-  PrintSerializedPbInterval(message_descriptor, edp);
 
   printer_->Outdent();
   printer_->Print(")\n");
 }
 
+void Generator::PrintFindDescriptor(
+    const Descriptor& message_descriptor) const {
+  std::map<std::string, std::string> m;
+  m["descriptor_name"] = ModuleLevelDescriptorName(message_descriptor);
+  m["name"] = message_descriptor.name();
+
+  if (message_descriptor.containing_type()) {
+    m["containing_type"] =
+        ModuleLevelDescriptorName(*message_descriptor.containing_type());
+    printer_->Print(m,
+                    "$descriptor_name$ = "
+                    "$containing_type$.nested_types_by_name['$name$']\n");
+  } else {
+    m["file"] = kDescriptorKey;
+    printer_->Print(
+        m, "$descriptor_name$ = $file$.message_types_by_name['$name$']\n");
+  }
+
+  PrintNestedDescriptors(message_descriptor, StripPrintDescriptor::kFind);
+}
+
 // Prints Python Descriptor objects for all nested types contained in
 // message_descriptor.
 //
 // Mutually recursive with PrintDescriptor().
-void Generator::PrintNestedDescriptors(
-    const Descriptor& containing_descriptor) const {
-  for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) {
-    PrintDescriptor(*containing_descriptor.nested_type(i));
+void Generator::PrintNestedDescriptors(const Descriptor& containing_descriptor,
+                                       StripPrintDescriptor print_mode) const {
+  if (print_mode == StripPrintDescriptor::kCreate) {
+    for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) {
+      PrintCreateDescriptor(*containing_descriptor.nested_type(i));
+    }
+  } else {
+    for (int i = 0; i < containing_descriptor.nested_type_count(); ++i) {
+      PrintFindDescriptor(*containing_descriptor.nested_type(i));
+    }
   }
 }
 
@@ -1098,10 +1140,6 @@
 void Generator::FixForeignFieldsInExtension(
     const FieldDescriptor& extension_field) const {
   GOOGLE_CHECK(extension_field.is_extension());
-  // extension_scope() will be NULL for top-level extensions, which is
-  // exactly what FixForeignFieldsInField() wants.
-  FixForeignFieldsInField(extension_field.extension_scope(), extension_field,
-                          "extensions_by_name");
 
   std::map<std::string, std::string> m;
   // Confusingly, for FieldDescriptors that happen to be extensions,
@@ -1300,7 +1338,8 @@
 //
 template <typename DescriptorT, typename DescriptorProtoT>
 void Generator::PrintSerializedPbInterval(const DescriptorT& descriptor,
-                                          DescriptorProtoT& proto) const {
+                                          DescriptorProtoT& proto,
+                                          const std::string& name) const {
   descriptor.CopyTo(&proto);
   std::string sp;
   proto.SerializeToString(&sp);
@@ -1308,9 +1347,9 @@
   GOOGLE_CHECK_GE(offset, 0);
 
   printer_->Print(
-      "serialized_start=$serialized_start$,\n"
-      "serialized_end=$serialized_end$,\n",
-      "serialized_start", StrCat(offset), "serialized_end",
+      "$name$._serialized_start=$serialized_start$\n"
+      "$name$._serialized_end=$serialized_end$\n",
+      "name", name, "serialized_start", StrCat(offset), "serialized_end",
       StrCat(offset + sp.size()));
 }
 
@@ -1320,16 +1359,62 @@
                                       io::Printer* printer) {
   // Reset the _options to None thus DescriptorBase.GetOptions() can
   // parse _options again after extensions are registered.
-  printer->Print("$descriptor$._options = None\n", "descriptor", descriptor);
+  printer->Print(
+      "$descriptor$._options = None\n"
+      "$descriptor$._serialized_options = $serialized_value$\n",
+      "descriptor", descriptor, "serialized_value", options);
 }
 }  // namespace
 
+void Generator::SetSerializedPbInterval() const {
+  // Top level enums.
+  for (int i = 0; i < file_->enum_type_count(); ++i) {
+    EnumDescriptorProto proto;
+    const EnumDescriptor& descriptor = *file_->enum_type(i);
+    PrintSerializedPbInterval(descriptor, proto,
+                              ModuleLevelDescriptorName(descriptor));
+  }
+
+  // Messages.
+  for (int i = 0; i < file_->message_type_count(); ++i) {
+    SetMessagePbInterval(*file_->message_type(i));
+  }
+
+  // Services.
+  for (int i = 0; i < file_->service_count(); ++i) {
+    ServiceDescriptorProto proto;
+    const ServiceDescriptor& service = *file_->service(i);
+    PrintSerializedPbInterval(service, proto,
+                              ModuleLevelServiceDescriptorName(service));
+  }
+}
+
+void Generator::SetMessagePbInterval(const Descriptor& descriptor) const {
+  DescriptorProto message_proto;
+  PrintSerializedPbInterval(descriptor, message_proto,
+                            ModuleLevelDescriptorName(descriptor));
+
+  // Nested messages.
+  for (int i = 0; i < descriptor.nested_type_count(); ++i) {
+    SetMessagePbInterval(*descriptor.nested_type(i));
+  }
+
+  for (int i = 0; i < descriptor.enum_type_count(); ++i) {
+    EnumDescriptorProto proto;
+    const EnumDescriptor& enum_des = *descriptor.enum_type(i);
+    PrintSerializedPbInterval(enum_des, proto,
+                              ModuleLevelDescriptorName(enum_des));
+  }
+}
+
 // Prints expressions that set the options field of all descriptors.
 void Generator::FixAllDescriptorOptions() const {
   // Prints an expression that sets the file descriptor's options.
   std::string file_options = OptionsValue(file_->options().SerializeAsString());
   if (file_options != "None") {
     PrintDescriptorOptionsFixingCode(kDescriptorKey, file_options, printer_);
+  } else {
+    printer_->Print("DESCRIPTOR._options = None\n");
   }
   // Prints expressions that set the options for all top level enums.
   for (int i = 0; i < file_->enum_type_count(); ++i) {
@@ -1346,6 +1431,10 @@
   for (int i = 0; i < file_->message_type_count(); ++i) {
     FixOptionsForMessage(*file_->message_type(i));
   }
+
+  for (int i = 0; i < file_->service_count(); ++i) {
+    FixOptionsForService(*file_->service(i));
+  }
 }
 
 void Generator::FixOptionsForOneof(const OneofDescriptor& oneof) const {
@@ -1380,6 +1469,31 @@
   }
 }
 
+// Prints expressions that set the options for an service descriptor and its
+// value descriptors.
+void Generator::FixOptionsForService(
+    const ServiceDescriptor& service_descriptor) const {
+  std::string descriptor_name =
+      ModuleLevelServiceDescriptorName(service_descriptor);
+  std::string service_options =
+      OptionsValue(service_descriptor.options().SerializeAsString());
+  if (service_options != "None") {
+    PrintDescriptorOptionsFixingCode(descriptor_name, service_options,
+                                     printer_);
+  }
+
+  for (int i = 0; i < service_descriptor.method_count(); ++i) {
+    const MethodDescriptor* method = service_descriptor.method(i);
+    std::string method_options =
+        OptionsValue(method->options().SerializeAsString());
+    if (method_options != "None") {
+      std::string method_name =
+          descriptor_name + ".methods_by_name['" + method->name() + "']";
+      PrintDescriptorOptionsFixingCode(method_name, method_options, printer_);
+    }
+  }
+}
+
 // Prints expressions that set the options for field descriptors (including
 // extensions).
 void Generator::FixOptionsForField(const FieldDescriptor& field) const {
diff --git a/src/google/protobuf/compiler/python/python_generator.h b/src/google/protobuf/compiler/python/python_generator.h
index ed1c995..3b4c132 100644
--- a/src/google/protobuf/compiler/python/python_generator.h
+++ b/src/google/protobuf/compiler/python/python_generator.h
@@ -59,6 +59,8 @@
 namespace compiler {
 namespace python {
 
+enum class StripPrintDescriptor { kCreate, kFind };
+
 // CodeGenerator implementation for generated Python protocol buffer classes.
 // If you create your own protocol compiler binary and you want it to support
 // Python output, you can do so by registering an instance of this
@@ -79,9 +81,11 @@
   void PrintImports() const;
   void PrintFileDescriptor() const;
   void PrintTopLevelEnums() const;
-  void PrintAllNestedEnumsInFile() const;
-  void PrintNestedEnums(const Descriptor& descriptor) const;
-  void PrintEnum(const EnumDescriptor& enum_descriptor) const;
+  void PrintAllNestedEnumsInFile(StripPrintDescriptor print_mode) const;
+  void PrintNestedEnums(const Descriptor& descriptor,
+                        StripPrintDescriptor print_mode) const;
+  void PrintCreateEnum(const EnumDescriptor& enum_descriptor) const;
+  void PrintFindEnum(const EnumDescriptor& enum_descriptor) const;
 
   void PrintTopLevelExtensions() const;
 
@@ -93,9 +97,11 @@
       const FieldDescriptor* (Descriptor::*GetterFn)(int)const) const;
   void PrintFieldsInDescriptor(const Descriptor& message_descriptor) const;
   void PrintExtensionsInDescriptor(const Descriptor& message_descriptor) const;
-  void PrintMessageDescriptors() const;
-  void PrintDescriptor(const Descriptor& message_descriptor) const;
-  void PrintNestedDescriptors(const Descriptor& containing_descriptor) const;
+  void PrintMessageDescriptors(StripPrintDescriptor print_mode) const;
+  void PrintCreateDescriptor(const Descriptor& message_descriptor) const;
+  void PrintFindDescriptor(const Descriptor& message_descriptor) const;
+  void PrintNestedDescriptors(const Descriptor& containing_descriptor,
+                              StripPrintDescriptor print_mode) const;
 
   void PrintMessages() const;
   void PrintMessage(const Descriptor& message_descriptor,
@@ -150,14 +156,19 @@
 
   template <typename DescriptorT, typename DescriptorProtoT>
   void PrintSerializedPbInterval(const DescriptorT& descriptor,
-                                 DescriptorProtoT& proto) const;
+                                 DescriptorProtoT& proto,
+                                 const std::string& name) const;
 
   void FixAllDescriptorOptions() const;
   void FixOptionsForField(const FieldDescriptor& field) const;
   void FixOptionsForOneof(const OneofDescriptor& oneof) const;
   void FixOptionsForEnum(const EnumDescriptor& descriptor) const;
+  void FixOptionsForService(const ServiceDescriptor& descriptor) const;
   void FixOptionsForMessage(const Descriptor& descriptor) const;
 
+  void SetSerializedPbInterval() const;
+  void SetMessagePbInterval(const Descriptor& descriptor) const;
+
   void CopyPublicDependenciesAliases(const std::string& copy_from,
                                      const FileDescriptor* file) const;
 
diff --git a/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb b/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb
index 4cf4866..256ac7c 100644
--- a/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb
+++ b/src/google/protobuf/compiler/ruby/ruby_generated_code_pb.rb
@@ -1,9 +1,10 @@
 # Generated by the protocol buffer compiler.  DO NOT EDIT!
 # source: ruby_generated_code.proto
 
-require 'ruby_generated_code_proto2_import_pb'
 require 'google/protobuf'
 
+require 'ruby_generated_code_proto2_import_pb'
+
 Google::Protobuf::DescriptorPool.generated_pool.build do
   add_file("ruby_generated_code.proto", :syntax => :proto3) do
     add_message "A.B.C.TestMessage" do
diff --git a/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb b/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb
index e331e9b..44d3196 100644
--- a/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb
+++ b/src/google/protobuf/compiler/ruby/ruby_generated_code_proto2_pb.rb
@@ -1,9 +1,10 @@
 # Generated by the protocol buffer compiler.  DO NOT EDIT!
 # source: ruby_generated_code_proto2.proto
 
-require 'ruby_generated_code_proto2_import_pb'
 require 'google/protobuf'
 
+require 'ruby_generated_code_proto2_import_pb'
+
 Google::Protobuf::DescriptorPool.generated_pool.build do
   add_file("ruby_generated_code_proto2.proto", :syntax => :proto2) do
     add_message "A.B.C.TestMessage" do
diff --git a/src/google/protobuf/compiler/ruby/ruby_generator.cc b/src/google/protobuf/compiler/ruby/ruby_generator.cc
index f45c0f3..46e60f5 100644
--- a/src/google/protobuf/compiler/ruby/ruby_generator.cc
+++ b/src/google/protobuf/compiler/ruby/ruby_generator.cc
@@ -465,35 +465,8 @@
   }
 }
 
-bool UsesTypeFromFile(const Descriptor* message, const FileDescriptor* file,
-                      std::string* error) {
-  for (int i = 0; i < message->field_count(); i++) {
-    const FieldDescriptor* field = message->field(i);
-    if ((field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE &&
-         field->message_type()->file() == file) ||
-        (field->type() == FieldDescriptor::TYPE_ENUM &&
-         field->enum_type()->file() == file)) {
-      *error = "proto3 message field " + field->full_name() + " in file " +
-               file->name() + " has a dependency on a type from proto2 file " +
-               file->name() +
-               ".  Ruby doesn't support proto2 yet, so we must fail.";
-      return true;
-    }
-  }
-
-  for (int i = 0; i < message->nested_type_count(); i++) {
-    if (UsesTypeFromFile(message->nested_type(i), file, error)) {
-      return true;
-    }
-  }
-
-  return false;
-}
-
 bool GenerateDslDescriptor(const FileDescriptor* file, io::Printer* printer,
                            std::string* error) {
-  printer->Print(
-    "require 'google/protobuf'\n\n");
   printer->Print("Google::Protobuf::DescriptorPool.generated_pool.build do\n");
   printer->Indent();
   printer->Print("add_file(\"$filename$\", :syntax => :$syntax$) do\n",
@@ -534,8 +507,13 @@
     "\n",
     "filename", file->name());
 
-  for (int i = 0; i < file->dependency_count(); i++) {
-    printer->Print("require '$name$'\n", "name", GetRequireName(file->dependency(i)->name()));
+  printer->Print("require 'google/protobuf'\n\n");
+
+  if (file->dependency_count() != 0) {
+    for (int i = 0; i < file->dependency_count(); i++) {
+      printer->Print("require '$name$'\n", "name", GetRequireName(file->dependency(i)->name()));
+    }
+    printer->Print("\n");
   }
 
   // TODO: Remove this when ruby supports extensions for proto2 syntax.
diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc
index b6c31fd..c8ce218 100644
--- a/src/google/protobuf/descriptor.cc
+++ b/src/google/protobuf/descriptor.cc
@@ -52,6 +52,7 @@
 #include <google/protobuf/stubs/strutil.h>
 #include <google/protobuf/any.h>
 #include <google/protobuf/descriptor.pb.h>
+#include <google/protobuf/stubs/once.h>
 #include <google/protobuf/io/coded_stream.h>
 #include <google/protobuf/io/tokenizer.h>
 #include <google/protobuf/io/zero_copy_stream_impl.h>
@@ -155,6 +156,7 @@
   struct QueryKey : internal::SymbolBase {
     StringPiece name;
     const void* parent;
+    int field_number;
   };
   DEFINE_MEMBERS(QueryKey, QUERY_KEY, query_key);
 #undef DEFINE_MEMBERS
@@ -219,7 +221,7 @@
     return "";
   }
 
-  std::pair<const void*, StringPiece> parent_key() const {
+  std::pair<const void*, StringPiece> parent_name_key() const {
     const auto or_file = [&](const void* p) { return p ? p : GetFile(); };
     switch (type()) {
       case MESSAGE:
@@ -254,6 +256,22 @@
     return {};
   }
 
+  std::pair<const void*, int> parent_number_key() const {
+    switch (type()) {
+      case FIELD:
+        return {field_descriptor()->containing_type(),
+                field_descriptor()->number()};
+      case ENUM_VALUE:
+        return {enum_value_descriptor()->type(),
+                enum_value_descriptor()->number()};
+      case QUERY_KEY:
+        return {query_key()->parent, query_key()->field_number};
+      default:
+        GOOGLE_CHECK(false);
+    }
+    return {};
+  }
+
  private:
   const internal::SymbolBase* ptr_;
 };
@@ -343,7 +361,7 @@
 
 static const char* const kNonLinkedWeakMessageReplacementName = "google.protobuf.Empty";
 
-#if !defined(_MSC_VER) || _MSC_VER >= 1900
+#if !defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)
 const int FieldDescriptor::kMaxNumber;
 const int FieldDescriptor::kFirstReservedNumber;
 const int FieldDescriptor::kLastReservedNumber;
@@ -498,7 +516,6 @@
 typedef std::pair<const void*, StringPiece> PointerStringPair;
 
 typedef std::pair<const Descriptor*, int> DescriptorIntPair;
-typedef std::pair<const EnumDescriptor*, int> EnumIntPair;
 
 #define HASH_MAP std::unordered_map
 #define HASH_SET std::unordered_set
@@ -560,12 +577,12 @@
 
 struct SymbolByParentHash {
   size_t operator()(Symbol s) const {
-    return PointerStringPairHash{}(s.parent_key());
+    return PointerStringPairHash{}(s.parent_name_key());
   }
 };
 struct SymbolByParentEq {
   bool operator()(Symbol a, Symbol b) const {
-    return a.parent_key() == b.parent_key();
+    return a.parent_name_key() == b.parent_name_key();
   }
 };
 using SymbolsByParentSet =
@@ -579,15 +596,21 @@
                  PointerStringPairHash>
     FieldsByNameMap;
 
-typedef HASH_MAP<DescriptorIntPair, const FieldDescriptor*,
-                 PointerIntegerPairHash<DescriptorIntPair>,
-                 std::equal_to<DescriptorIntPair>>
-    FieldsByNumberMap;
+struct FieldsByNumberHash {
+  size_t operator()(Symbol s) const {
+    return PointerIntegerPairHash<std::pair<const void*, int>>{}(
+        s.parent_number_key());
+  }
+};
+struct FieldsByNumberEq {
+  bool operator()(Symbol a, Symbol b) const {
+    return a.parent_number_key() == b.parent_number_key();
+  }
+};
+using FieldsByNumberSet =
+    HASH_SET<Symbol, FieldsByNumberHash, FieldsByNumberEq>;
+using EnumValuesByNumberSet = FieldsByNumberSet;
 
-typedef HASH_MAP<EnumIntPair, const EnumValueDescriptor*,
-                 PointerIntegerPairHash<EnumIntPair>,
-                 std::equal_to<EnumIntPair>>
-    EnumValuesByNumberMap;
 // This is a map rather than a hash-map, since we use it to iterate
 // through all the extensions that extend a given Descriptor, and an
 // ordered data structure that implements lower_bound is convenient
@@ -794,7 +817,7 @@
     size = RoundUp(size);
 
     Block* to_relocate = nullptr;
-    Block* to_use;
+    Block* to_use = nullptr;
 
     for (size_t i = 0; i < kSmallSizes.size(); ++i) {
       if (small_size_blocks_[i] != nullptr && size <= kSmallSizes[i]) {
@@ -993,12 +1016,12 @@
     to_relocate->PrependTo(full_blocks_);
   }
 
-  static constexpr std::array<uint8_t, 6> kSmallSizes = {{
-      // Sizes for pointer arrays.
-      8, 16, 24, 32,
-      // Sizes for string arrays (for descriptor names).
-      // The most common array sizes are 2 and 3.
-      2 * sizeof(std::string), 3 * sizeof(std::string)}};
+  static constexpr std::array<uint8_t, 6> kSmallSizes = {
+      {// Sizes for pointer arrays.
+       8, 16, 24, 32,
+       // Sizes for string arrays (for descriptor names).
+       // The most common array sizes are 2 and 3.
+       2 * sizeof(std::string), 3 * sizeof(std::string)}};
 
   // Helper function to iterate all lists.
   std::array<Block*, 2 + kSmallSizes.size()> GetLists() const {
@@ -1148,6 +1171,10 @@
   // The string is initialized to the given value for convenience.
   const std::string* AllocateString(StringPiece value);
 
+  // Copy the input into a NUL terminated string whose lifetime is managed by
+  // the pool.
+  const char* Strdup(StringPiece value);
+
   // Allocates an array of strings which will be destroyed when the pool is
   // destroyed. The array is initialized with the input values.
   template <typename... In>
@@ -1168,9 +1195,11 @@
                                       const std::string& scope,
                                       const std::string* opt_json_name);
 
-  // Allocate a LazyInitData which will be destroyed when the pool is
-  // destroyed.
-  internal::LazyInitData* AllocateLazyInit();
+  // Create an object that will be deleted when the pool is destroyed.
+  // The object is value initialized, and its destructor will be called if
+  // non-trivial.
+  template <typename Type>
+  Type* Create();
 
   // Allocate a protocol message object.  Some older versions of GCC have
   // trouble understanding explicit template instantiations in some cases, so
@@ -1261,8 +1290,8 @@
   // as it will be used as a key in the symbols_by_parent_ map without copying.
   bool AddAliasUnderParent(const void* parent, const std::string& name,
                            Symbol symbol);
-  bool AddFieldByNumber(const FieldDescriptor* field);
-  bool AddEnumValueByNumber(const EnumValueDescriptor* value);
+  bool AddFieldByNumber(FieldDescriptor* field);
+  bool AddEnumValueByNumber(EnumValueDescriptor* value);
 
   // Adds the field to the lowercase_name and camelcase_name maps.  Never
   // fails because we allow duplicates; the first field by the name wins.
@@ -1300,9 +1329,9 @@
   mutable FieldsByNameMap fields_by_camelcase_name_;
   std::unique_ptr<FieldsByNameMap> fields_by_camelcase_name_tmp_;
   mutable internal::once_flag fields_by_camelcase_name_once_;
-  FieldsByNumberMap fields_by_number_;  // Not including extensions.
-  EnumValuesByNumberMap enum_values_by_number_;
-  mutable EnumValuesByNumberMap unknown_enum_values_by_number_
+  FieldsByNumberSet fields_by_number_;  // Not including extensions.
+  EnumValuesByNumberSet enum_values_by_number_;
+  mutable EnumValuesByNumberSet unknown_enum_values_by_number_
       PROTOBUF_GUARDED_BY(unknown_enum_values_mu_);
 
   // Populated on first request to save space, hence constness games.
@@ -1452,7 +1481,19 @@
 
 inline const FieldDescriptor* FileDescriptorTables::FindFieldByNumber(
     const Descriptor* parent, int number) const {
-  return FindPtrOrNull(fields_by_number_, std::make_pair(parent, number));
+  // If `number` is within the sequential range, just index into the parent
+  // without doing a table lookup.
+  if (parent != nullptr &&  //
+      1 <= number && number <= parent->sequential_field_limit_) {
+    return parent->field(number - 1);
+  }
+
+  Symbol::QueryKey query;
+  query.parent = parent;
+  query.field_number = number;
+
+  auto it = fields_by_number_.find(Symbol(&query));
+  return it == fields_by_number_.end() ? nullptr : it->field_descriptor();
 }
 
 const void* FileDescriptorTables::FindParentForFieldsByMap(
@@ -1474,12 +1515,12 @@
 }
 
 void FileDescriptorTables::FieldsByLowercaseNamesLazyInitInternal() const {
-  for (FieldsByNumberMap::const_iterator it = fields_by_number_.begin();
-       it != fields_by_number_.end(); it++) {
-    PointerStringPair lowercase_key(FindParentForFieldsByMap(it->second),
-                                    it->second->lowercase_name().c_str());
-    InsertIfNotPresent(&fields_by_lowercase_name_, lowercase_key,
-                            it->second);
+  for (Symbol symbol : symbols_by_parent_) {
+    const FieldDescriptor* field = symbol.field_descriptor();
+    if (!field) continue;
+    PointerStringPair lowercase_key(FindParentForFieldsByMap(field),
+                                    field->lowercase_name().c_str());
+    InsertIfNotPresent(&fields_by_lowercase_name_, lowercase_key, field);
   }
 }
 
@@ -1498,12 +1539,12 @@
 }
 
 void FileDescriptorTables::FieldsByCamelcaseNamesLazyInitInternal() const {
-  for (FieldsByNumberMap::const_iterator it = fields_by_number_.begin();
-       it != fields_by_number_.end(); it++) {
-    PointerStringPair camelcase_key(FindParentForFieldsByMap(it->second),
-                                    it->second->camelcase_name().c_str());
-    InsertIfNotPresent(&fields_by_camelcase_name_, camelcase_key,
-                            it->second);
+  for (Symbol symbol : symbols_by_parent_) {
+    const FieldDescriptor* field = symbol.field_descriptor();
+    if (!field) continue;
+    PointerStringPair camelcase_key(FindParentForFieldsByMap(field),
+                                    field->camelcase_name().c_str());
+    InsertIfNotPresent(&fields_by_camelcase_name_, camelcase_key, field);
   }
 }
 
@@ -1518,8 +1559,21 @@
 
 inline const EnumValueDescriptor* FileDescriptorTables::FindEnumValueByNumber(
     const EnumDescriptor* parent, int number) const {
-  return FindPtrOrNull(enum_values_by_number_,
-                            std::make_pair(parent, number));
+  // If `number` is within the sequential range, just index into the parent
+  // without doing a table lookup.
+  const int base = parent->value(0)->number();
+  if (base <= number &&
+      number <= static_cast<int64_t>(base) + parent->sequential_value_limit_) {
+    return parent->value(number - base);
+  }
+
+  Symbol::QueryKey query;
+  query.parent = parent;
+  query.field_number = number;
+
+  auto it = enum_values_by_number_.find(Symbol(&query));
+  return it == enum_values_by_number_.end() ? nullptr
+                                            : it->enum_value_descriptor();
 }
 
 inline const EnumValueDescriptor*
@@ -1527,29 +1581,33 @@
     const EnumDescriptor* parent, int number) const {
   // First try, with map of compiled-in values.
   {
-    const EnumValueDescriptor* desc = FindPtrOrNull(
-        enum_values_by_number_, std::make_pair(parent, number));
-    if (desc != nullptr) {
-      return desc;
+    const auto* value = FindEnumValueByNumber(parent, number);
+    if (value != nullptr) {
+      return value;
     }
   }
+
+  Symbol::QueryKey query;
+  query.parent = parent;
+  query.field_number = number;
+
   // Second try, with reader lock held on unknown enum values: common case.
   {
     ReaderMutexLock l(&unknown_enum_values_mu_);
-    const EnumValueDescriptor* desc = FindPtrOrNull(
-        unknown_enum_values_by_number_, std::make_pair(parent, number));
-    if (desc != nullptr) {
-      return desc;
+    auto it = unknown_enum_values_by_number_.find(Symbol(&query));
+    if (it != unknown_enum_values_by_number_.end() &&
+        it->enum_value_descriptor() != nullptr) {
+      return it->enum_value_descriptor();
     }
   }
   // If not found, try again with writer lock held, and create new descriptor if
   // necessary.
   {
     WriterMutexLock l(&unknown_enum_values_mu_);
-    const EnumValueDescriptor* desc = FindPtrOrNull(
-        unknown_enum_values_by_number_, std::make_pair(parent, number));
-    if (desc != nullptr) {
-      return desc;
+    auto it = unknown_enum_values_by_number_.find(Symbol(&query));
+    if (it != unknown_enum_values_by_number_.end() &&
+        it->enum_value_descriptor() != nullptr) {
+      return it->enum_value_descriptor();
     }
 
     // Create an EnumValueDescriptor dynamically. We don't insert it into the
@@ -1558,17 +1616,21 @@
     // later.
     std::string enum_value_name = StringPrintf("UNKNOWN_ENUM_VALUE_%s_%d",
                                                parent->name().c_str(), number);
-    DescriptorPool::Tables* tables = const_cast<DescriptorPool::Tables*>(
-        DescriptorPool::generated_pool()->tables_.get());
-    EnumValueDescriptor* result = tables->Allocate<EnumValueDescriptor>();
-    result->all_names_ = tables->AllocateStringArray(
-        enum_value_name,
-        StrCat(parent->full_name(), ".", enum_value_name));
+    auto* pool = DescriptorPool::generated_pool();
+    auto* tables = const_cast<DescriptorPool::Tables*>(pool->tables_.get());
+    EnumValueDescriptor* result;
+    {
+      // Must lock the pool because we will do allocations in the shared arena.
+      MutexLockMaybe l2(pool->mutex_);
+      result = tables->Allocate<EnumValueDescriptor>();
+      result->all_names_ = tables->AllocateStringArray(
+          enum_value_name,
+          StrCat(parent->full_name(), ".", enum_value_name));
+    }
     result->number_ = number;
     result->type_ = parent;
     result->options_ = &EnumValueOptions::default_instance();
-    InsertIfNotPresent(&unknown_enum_values_by_number_,
-                            std::make_pair(parent, number), result);
+    unknown_enum_values_by_number_.insert(Symbol::EnumValue(result, 0));
     return result;
   }
 }
@@ -1604,8 +1666,8 @@
 bool FileDescriptorTables::AddAliasUnderParent(const void* parent,
                                                const std::string& name,
                                                Symbol symbol) {
-  GOOGLE_DCHECK_EQ(name, symbol.parent_key().second);
-  GOOGLE_DCHECK_EQ(parent, symbol.parent_key().first);
+  GOOGLE_DCHECK_EQ(name, symbol.parent_name_key().second);
+  GOOGLE_DCHECK_EQ(parent, symbol.parent_name_key().first);
   return symbols_by_parent_.insert(symbol).second;
 }
 
@@ -1652,15 +1714,30 @@
   }
 }
 
-bool FileDescriptorTables::AddFieldByNumber(const FieldDescriptor* field) {
-  DescriptorIntPair key(field->containing_type(), field->number());
-  return InsertIfNotPresent(&fields_by_number_, key, field);
+bool FileDescriptorTables::AddFieldByNumber(FieldDescriptor* field) {
+  // Skip fields that are at the start of the sequence.
+  if (field->containing_type() != nullptr && field->number() >= 1 &&
+      field->number() <= field->containing_type()->sequential_field_limit_) {
+    if (field->is_extension()) {
+      // Conflicts with the field that already exists in the sequential range.
+      return false;
+    }
+    // Only return true if the field at that index matches. Otherwise it
+    // conflicts with the existing field in the sequential range.
+    return field->containing_type()->field(field->number() - 1) == field;
+  }
+
+  return fields_by_number_.insert(Symbol(field)).second;
 }
 
-bool FileDescriptorTables::AddEnumValueByNumber(
-    const EnumValueDescriptor* value) {
-  EnumIntPair key(value->type(), value->number());
-  return InsertIfNotPresent(&enum_values_by_number_, key, value);
+bool FileDescriptorTables::AddEnumValueByNumber(EnumValueDescriptor* value) {
+  // Skip values that are at the start of the sequence.
+  const int base = value->type()->value(0)->number();
+  if (base <= value->number() &&
+      value->number() <=
+          static_cast<int64_t>(base) + value->type()->sequential_value_limit_)
+    return true;
+  return enum_values_by_number_.insert(Symbol::EnumValue(value, 0)).second;
 }
 
 bool DescriptorPool::Tables::AddExtension(const FieldDescriptor* field) {
@@ -1690,6 +1767,13 @@
   return arena_.Create<std::string>(value);
 }
 
+const char* DescriptorPool::Tables::Strdup(StringPiece value) {
+  char* p = AllocateArray<char>(static_cast<int>(value.size() + 1));
+  memcpy(p, value.data(), value.size());
+  p[value.size()] = 0;
+  return p;
+}
+
 template <typename... In>
 const std::string* DescriptorPool::Tables::AllocateStringArray(In&&... values) {
   auto& array = *arena_.Create<std::array<std::string, sizeof...(In)>>();
@@ -1720,7 +1804,7 @@
   const int total_count = 2 + (lower_eq_name ? 0 : 1) +
                           (camel_eq_name ? 0 : 1) +
                           (json_eq_name || json_eq_camel ? 0 : 1);
-  FieldNamesResult result;
+  FieldNamesResult result{nullptr, 0, 0, 0};
   // We use std::array to allow handling of the destruction of the strings.
   switch (total_count) {
     case 2:
@@ -1770,8 +1854,9 @@
   return result;
 }
 
-internal::LazyInitData* DescriptorPool::Tables::AllocateLazyInit() {
-  return arena_.Create<internal::LazyInitData>();
+template <typename Type>
+Type* DescriptorPool::Tables::Create() {
+  return arena_.Create<Type>();
 }
 
 template <typename Type>
@@ -2474,25 +2559,18 @@
   switch (cpp_type()) {
     case CPPTYPE_INT32:
       return StrCat(default_value_int32_t());
-      break;
     case CPPTYPE_INT64:
       return StrCat(default_value_int64_t());
-      break;
     case CPPTYPE_UINT32:
       return StrCat(default_value_uint32_t());
-      break;
     case CPPTYPE_UINT64:
       return StrCat(default_value_uint64_t());
-      break;
     case CPPTYPE_FLOAT:
       return SimpleFtoa(default_value_float());
-      break;
     case CPPTYPE_DOUBLE:
       return SimpleDtoa(default_value_double());
-      break;
     case CPPTYPE_BOOL:
       return default_value_bool() ? "true" : "false";
-      break;
     case CPPTYPE_STRING:
       if (quote_string_type) {
         return "\"" + CEscape(default_value_string()) + "\"";
@@ -2503,10 +2581,8 @@
           return default_value_string();
         }
       }
-      break;
     case CPPTYPE_ENUM:
       return default_value_enum()->name();
-      break;
     case CPPTYPE_MESSAGE:
       GOOGLE_LOG(DFATAL) << "Messages can't have default values!";
       break;
@@ -2826,7 +2902,12 @@
     DynamicMessageFactory factory;
     std::unique_ptr<Message> dynamic_options(
         factory.GetPrototype(option_descriptor)->New());
-    if (dynamic_options->ParseFromString(options.SerializeAsString())) {
+    std::string serialized = options.SerializeAsString();
+    io::CodedInputStream input(
+        reinterpret_cast<const uint8_t*>(serialized.c_str()),
+        serialized.size());
+    input.SetExtensionRegistry(pool, &factory);
+    if (dynamic_options->ParseFromCodedStream(&input)) {
       return RetrieveOptionsAssumingRightPool(depth, *dynamic_options,
                                               option_entries);
     } else {
@@ -4437,6 +4518,8 @@
     // Enums must have at least one value.
     placeholder_enum->value_count_ = 1;
     placeholder_enum->values_ = tables_->AllocateArray<EnumValueDescriptor>(1);
+    // Disable fast-path lookup for this enum.
+    placeholder_enum->sequential_value_limit_ = -1;
 
     EnumValueDescriptor* placeholder_value = &placeholder_enum->values_[0];
     memset(static_cast<void*>(placeholder_value), 0,
@@ -4954,17 +5037,18 @@
     result->dependencies_[i] = dependency;
     if (pool_->lazily_build_dependencies_ && !dependency) {
       if (result->dependencies_once_ == nullptr) {
-        result->dependencies_once_ = tables_->AllocateLazyInit();
-        result->dependencies_once_->file.dependencies_names =
-            tables_->AllocateArray<const std::string*>(proto.dependency_size());
+        result->dependencies_once_ =
+            tables_->Create<FileDescriptor::LazyInitData>();
+        result->dependencies_once_->dependencies_names =
+            tables_->AllocateArray<const char*>(proto.dependency_size());
         if (proto.dependency_size() > 0) {
-          std::fill_n(result->dependencies_once_->file.dependencies_names,
+          std::fill_n(result->dependencies_once_->dependencies_names,
                       proto.dependency_size(), nullptr);
         }
       }
 
-      result->dependencies_once_->file.dependencies_names[i] =
-          tables_->AllocateString(proto.dependency(i));
+      result->dependencies_once_->dependencies_names[i] =
+          tables_->Strdup(proto.dependency(i));
     }
   }
 
@@ -5110,6 +5194,19 @@
     result->well_known_type_ = it->second;
   }
 
+  // Calculate the continuous sequence of fields.
+  // These can be fast-path'd during lookup and don't need to be added to the
+  // tables.
+  // We use uint16_t to save space for sequential_field_limit_, so stop before
+  // overflowing it. Worst case, we are not taking full advantage on huge
+  // messages, but it is unlikely.
+  result->sequential_field_limit_ = 0;
+  for (int i = 0; i < std::numeric_limits<uint16_t>::max() &&
+                  i < proto.field_size() && proto.field(i).number() == i + 1;
+       ++i) {
+    result->sequential_field_limit_ = i + 1;
+  }
+
   // Build oneofs first so that fields and extension ranges can refer to them.
   BUILD_ARRAY(proto, result, oneof_decl, BuildOneof, result);
   BUILD_ARRAY(proto, result, field, BuildField, result);
@@ -5672,6 +5769,21 @@
              "Enums must contain at least one value.");
   }
 
+  // Calculate the continuous sequence of the labels.
+  // These can be fast-path'd during lookup and don't need to be added to the
+  // tables.
+  // We use uint16_t to save space for sequential_value_limit_, so stop before
+  // overflowing it. Worst case, we are not taking full advantage on huge
+  // enums, but it is unlikely.
+  for (int i = 0;
+       i < std::numeric_limits<uint16_t>::max() && i < proto.value_size() &&
+       // We do the math in int64_t to avoid overflows.
+       proto.value(i).number() ==
+           static_cast<int64_t>(i) + proto.value(0).number();
+       ++i) {
+    result->sequential_value_limit_ = i;
+  }
+
   BUILD_ARRAY(proto, result, value, BuildEnumValue, result);
   BUILD_ARRAY(proto, result, reserved_range, BuildReservedRange, result);
 
@@ -5942,11 +6054,23 @@
       }
       // Must go through oneof_decls_ array to get a non-const version of the
       // OneofDescriptor.
-      ++message->oneof_decls_[oneof_decl->index()].field_count_;
+      auto& out_oneof_decl = message->oneof_decls_[oneof_decl->index()];
+      if (out_oneof_decl.field_count_ == 0) {
+        out_oneof_decl.fields_ = message->field(i);
+      }
+
+      if (!had_errors_) {
+        // Verify that they are contiguous.
+        // This is assumed by OneofDescriptor::field(i).
+        // But only if there are no errors.
+        GOOGLE_CHECK_EQ(out_oneof_decl.fields_ + out_oneof_decl.field_count_,
+                 message->field(i));
+      }
+      ++out_oneof_decl.field_count_;
     }
   }
 
-  // Then allocate the arrays.
+  // Then verify the sizes.
   for (int i = 0; i < message->oneof_decl_count(); i++) {
     OneofDescriptor* oneof_decl = &message->oneof_decls_[i];
 
@@ -5956,27 +6080,11 @@
                "Oneof must have at least one field.");
     }
 
-    oneof_decl->fields_ = tables_->AllocateArray<const FieldDescriptor*>(
-        oneof_decl->field_count_);
-    oneof_decl->field_count_ = 0;
-
     if (oneof_decl->options_ == nullptr) {
       oneof_decl->options_ = &OneofOptions::default_instance();
     }
   }
 
-  // Then fill them in.
-  for (int i = 0; i < message->field_count(); i++) {
-    const OneofDescriptor* oneof_decl = message->field(i)->containing_oneof();
-    if (oneof_decl != nullptr) {
-      OneofDescriptor* mutable_oneof_decl =
-          &message->oneof_decls_[oneof_decl->index()];
-      message->fields_[i].index_in_oneof_ = mutable_oneof_decl->field_count_;
-      mutable_oneof_decl->fields_[mutable_oneof_decl->field_count_++] =
-          message->field(i);
-    }
-  }
-
   for (int i = 0; i < message->field_count(); i++) {
     const FieldDescriptor* field = message->field(i);
     if (field->proto3_optional_) {
@@ -6016,7 +6124,7 @@
 
 void DescriptorBuilder::CrossLinkExtensionRange(
     Descriptor::ExtensionRange* range,
-    const DescriptorProto::ExtensionRange& proto) {
+    const DescriptorProto::ExtensionRange& /*proto*/) {
   if (range->options_ == nullptr) {
     range->options_ = &ExtensionRangeOptions::default_instance();
   }
@@ -6107,12 +6215,12 @@
         // Save the symbol names for later for lookup, and allocate the once
         // object needed for the accessors.
         std::string name = proto.type_name();
-        field->type_once_ = tables_->AllocateLazyInit();
-        field->type_once_->field.type_name = tables_->AllocateString(name);
-        if (proto.has_default_value()) {
-          field->type_once_->field.default_value_enum_name =
-              tables_->AllocateString(proto.default_value());
-        }
+        field->type_once_ = tables_->Create<internal::once_flag>();
+        field->type_descriptor_.lazy_type_name = tables_->Strdup(name);
+        field->lazy_default_value_enum_name_ =
+            proto.has_default_value() ? tables_->Strdup(proto.default_value())
+                                      : nullptr;
+
         // AddFieldByNumber and AddExtension are done later in this function,
         // and can/must be done if the field type was not found. The related
         // error checking is not necessary when in lazily_build_dependencies_
@@ -6529,7 +6637,7 @@
 
   const int64_t max_extension_range =
       static_cast<int64_t>(message->options().message_set_wire_format()
-                               ? kint32max
+                               ? std::numeric_limits<int32_t>::max()
                                : FieldDescriptor::kMaxNumber);
   for (int i = 0; i < message->extension_range_count(); ++i) {
     if (message->extension_range(i)->end > max_extension_range + 1) {
@@ -6660,6 +6768,8 @@
 void DescriptorBuilder::ValidateExtensionRangeOptions(
     const std::string& full_name, Descriptor::ExtensionRange* extension_range,
     const DescriptorProto_ExtensionRange& proto) {
+  (void)full_name;        // Parameter is used by Google-internal code.
+  (void)extension_range;  // Parameter is used by Google-internal code.
 }
 
 void DescriptorBuilder::ValidateServiceOptions(
@@ -7319,7 +7429,7 @@
     case FieldDescriptor::CPPTYPE_INT32:
       if (uninterpreted_option_->has_positive_int_value()) {
         if (uninterpreted_option_->positive_int_value() >
-            static_cast<uint64_t>(kint32max)) {
+            static_cast<uint64_t>(std::numeric_limits<int32_t>::max())) {
           return AddValueError("Value out of range for int32 option \"" +
                                option_field->full_name() + "\".");
         } else {
@@ -7329,7 +7439,7 @@
         }
       } else if (uninterpreted_option_->has_negative_int_value()) {
         if (uninterpreted_option_->negative_int_value() <
-            static_cast<int64_t>(kint32min)) {
+            static_cast<int64_t>(std::numeric_limits<int32_t>::min())) {
           return AddValueError("Value out of range for int32 option \"" +
                                option_field->full_name() + "\".");
         } else {
@@ -7346,7 +7456,7 @@
     case FieldDescriptor::CPPTYPE_INT64:
       if (uninterpreted_option_->has_positive_int_value()) {
         if (uninterpreted_option_->positive_int_value() >
-            static_cast<uint64_t>(kint64max)) {
+            static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) {
           return AddValueError("Value out of range for int64 option \"" +
                                option_field->full_name() + "\".");
         } else {
@@ -7366,7 +7476,8 @@
 
     case FieldDescriptor::CPPTYPE_UINT32:
       if (uninterpreted_option_->has_positive_int_value()) {
-        if (uninterpreted_option_->positive_int_value() > kuint32max) {
+        if (uninterpreted_option_->positive_int_value() >
+            std::numeric_limits<uint32_t>::max()) {
           return AddValueError("Value out of range for uint32 option \"" +
                                option_field->name() + "\".");
         } else {
@@ -7536,7 +7647,7 @@
  public:
   DescriptorBuilder* builder_;
 
-  const Descriptor* FindAnyType(const Message& message,
+  const Descriptor* FindAnyType(const Message& /*message*/,
                                 const std::string& prefix,
                                 const std::string& name) const override {
     if (prefix != internal::kTypeGoogleApisComPrefix &&
@@ -7730,6 +7841,7 @@
 
 void DescriptorBuilder::LogUnusedDependency(const FileDescriptorProto& proto,
                                             const FileDescriptor* result) {
+  (void)result;  // Parameter is used by Google-internal code.
 
   if (!unused_dependency_.empty()) {
     auto itr = pool_->unused_import_track_files_.find(proto.name());
@@ -7752,6 +7864,7 @@
 
 Symbol DescriptorPool::CrossLinkOnDemandHelper(StringPiece name,
                                                bool expecting_enum) const {
+  (void)expecting_enum;  // Parameter is used by Google-internal code.
   auto lookup_name = std::string(name);
   if (!lookup_name.empty() && lookup_name[0] == '.') {
     lookup_name = lookup_name.substr(1);
@@ -7767,32 +7880,32 @@
 void FieldDescriptor::InternalTypeOnceInit() const {
   GOOGLE_CHECK(file()->finished_building_ == true);
   const EnumDescriptor* enum_type = nullptr;
-  if (type_once_->field.type_name) {
-    Symbol result = file()->pool()->CrossLinkOnDemandHelper(
-        *type_once_->field.type_name, type_ == FieldDescriptor::TYPE_ENUM);
-    if (result.type() == Symbol::MESSAGE) {
-      type_ = FieldDescriptor::TYPE_MESSAGE;
-      type_descriptor_.message_type = result.descriptor();
-    } else if (result.type() == Symbol::ENUM) {
-      type_ = FieldDescriptor::TYPE_ENUM;
-      enum_type = type_descriptor_.enum_type = result.enum_descriptor();
-    }
+  Symbol result = file()->pool()->CrossLinkOnDemandHelper(
+      type_descriptor_.lazy_type_name, type_ == FieldDescriptor::TYPE_ENUM);
+  if (result.type() == Symbol::MESSAGE) {
+    type_ = FieldDescriptor::TYPE_MESSAGE;
+    type_descriptor_.message_type = result.descriptor();
+  } else if (result.type() == Symbol::ENUM) {
+    type_ = FieldDescriptor::TYPE_ENUM;
+    enum_type = type_descriptor_.enum_type = result.enum_descriptor();
   }
-  if (enum_type && !default_value_enum_) {
-    if (type_once_->field.default_value_enum_name) {
+
+  if (enum_type) {
+    if (lazy_default_value_enum_name_) {
       // Have to build the full name now instead of at CrossLink time,
       // because enum_type may not be known at the time.
       std::string name = enum_type->full_name();
       // Enum values reside in the same scope as the enum type.
       std::string::size_type last_dot = name.find_last_of('.');
       if (last_dot != std::string::npos) {
-        name = name.substr(0, last_dot) + "." +
-               *type_once_->field.default_value_enum_name;
+        name = name.substr(0, last_dot) + "." + lazy_default_value_enum_name_;
       } else {
-        name = *type_once_->field.default_value_enum_name;
+        name = lazy_default_value_enum_name_;
       }
       Symbol result = file()->pool()->CrossLinkOnDemandHelper(name, true);
       default_value_enum_ = result.enum_value_descriptor();
+    } else {
+      default_value_enum_ = nullptr;
     }
     if (!default_value_enum_) {
       // We use the first defined value as the default
@@ -7812,7 +7925,7 @@
 // import building and cross linking of a field of a message.
 const Descriptor* FieldDescriptor::message_type() const {
   if (type_once_) {
-    internal::call_once(type_once_->once, FieldDescriptor::TypeOnceInit, this);
+    internal::call_once(*type_once_, FieldDescriptor::TypeOnceInit, this);
   }
   return type_ == TYPE_MESSAGE || type_ == TYPE_GROUP
              ? type_descriptor_.message_type
@@ -7821,14 +7934,14 @@
 
 const EnumDescriptor* FieldDescriptor::enum_type() const {
   if (type_once_) {
-    internal::call_once(type_once_->once, FieldDescriptor::TypeOnceInit, this);
+    internal::call_once(*type_once_, FieldDescriptor::TypeOnceInit, this);
   }
   return type_ == TYPE_ENUM ? type_descriptor_.enum_type : nullptr;
 }
 
 const EnumValueDescriptor* FieldDescriptor::default_value_enum() const {
   if (type_once_) {
-    internal::call_once(type_once_->once, FieldDescriptor::TypeOnceInit, this);
+    internal::call_once(*type_once_, FieldDescriptor::TypeOnceInit, this);
   }
   return default_value_enum_;
 }
@@ -7844,10 +7957,10 @@
 
 void FileDescriptor::InternalDependenciesOnceInit() const {
   GOOGLE_CHECK(finished_building_ == true);
-  auto* names = dependencies_once_->file.dependencies_names;
+  auto* names = dependencies_once_->dependencies_names;
   for (int i = 0; i < dependency_count(); i++) {
     if (names[i]) {
-      dependencies_[i] = pool_->FindFileByName(*names[i]);
+      dependencies_[i] = pool_->FindFileByName(names[i]);
     }
   }
 }
@@ -7867,11 +7980,11 @@
 }
 
 const Descriptor* MethodDescriptor::input_type() const {
-  return input_type_.Get();
+  return input_type_.Get(service());
 }
 
 const Descriptor* MethodDescriptor::output_type() const {
-  return output_type_.Get();
+  return output_type_.Get(service());
 }
 
 
@@ -7889,31 +8002,21 @@
   GOOGLE_CHECK(file && file->pool_);
   GOOGLE_CHECK(file->pool_->lazily_build_dependencies_);
   GOOGLE_CHECK(!file->finished_building_);
-  once_ = file->pool_->tables_->AllocateLazyInit();
-  once_->descriptor.file = file;
-  once_->descriptor.name = file->pool_->tables_->AllocateString(name);
+  once_ = file->pool_->tables_->Create<internal::once_flag>();
+  lazy_name_ = file->pool_->tables_->Strdup(name);
 }
 
-void LazyDescriptor::Once() {
+void LazyDescriptor::Once(const ServiceDescriptor* service) {
   if (once_) {
-    internal::call_once(once_->once, LazyDescriptor::OnceStatic, this);
+    internal::call_once(*once_, [&] {
+      auto* file = service->file();
+      GOOGLE_CHECK(file->finished_building_);
+      descriptor_ =
+          file->pool_->CrossLinkOnDemandHelper(lazy_name_, false).descriptor();
+    });
   }
 }
 
-void LazyDescriptor::OnceStatic(LazyDescriptor* lazy) { lazy->OnceInternal(); }
-
-void LazyDescriptor::OnceInternal() {
-  auto* file = once_->descriptor.file;
-  auto* name = once_->descriptor.name;
-  GOOGLE_CHECK(file->finished_building_);
-  if (!descriptor_ && name) {
-    auto* descriptor =
-        file->pool_->CrossLinkOnDemandHelper(*name, false).descriptor();
-    if (descriptor != nullptr) {
-      descriptor_ = descriptor;
-    }
-  }
-}
 }  // namespace internal
 
 }  // namespace protobuf
diff --git a/src/google/protobuf/descriptor.h b/src/google/protobuf/descriptor.h
index 67c3f69..e74e355 100644
--- a/src/google/protobuf/descriptor.h
+++ b/src/google/protobuf/descriptor.h
@@ -184,29 +184,6 @@
 // Must be instantiated as mutable in a descriptor.
 namespace internal {
 
-// Data required to do lazy initialization.
-struct PROTOBUF_EXPORT LazyInitData {
-#ifndef SWIG
-  internal::once_flag once;
-#endif
-  struct Field {
-    const std::string* type_name;
-    const std::string* default_value_enum_name;
-  };
-  struct Descriptor {
-    const std::string* name;
-    const FileDescriptor* file;
-  };
-  struct File {
-    const std::string** dependencies_names;
-  };
-  union {
-    Field field;
-    Descriptor descriptor;
-    File file;
-  };
-};
-
 class PROTOBUF_EXPORT LazyDescriptor {
  public:
   // Init function to be called at init time of a descriptor containing
@@ -232,18 +209,19 @@
   // Returns the current value of the descriptor, thread-safe. If SetLazy(...)
   // has been called, will do a one-time cross link of the type specified,
   // building the descriptor file that contains the type if necessary.
-  inline const Descriptor* Get() {
-    Once();
+  inline const Descriptor* Get(const ServiceDescriptor* service) {
+    Once(service);
     return descriptor_;
   }
 
  private:
-  static void OnceStatic(LazyDescriptor* lazy);
-  void OnceInternal();
-  void Once();
+  void Once(const ServiceDescriptor* service);
 
-  const Descriptor* descriptor_;
-  LazyInitData* once_;
+  union {
+    const Descriptor* descriptor_;
+    const char* lazy_name_;
+  };
+  internal::once_flag* once_;
 };
 
 class PROTOBUF_EXPORT SymbolBase {
@@ -564,8 +542,18 @@
   bool is_placeholder_ : 1;
   // True if this is a placeholder and the type name wasn't fully-qualified.
   bool is_unqualified_placeholder_ : 1;
-  // Well known type.  Stored as char to conserve space.
-  char well_known_type_;
+  // Well known type.  Stored like this to conserve space.
+  uint8_t well_known_type_ : 5;
+
+  // This points to the last field _number_ that is part of the sequence
+  // starting at 1, where
+  //     `desc->field(i)->number() == i + 1`
+  // A value of `0` means no field matches. That is, there are no fields or the
+  // first field is not field `1`.
+  // Uses 16-bit to avoid extra padding. Unlikely to have more than 2^16
+  // sequentially numbered fields in a message.
+  uint16_t sequential_field_limit_;
+
   int field_count_;
 
   // all_names_ = [name, full_name]
@@ -603,6 +591,7 @@
   friend class DescriptorPool;
   friend class EnumDescriptor;
   friend class FieldDescriptor;
+  friend class FileDescriptorTables;
   friend class OneofDescriptor;
   friend class MethodDescriptor;
   friend class FileDescriptor;
@@ -905,19 +894,19 @@
   // Returns true if this is a map message type.
   bool is_map_message_type() const;
 
-  bool has_default_value_;
-  bool proto3_optional_;
+  bool has_default_value_ : 1;
+  bool proto3_optional_ : 1;
   // Whether the user has specified the json_name field option in the .proto
   // file.
-  bool has_json_name_;
-  bool is_extension_;
+  bool has_json_name_ : 1;
+  bool is_extension_ : 1;
+  bool is_oneof_ : 1;
+
+  // Actually a `Label` but stored as uint8_t to save space.
+  uint8_t label_ : 2;
 
   // Actually a `Type`, but stored as uint8_t to save space.
   mutable uint8_t type_;
-  // Actually a `Label` but stored as uint8_t to save space.
-  uint8_t label_;
-
-  bool is_oneof_ : 1;
 
   // Logically:
   //   all_names_ = [name, full_name, lower, camel, json]
@@ -929,14 +918,15 @@
   uint8_t lowercase_name_index_ : 2;
   uint8_t camelcase_name_index_ : 2;
   uint8_t json_name_index_ : 3;
+  // Sadly, `number_` located here to reduce padding. Unrelated to all_names_
+  // and its indices above.
+  int number_;
   const std::string* all_names_;
   const FileDescriptor* file_;
 
-  internal::LazyInitData* type_once_;
+  internal::once_flag* type_once_;
   static void TypeOnceInit(const FieldDescriptor* to_init);
   void InternalTypeOnceInit() const;
-  int number_;
-  int index_in_oneof_;
   const Descriptor* containing_type_;
   union {
     const OneofDescriptor* containing_oneof;
@@ -945,6 +935,7 @@
   union {
     mutable const Descriptor* message_type;
     mutable const EnumDescriptor* enum_type;
+    const char* lazy_type_name;
   } type_descriptor_;
   const FieldOptions* options_;
   // IMPORTANT:  If you add a new field, make sure to search for all instances
@@ -961,6 +952,7 @@
     bool default_value_bool_;
 
     mutable const EnumValueDescriptor* default_value_enum_;
+    const char* lazy_default_value_enum_name_;
     const std::string* default_value_string_;
     mutable std::atomic<const Message*> default_generated_instance_;
   };
@@ -1048,8 +1040,8 @@
   // all_names_ = [name, full_name]
   const std::string* all_names_;
   const Descriptor* containing_type_;
-  const FieldDescriptor** fields_;
   const OneofOptions* options_;
+  const FieldDescriptor* fields_;
 
   // IMPORTANT:  If you add a new field, make sure to search for all instances
   // of Allocate<OneofDescriptor>() and AllocateArray<OneofDescriptor>()
@@ -1164,6 +1156,9 @@
   friend class io::Printer;
   friend class compiler::cpp::Formatter;
 
+  // Allow access to FindValueByNumberCreatingIfUnknown.
+  friend class descriptor_unittest::DescriptorTest;
+
   // Looks up a value by number.  If the value does not exist, dynamically
   // creates a new EnumValueDescriptor for that value, assuming that it was
   // unknown. If a new descriptor is created, this is done in a thread-safe way,
@@ -1184,9 +1179,18 @@
   void GetLocationPath(std::vector<int>* output) const;
 
   // True if this is a placeholder for an unknown type.
-  bool is_placeholder_;
+  bool is_placeholder_ : 1;
   // True if this is a placeholder and the type name wasn't fully-qualified.
-  bool is_unqualified_placeholder_;
+  bool is_unqualified_placeholder_ : 1;
+
+  // This points to the last value _index_ that is part of the sequence starting
+  // with the first label, where
+  //   `enum->value(i)->number() == enum->value(0)->number() + i`
+  // We measure relative to the first label to adapt to enum labels starting at
+  // 0 or 1.
+  // Uses 16-bit to avoid extra padding. Unlikely to have more than 2^15
+  // sequentially numbered labels in an enum.
+  int16_t sequential_value_limit_;
 
   int value_count_;
 
@@ -1211,6 +1215,7 @@
   friend class DescriptorBuilder;
   friend class Descriptor;
   friend class FieldDescriptor;
+  friend class FileDescriptorTables;
   friend class EnumValueDescriptor;
   friend class FileDescriptor;
   friend class DescriptorPool;
@@ -1615,7 +1620,16 @@
   const std::string* name_;
   const std::string* package_;
   const DescriptorPool* pool_;
-  internal::LazyInitData* dependencies_once_;
+
+  // Data required to do lazy initialization.
+  struct PROTOBUF_EXPORT LazyInitData {
+#ifndef SWIG
+    internal::once_flag once;
+#endif
+    const char** dependencies_names;
+  };
+
+  LazyInitData* dependencies_once_;
   static void DependenciesOnceInit(const FileDescriptor* to_init);
   void InternalDependenciesOnceInit() const;
 
@@ -2096,7 +2110,6 @@
 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, number, int)
 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, is_extension, bool)
 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, containing_type, const Descriptor*)
-PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, index_in_oneof, int)
 PROTOBUF_DEFINE_OPTIONS_ACCESSOR(FieldDescriptor, FieldOptions)
 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_default_value, bool)
 PROTOBUF_DEFINE_ACCESSOR(FieldDescriptor, has_json_name, bool)
@@ -2112,6 +2125,7 @@
 PROTOBUF_DEFINE_NAME_ACCESSOR(OneofDescriptor)
 PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, containing_type, const Descriptor*)
 PROTOBUF_DEFINE_ACCESSOR(OneofDescriptor, field_count, int)
+PROTOBUF_DEFINE_ARRAY_ACCESSOR(OneofDescriptor, field, const FieldDescriptor*)
 PROTOBUF_DEFINE_OPTIONS_ACCESSOR(OneofDescriptor, OneofOptions)
 
 PROTOBUF_DEFINE_NAME_ACCESSOR(EnumDescriptor)
@@ -2233,6 +2247,11 @@
   return is_oneof_ ? scope_.containing_oneof : nullptr;
 }
 
+inline int FieldDescriptor::index_in_oneof() const {
+  GOOGLE_DCHECK(is_oneof_);
+  return static_cast<int>(this - scope_.containing_oneof->field(0));
+}
+
 inline const Descriptor* FieldDescriptor::extension_scope() const {
   GOOGLE_CHECK(is_extension_);
   return scope_.extension_scope;
@@ -2244,7 +2263,7 @@
 
 inline FieldDescriptor::Type FieldDescriptor::type() const {
   if (type_once_) {
-    internal::call_once(type_once_->once, &FieldDescriptor::TypeOnceInit, this);
+    internal::call_once(*type_once_, &FieldDescriptor::TypeOnceInit, this);
   }
   return static_cast<Type>(type_);
 }
@@ -2390,12 +2409,6 @@
   return static_cast<Syntax>(syntax_);
 }
 
-// Can't use PROTOBUF_DEFINE_ARRAY_ACCESSOR because fields_ is actually an array
-// of pointers rather than the usual array of objects.
-inline const FieldDescriptor* OneofDescriptor::field(int index) const {
-  return fields_[index];
-}
-
 }  // namespace protobuf
 }  // namespace google
 
diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc
index ef67494..5229e77 100644
--- a/src/google/protobuf/descriptor.pb.cc
+++ b/src/google/protobuf/descriptor.pb.cc
@@ -453,7 +453,7 @@
 static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[6];
 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fdescriptor_2eproto = nullptr;
 
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fdescriptor_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   ~0u,  // no _has_bits_
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FileDescriptorSet, _internal_metadata_),
   ~0u,  // no _extensions_
@@ -1120,7 +1120,7 @@
   }
 }
 
-#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_DOUBLE;
 constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_FLOAT;
 constexpr FieldDescriptorProto_Type FieldDescriptorProto::TYPE_INT64;
@@ -1142,7 +1142,7 @@
 constexpr FieldDescriptorProto_Type FieldDescriptorProto::Type_MIN;
 constexpr FieldDescriptorProto_Type FieldDescriptorProto::Type_MAX;
 constexpr int FieldDescriptorProto::Type_ARRAYSIZE;
-#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FieldDescriptorProto_Label_descriptor() {
   ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto);
   return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[1];
@@ -1158,14 +1158,14 @@
   }
 }
 
-#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_OPTIONAL;
 constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REQUIRED;
 constexpr FieldDescriptorProto_Label FieldDescriptorProto::LABEL_REPEATED;
 constexpr FieldDescriptorProto_Label FieldDescriptorProto::Label_MIN;
 constexpr FieldDescriptorProto_Label FieldDescriptorProto::Label_MAX;
 constexpr int FieldDescriptorProto::Label_ARRAYSIZE;
-#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FileOptions_OptimizeMode_descriptor() {
   ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto);
   return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[2];
@@ -1181,14 +1181,14 @@
   }
 }
 
-#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 constexpr FileOptions_OptimizeMode FileOptions::SPEED;
 constexpr FileOptions_OptimizeMode FileOptions::CODE_SIZE;
 constexpr FileOptions_OptimizeMode FileOptions::LITE_RUNTIME;
 constexpr FileOptions_OptimizeMode FileOptions::OptimizeMode_MIN;
 constexpr FileOptions_OptimizeMode FileOptions::OptimizeMode_MAX;
 constexpr int FileOptions::OptimizeMode_ARRAYSIZE;
-#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FieldOptions_CType_descriptor() {
   ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto);
   return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[3];
@@ -1204,14 +1204,14 @@
   }
 }
 
-#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 constexpr FieldOptions_CType FieldOptions::STRING;
 constexpr FieldOptions_CType FieldOptions::CORD;
 constexpr FieldOptions_CType FieldOptions::STRING_PIECE;
 constexpr FieldOptions_CType FieldOptions::CType_MIN;
 constexpr FieldOptions_CType FieldOptions::CType_MAX;
 constexpr int FieldOptions::CType_ARRAYSIZE;
-#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FieldOptions_JSType_descriptor() {
   ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto);
   return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[4];
@@ -1227,14 +1227,14 @@
   }
 }
 
-#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 constexpr FieldOptions_JSType FieldOptions::JS_NORMAL;
 constexpr FieldOptions_JSType FieldOptions::JS_STRING;
 constexpr FieldOptions_JSType FieldOptions::JS_NUMBER;
 constexpr FieldOptions_JSType FieldOptions::JSType_MIN;
 constexpr FieldOptions_JSType FieldOptions::JSType_MAX;
 constexpr int FieldOptions::JSType_ARRAYSIZE;
-#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* MethodOptions_IdempotencyLevel_descriptor() {
   ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2fdescriptor_2eproto);
   return file_level_enum_descriptors_google_2fprotobuf_2fdescriptor_2eproto[5];
@@ -1250,14 +1250,14 @@
   }
 }
 
-#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 constexpr MethodOptions_IdempotencyLevel MethodOptions::IDEMPOTENCY_UNKNOWN;
 constexpr MethodOptions_IdempotencyLevel MethodOptions::NO_SIDE_EFFECTS;
 constexpr MethodOptions_IdempotencyLevel MethodOptions::IDEMPOTENT;
 constexpr MethodOptions_IdempotencyLevel MethodOptions::IdempotencyLevel_MIN;
 constexpr MethodOptions_IdempotencyLevel MethodOptions::IdempotencyLevel_MAX;
 constexpr int MethodOptions::IdempotencyLevel_ARRAYSIZE;
-#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 
 // ===================================================================
 
@@ -1282,7 +1282,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorSet)
 }
 
-void FileDescriptorSet::SharedCtor() {
+inline void FileDescriptorSet::SharedCtor() {
 }
 
 FileDescriptorSet::~FileDescriptorSet() {
@@ -1308,7 +1308,7 @@
 
 void FileDescriptorSet::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorSet)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1319,12 +1319,12 @@
 const char* FileDescriptorSet::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // repeated .google.protobuf.FileDescriptorProto file = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -1358,10 +1358,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* FileDescriptorSet::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* FileDescriptorSet::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileDescriptorSet)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // repeated .google.protobuf.FileDescriptorProto file = 1;
@@ -1384,7 +1384,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileDescriptorSet)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1414,7 +1414,7 @@
 void FileDescriptorSet::MergeFrom(const FileDescriptorSet& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileDescriptorSet)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   file_.MergeFrom(from.file_);
@@ -1429,7 +1429,8 @@
 }
 
 bool FileDescriptorSet::IsInitialized() const {
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(file_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(file_))
+    return false;
   return true;
 }
 
@@ -1505,16 +1506,25 @@
       weak_dependency_(from.weak_dependency_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_name()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
   }
   package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_package()) {
     package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_package(), 
       GetArenaForAllocation());
   }
   syntax_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_syntax()) {
     syntax_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_syntax(), 
       GetArenaForAllocation());
@@ -1532,10 +1542,19 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.FileDescriptorProto)
 }
 
-void FileDescriptorProto::SharedCtor() {
+inline void FileDescriptorProto::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 syntax_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&source_code_info_) -
@@ -1570,7 +1589,7 @@
 
 void FileDescriptorProto::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.FileDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1609,12 +1628,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -1626,7 +1645,7 @@
         continue;
       // optional string package = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           auto str = _internal_mutable_package();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -1638,7 +1657,7 @@
         continue;
       // repeated string dependency = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -1655,7 +1674,7 @@
         continue;
       // repeated .google.protobuf.DescriptorProto message_type = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -1668,7 +1687,7 @@
         continue;
       // repeated .google.protobuf.EnumDescriptorProto enum_type = 5;
       case 5:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -1681,7 +1700,7 @@
         continue;
       // repeated .google.protobuf.ServiceDescriptorProto service = 6;
       case 6:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -1694,7 +1713,7 @@
         continue;
       // repeated .google.protobuf.FieldDescriptorProto extension = 7;
       case 7:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -1707,7 +1726,7 @@
         continue;
       // optional .google.protobuf.FileOptions options = 8;
       case 8:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) {
           ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
           CHK_(ptr);
         } else
@@ -1715,7 +1734,7 @@
         continue;
       // optional .google.protobuf.SourceCodeInfo source_code_info = 9;
       case 9:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 74)) {
           ptr = ctx->ParseMessage(_internal_mutable_source_code_info(), ptr);
           CHK_(ptr);
         } else
@@ -1723,15 +1742,15 @@
         continue;
       // repeated int32 public_dependency = 10;
       case 10:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) {
           ptr -= 1;
           do {
             ptr += 1;
-            _internal_add_public_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
+            _internal_add_public_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
             CHK_(ptr);
             if (!ctx->DataAvailable(ptr)) break;
           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<80>(ptr));
-        } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82) {
+        } else if (static_cast<uint8_t>(tag) == 82) {
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_public_dependency(), ptr, ctx);
           CHK_(ptr);
         } else
@@ -1739,15 +1758,15 @@
         continue;
       // repeated int32 weak_dependency = 11;
       case 11:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 88)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 88)) {
           ptr -= 1;
           do {
             ptr += 1;
-            _internal_add_weak_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
+            _internal_add_weak_dependency(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
             CHK_(ptr);
             if (!ctx->DataAvailable(ptr)) break;
           } while (::PROTOBUF_NAMESPACE_ID::internal::ExpectTag<88>(ptr));
-        } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90) {
+        } else if (static_cast<uint8_t>(tag) == 90) {
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_weak_dependency(), ptr, ctx);
           CHK_(ptr);
         } else
@@ -1755,7 +1774,7 @@
         continue;
       // optional string syntax = 12;
       case 12:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 98)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 98)) {
           auto str = _internal_mutable_syntax();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -1789,10 +1808,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* FileDescriptorProto::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* FileDescriptorProto::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -1908,7 +1927,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FileDescriptorProto)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -2023,7 +2042,7 @@
 void FileDescriptorProto::MergeFrom(const FileDescriptorProto& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileDescriptorProto)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   dependency_.MergeFrom(from.dependency_);
@@ -2062,10 +2081,14 @@
 }
 
 bool FileDescriptorProto::IsInitialized() const {
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(message_type_)) return false;
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(enum_type_)) return false;
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(service_)) return false;
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(extension_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(message_type_))
+    return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(enum_type_))
+    return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(service_))
+    return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(extension_))
+    return false;
   if (_internal_has_options()) {
     if (!options_->IsInitialized()) return false;
   }
@@ -2159,7 +2182,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ExtensionRange)
 }
 
-void DescriptorProto_ExtensionRange::SharedCtor() {
+inline void DescriptorProto_ExtensionRange::SharedCtor() {
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&end_) -
@@ -2190,7 +2213,7 @@
 
 void DescriptorProto_ExtensionRange::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ExtensionRange)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -2212,30 +2235,30 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional int32 start = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           _Internal::set_has_start(&has_bits);
-          start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional int32 end = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
           _Internal::set_has_end(&has_bits);
-          end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional .google.protobuf.ExtensionRangeOptions options = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
           CHK_(ptr);
         } else
@@ -2265,10 +2288,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* DescriptorProto_ExtensionRange::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* DescriptorProto_ExtensionRange::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto.ExtensionRange)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -2304,7 +2327,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto.ExtensionRange)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -2347,7 +2370,7 @@
 void DescriptorProto_ExtensionRange::MergeFrom(const DescriptorProto_ExtensionRange& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto.ExtensionRange)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = from._has_bits_[0];
@@ -2430,7 +2453,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto.ReservedRange)
 }
 
-void DescriptorProto_ReservedRange::SharedCtor() {
+inline void DescriptorProto_ReservedRange::SharedCtor() {
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&start_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&end_) -
@@ -2460,7 +2483,7 @@
 
 void DescriptorProto_ReservedRange::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto.ReservedRange)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -2478,23 +2501,23 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional int32 start = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           _Internal::set_has_start(&has_bits);
-          start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional int32 end = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
           _Internal::set_has_end(&has_bits);
-          end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
@@ -2523,10 +2546,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* DescriptorProto_ReservedRange::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* DescriptorProto_ReservedRange::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto.ReservedRange)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -2554,7 +2577,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto.ReservedRange)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -2590,7 +2613,7 @@
 void DescriptorProto_ReservedRange::MergeFrom(const DescriptorProto_ReservedRange& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto.ReservedRange)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = from._has_bits_[0];
@@ -2683,6 +2706,9 @@
       reserved_name_(from.reserved_name_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_name()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
@@ -2695,8 +2721,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.DescriptorProto)
 }
 
-void DescriptorProto::SharedCtor() {
+inline void DescriptorProto::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 options_ = nullptr;
 }
 
@@ -2725,7 +2754,7 @@
 
 void DescriptorProto::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.DescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -2755,12 +2784,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -2772,7 +2801,7 @@
         continue;
       // repeated .google.protobuf.FieldDescriptorProto field = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -2785,7 +2814,7 @@
         continue;
       // repeated .google.protobuf.DescriptorProto nested_type = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -2798,7 +2827,7 @@
         continue;
       // repeated .google.protobuf.EnumDescriptorProto enum_type = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -2811,7 +2840,7 @@
         continue;
       // repeated .google.protobuf.DescriptorProto.ExtensionRange extension_range = 5;
       case 5:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -2824,7 +2853,7 @@
         continue;
       // repeated .google.protobuf.FieldDescriptorProto extension = 6;
       case 6:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -2837,7 +2866,7 @@
         continue;
       // optional .google.protobuf.MessageOptions options = 7;
       case 7:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
           CHK_(ptr);
         } else
@@ -2845,7 +2874,7 @@
         continue;
       // repeated .google.protobuf.OneofDescriptorProto oneof_decl = 8;
       case 8:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -2858,7 +2887,7 @@
         continue;
       // repeated .google.protobuf.DescriptorProto.ReservedRange reserved_range = 9;
       case 9:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 74)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -2871,7 +2900,7 @@
         continue;
       // repeated string reserved_name = 10;
       case 10:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 82)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -2910,10 +2939,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* DescriptorProto::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* DescriptorProto::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -3013,7 +3042,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DescriptorProto)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -3110,7 +3139,7 @@
 void DescriptorProto::MergeFrom(const DescriptorProto& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DescriptorProto)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   field_.MergeFrom(from.field_);
@@ -3141,12 +3170,18 @@
 }
 
 bool DescriptorProto::IsInitialized() const {
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(field_)) return false;
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(nested_type_)) return false;
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(enum_type_)) return false;
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(extension_range_)) return false;
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(extension_)) return false;
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(oneof_decl_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(field_))
+    return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(nested_type_))
+    return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(enum_type_))
+    return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(extension_range_))
+    return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(extension_))
+    return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(oneof_decl_))
+    return false;
   if (_internal_has_options()) {
     if (!options_->IsInitialized()) return false;
   }
@@ -3202,11 +3237,11 @@
   : ::PROTOBUF_NAMESPACE_ID::Message(),
       uninterpreted_option_(from.uninterpreted_option_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   // @@protoc_insertion_point(copy_constructor:google.protobuf.ExtensionRangeOptions)
 }
 
-void ExtensionRangeOptions::SharedCtor() {
+inline void ExtensionRangeOptions::SharedCtor() {
 }
 
 ExtensionRangeOptions::~ExtensionRangeOptions() {
@@ -3232,7 +3267,7 @@
 
 void ExtensionRangeOptions::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.ExtensionRangeOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -3244,12 +3279,12 @@
 const char* ExtensionRangeOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
       case 999:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           ptr -= 2;
           do {
             ptr += 2;
@@ -3288,10 +3323,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* ExtensionRangeOptions::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* ExtensionRangeOptions::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ExtensionRangeOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
@@ -3320,7 +3355,7 @@
 
   total_size += _extensions_.ByteSize();
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -3350,11 +3385,11 @@
 void ExtensionRangeOptions::MergeFrom(const ExtensionRangeOptions& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ExtensionRangeOptions)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
 }
 
@@ -3370,7 +3405,8 @@
     return false;
   }
 
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_))
+    return false;
   return true;
 }
 
@@ -3446,26 +3482,41 @@
       _has_bits_(from._has_bits_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_name()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
   }
   extendee_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_extendee()) {
     extendee_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_extendee(), 
       GetArenaForAllocation());
   }
   type_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_type_name()) {
     type_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_name(), 
       GetArenaForAllocation());
   }
   default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_default_value()) {
     default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_default_value(), 
       GetArenaForAllocation());
   }
   json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_json_name()) {
     json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_json_name(), 
       GetArenaForAllocation());
@@ -3481,12 +3532,27 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldDescriptorProto)
 }
 
-void FieldDescriptorProto::SharedCtor() {
+inline void FieldDescriptorProto::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 extendee_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 type_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&proto3_optional_) -
@@ -3524,7 +3590,7 @@
 
 void FieldDescriptorProto::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -3568,12 +3634,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -3585,7 +3651,7 @@
         continue;
       // optional string extendee = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           auto str = _internal_mutable_extendee();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -3597,17 +3663,17 @@
         continue;
       // optional int32 number = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
           _Internal::set_has_number(&has_bits);
-          number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional .google.protobuf.FieldDescriptorProto.Label label = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label_IsValid(val))) {
             _internal_set_label(static_cast<::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Label>(val));
@@ -3619,8 +3685,8 @@
         continue;
       // optional .google.protobuf.FieldDescriptorProto.Type type = 5;
       case 5:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type_IsValid(val))) {
             _internal_set_type(static_cast<::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto_Type>(val));
@@ -3632,7 +3698,7 @@
         continue;
       // optional string type_name = 6;
       case 6:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
           auto str = _internal_mutable_type_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -3644,7 +3710,7 @@
         continue;
       // optional string default_value = 7;
       case 7:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           auto str = _internal_mutable_default_value();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -3656,7 +3722,7 @@
         continue;
       // optional .google.protobuf.FieldOptions options = 8;
       case 8:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) {
           ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
           CHK_(ptr);
         } else
@@ -3664,16 +3730,16 @@
         continue;
       // optional int32 oneof_index = 9;
       case 9:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 72)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 72)) {
           _Internal::set_has_oneof_index(&has_bits);
-          oneof_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          oneof_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional string json_name = 10;
       case 10:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 82)) {
           auto str = _internal_mutable_json_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -3685,7 +3751,7 @@
         continue;
       // optional bool proto3_optional = 17;
       case 17:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 136)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 136)) {
           _Internal::set_has_proto3_optional(&has_bits);
           proto3_optional_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -3716,10 +3782,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* FieldDescriptorProto::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* FieldDescriptorProto::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -3825,7 +3891,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldDescriptorProto)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -3922,7 +3988,7 @@
 void FieldDescriptorProto::MergeFrom(const FieldDescriptorProto& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldDescriptorProto)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = from._has_bits_[0];
@@ -4061,6 +4127,9 @@
       _has_bits_(from._has_bits_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_name()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
@@ -4073,8 +4142,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.OneofDescriptorProto)
 }
 
-void OneofDescriptorProto::SharedCtor() {
+inline void OneofDescriptorProto::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 options_ = nullptr;
 }
 
@@ -4103,7 +4175,7 @@
 
 void OneofDescriptorProto::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.OneofDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -4125,12 +4197,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -4142,7 +4214,7 @@
         continue;
       // optional .google.protobuf.OneofOptions options = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
           CHK_(ptr);
         } else
@@ -4172,10 +4244,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* OneofDescriptorProto::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* OneofDescriptorProto::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -4209,7 +4281,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.OneofDescriptorProto)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -4249,7 +4321,7 @@
 void OneofDescriptorProto::MergeFrom(const OneofDescriptorProto& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.OneofDescriptorProto)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = from._has_bits_[0];
@@ -4330,7 +4402,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto.EnumReservedRange)
 }
 
-void EnumDescriptorProto_EnumReservedRange::SharedCtor() {
+inline void EnumDescriptorProto_EnumReservedRange::SharedCtor() {
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&start_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&end_) -
@@ -4360,7 +4432,7 @@
 
 void EnumDescriptorProto_EnumReservedRange::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -4378,23 +4450,23 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional int32 start = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           _Internal::set_has_start(&has_bits);
-          start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          start_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional int32 end = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
           _Internal::set_has_end(&has_bits);
-          end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
@@ -4423,10 +4495,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* EnumDescriptorProto_EnumReservedRange::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* EnumDescriptorProto_EnumReservedRange::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -4454,7 +4526,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -4490,7 +4562,7 @@
 void EnumDescriptorProto_EnumReservedRange::MergeFrom(const EnumDescriptorProto_EnumReservedRange& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumDescriptorProto.EnumReservedRange)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = from._has_bits_[0];
@@ -4573,6 +4645,9 @@
       reserved_name_(from.reserved_name_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_name()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
@@ -4585,8 +4660,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumDescriptorProto)
 }
 
-void EnumDescriptorProto::SharedCtor() {
+inline void EnumDescriptorProto::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 options_ = nullptr;
 }
 
@@ -4615,7 +4693,7 @@
 
 void EnumDescriptorProto::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -4640,12 +4718,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -4657,7 +4735,7 @@
         continue;
       // repeated .google.protobuf.EnumValueDescriptorProto value = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -4670,7 +4748,7 @@
         continue;
       // optional .google.protobuf.EnumOptions options = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
           CHK_(ptr);
         } else
@@ -4678,7 +4756,7 @@
         continue;
       // repeated .google.protobuf.EnumDescriptorProto.EnumReservedRange reserved_range = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -4691,7 +4769,7 @@
         continue;
       // repeated string reserved_name = 5;
       case 5:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -4730,10 +4808,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* EnumDescriptorProto::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* EnumDescriptorProto::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -4793,7 +4871,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumDescriptorProto)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -4855,7 +4933,7 @@
 void EnumDescriptorProto::MergeFrom(const EnumDescriptorProto& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumDescriptorProto)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   value_.MergeFrom(from.value_);
@@ -4881,7 +4959,8 @@
 }
 
 bool EnumDescriptorProto::IsInitialized() const {
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(value_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(value_))
+    return false;
   if (_internal_has_options()) {
     if (!options_->IsInitialized()) return false;
   }
@@ -4946,6 +5025,9 @@
       _has_bits_(from._has_bits_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_name()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
@@ -4959,8 +5041,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueDescriptorProto)
 }
 
-void EnumValueDescriptorProto::SharedCtor() {
+inline void EnumValueDescriptorProto::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&number_) -
@@ -4992,7 +5077,7 @@
 
 void EnumValueDescriptorProto::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -5015,12 +5100,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -5032,16 +5117,16 @@
         continue;
       // optional int32 number = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
           _Internal::set_has_number(&has_bits);
-          number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional .google.protobuf.EnumValueOptions options = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
           CHK_(ptr);
         } else
@@ -5071,10 +5156,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* EnumValueDescriptorProto::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* EnumValueDescriptorProto::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValueDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -5114,7 +5199,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValueDescriptorProto)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -5159,7 +5244,7 @@
 void EnumValueDescriptorProto::MergeFrom(const EnumValueDescriptorProto& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValueDescriptorProto)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = from._has_bits_[0];
@@ -5251,6 +5336,9 @@
       method_(from.method_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_name()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
@@ -5263,8 +5351,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceDescriptorProto)
 }
 
-void ServiceDescriptorProto::SharedCtor() {
+inline void ServiceDescriptorProto::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 options_ = nullptr;
 }
 
@@ -5293,7 +5384,7 @@
 
 void ServiceDescriptorProto::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -5316,12 +5407,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -5333,7 +5424,7 @@
         continue;
       // repeated .google.protobuf.MethodDescriptorProto method = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -5346,7 +5437,7 @@
         continue;
       // optional .google.protobuf.ServiceOptions options = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
           CHK_(ptr);
         } else
@@ -5376,10 +5467,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* ServiceDescriptorProto::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* ServiceDescriptorProto::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ServiceDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -5421,7 +5512,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ServiceDescriptorProto)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -5468,7 +5559,7 @@
 void ServiceDescriptorProto::MergeFrom(const ServiceDescriptorProto& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ServiceDescriptorProto)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   method_.MergeFrom(from.method_);
@@ -5492,7 +5583,8 @@
 }
 
 bool ServiceDescriptorProto::IsInitialized() const {
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(method_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(method_))
+    return false;
   if (_internal_has_options()) {
     if (!options_->IsInitialized()) return false;
   }
@@ -5564,16 +5656,25 @@
       _has_bits_(from._has_bits_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_name()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
   }
   input_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_input_type()) {
     input_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_input_type(), 
       GetArenaForAllocation());
   }
   output_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_output_type()) {
     output_type_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_output_type(), 
       GetArenaForAllocation());
@@ -5589,10 +5690,19 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodDescriptorProto)
 }
 
-void MethodDescriptorProto::SharedCtor() {
+inline void MethodDescriptorProto::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 input_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 output_type_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&options_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&server_streaming_) -
@@ -5626,7 +5736,7 @@
 
 void MethodDescriptorProto::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.MethodDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -5657,12 +5767,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -5674,7 +5784,7 @@
         continue;
       // optional string input_type = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           auto str = _internal_mutable_input_type();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -5686,7 +5796,7 @@
         continue;
       // optional string output_type = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           auto str = _internal_mutable_output_type();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -5698,7 +5808,7 @@
         continue;
       // optional .google.protobuf.MethodOptions options = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
           ptr = ctx->ParseMessage(_internal_mutable_options(), ptr);
           CHK_(ptr);
         } else
@@ -5706,7 +5816,7 @@
         continue;
       // optional bool client_streaming = 5 [default = false];
       case 5:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
           _Internal::set_has_client_streaming(&has_bits);
           client_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -5715,7 +5825,7 @@
         continue;
       // optional bool server_streaming = 6 [default = false];
       case 6:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 48)) {
           _Internal::set_has_server_streaming(&has_bits);
           server_streaming_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -5746,10 +5856,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* MethodDescriptorProto::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* MethodDescriptorProto::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MethodDescriptorProto)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -5815,7 +5925,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.MethodDescriptorProto)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -5879,7 +5989,7 @@
 void MethodDescriptorProto::MergeFrom(const MethodDescriptorProto& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MethodDescriptorProto)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = from._has_bits_[0];
@@ -6039,53 +6149,83 @@
       _has_bits_(from._has_bits_),
       uninterpreted_option_(from.uninterpreted_option_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   java_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_java_package()) {
     java_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_java_package(), 
       GetArenaForAllocation());
   }
   java_outer_classname_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_java_outer_classname()) {
     java_outer_classname_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_java_outer_classname(), 
       GetArenaForAllocation());
   }
   go_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_go_package()) {
     go_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_go_package(), 
       GetArenaForAllocation());
   }
   objc_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_objc_class_prefix()) {
     objc_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_objc_class_prefix(), 
       GetArenaForAllocation());
   }
   csharp_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_csharp_namespace()) {
     csharp_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_csharp_namespace(), 
       GetArenaForAllocation());
   }
   swift_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_swift_prefix()) {
     swift_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_swift_prefix(), 
       GetArenaForAllocation());
   }
   php_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_php_class_prefix()) {
     php_class_prefix_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_class_prefix(), 
       GetArenaForAllocation());
   }
   php_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_php_namespace()) {
     php_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_namespace(), 
       GetArenaForAllocation());
   }
   php_metadata_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_php_metadata_namespace()) {
     php_metadata_namespace_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_php_metadata_namespace(), 
       GetArenaForAllocation());
   }
   ruby_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_ruby_package()) {
     ruby_package_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_ruby_package(), 
       GetArenaForAllocation());
@@ -6096,17 +6236,47 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.FileOptions)
 }
 
-void FileOptions::SharedCtor() {
+inline void FileOptions::SharedCtor() {
 java_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 java_outer_classname_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 go_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 objc_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 csharp_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 swift_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 php_class_prefix_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 php_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 php_metadata_namespace_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ruby_package_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&java_multiple_files_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&deprecated_) -
@@ -6148,7 +6318,7 @@
 
 void FileOptions::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.FileOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -6209,12 +6379,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional string java_package = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_java_package();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -6226,7 +6396,7 @@
         continue;
       // optional string java_outer_classname = 8;
       case 8:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) {
           auto str = _internal_mutable_java_outer_classname();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -6238,8 +6408,8 @@
         continue;
       // optional .google.protobuf.FileOptions.OptimizeMode optimize_for = 9 [default = SPEED];
       case 9:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 72)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 72)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode_IsValid(val))) {
             _internal_set_optimize_for(static_cast<::PROTOBUF_NAMESPACE_ID::FileOptions_OptimizeMode>(val));
@@ -6251,7 +6421,7 @@
         continue;
       // optional bool java_multiple_files = 10 [default = false];
       case 10:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) {
           _Internal::set_has_java_multiple_files(&has_bits);
           java_multiple_files_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -6260,7 +6430,7 @@
         continue;
       // optional string go_package = 11;
       case 11:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 90)) {
           auto str = _internal_mutable_go_package();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -6272,7 +6442,7 @@
         continue;
       // optional bool cc_generic_services = 16 [default = false];
       case 16:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 128)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 128)) {
           _Internal::set_has_cc_generic_services(&has_bits);
           cc_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -6281,7 +6451,7 @@
         continue;
       // optional bool java_generic_services = 17 [default = false];
       case 17:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 136)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 136)) {
           _Internal::set_has_java_generic_services(&has_bits);
           java_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -6290,7 +6460,7 @@
         continue;
       // optional bool py_generic_services = 18 [default = false];
       case 18:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 144)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 144)) {
           _Internal::set_has_py_generic_services(&has_bits);
           py_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -6299,7 +6469,7 @@
         continue;
       // optional bool java_generate_equals_and_hash = 20 [deprecated = true];
       case 20:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 160)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 160)) {
           _Internal::set_has_java_generate_equals_and_hash(&has_bits);
           java_generate_equals_and_hash_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -6308,7 +6478,7 @@
         continue;
       // optional bool deprecated = 23 [default = false];
       case 23:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 184)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 184)) {
           _Internal::set_has_deprecated(&has_bits);
           deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -6317,7 +6487,7 @@
         continue;
       // optional bool java_string_check_utf8 = 27 [default = false];
       case 27:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 216)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 216)) {
           _Internal::set_has_java_string_check_utf8(&has_bits);
           java_string_check_utf8_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -6326,7 +6496,7 @@
         continue;
       // optional bool cc_enable_arenas = 31 [default = true];
       case 31:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 248)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 248)) {
           _Internal::set_has_cc_enable_arenas(&has_bits);
           cc_enable_arenas_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -6335,7 +6505,7 @@
         continue;
       // optional string objc_class_prefix = 36;
       case 36:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
           auto str = _internal_mutable_objc_class_prefix();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -6347,7 +6517,7 @@
         continue;
       // optional string csharp_namespace = 37;
       case 37:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
           auto str = _internal_mutable_csharp_namespace();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -6359,7 +6529,7 @@
         continue;
       // optional string swift_prefix = 39;
       case 39:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           auto str = _internal_mutable_swift_prefix();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -6371,7 +6541,7 @@
         continue;
       // optional string php_class_prefix = 40;
       case 40:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) {
           auto str = _internal_mutable_php_class_prefix();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -6383,7 +6553,7 @@
         continue;
       // optional string php_namespace = 41;
       case 41:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 74)) {
           auto str = _internal_mutable_php_namespace();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -6395,7 +6565,7 @@
         continue;
       // optional bool php_generic_services = 42 [default = false];
       case 42:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) {
           _Internal::set_has_php_generic_services(&has_bits);
           php_generic_services_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -6404,7 +6574,7 @@
         continue;
       // optional string php_metadata_namespace = 44;
       case 44:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 98)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 98)) {
           auto str = _internal_mutable_php_metadata_namespace();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -6416,7 +6586,7 @@
         continue;
       // optional string ruby_package = 45;
       case 45:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 106)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 106)) {
           auto str = _internal_mutable_ruby_package();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -6428,7 +6598,7 @@
         continue;
       // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
       case 999:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           ptr -= 2;
           do {
             ptr += 2;
@@ -6468,10 +6638,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* FileOptions::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* FileOptions::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FileOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -6662,7 +6832,7 @@
 
   total_size += _extensions_.ByteSize();
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -6820,7 +6990,7 @@
 void FileOptions::MergeFrom(const FileOptions& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FileOptions)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -6893,7 +7063,7 @@
     }
     _has_bits_[0] |= cached_has_bits;
   }
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
 }
 
@@ -6909,7 +7079,8 @@
     return false;
   }
 
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_))
+    return false;
   return true;
 }
 
@@ -7022,14 +7193,14 @@
       _has_bits_(from._has_bits_),
       uninterpreted_option_(from.uninterpreted_option_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   ::memcpy(&message_set_wire_format_, &from.message_set_wire_format_,
     static_cast<size_t>(reinterpret_cast<char*>(&map_entry_) -
     reinterpret_cast<char*>(&message_set_wire_format_)) + sizeof(map_entry_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.MessageOptions)
 }
 
-void MessageOptions::SharedCtor() {
+inline void MessageOptions::SharedCtor() {
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&message_set_wire_format_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&map_entry_) -
@@ -7059,7 +7230,7 @@
 
 void MessageOptions::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.MessageOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -7076,12 +7247,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional bool message_set_wire_format = 1 [default = false];
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           _Internal::set_has_message_set_wire_format(&has_bits);
           message_set_wire_format_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -7090,7 +7261,7 @@
         continue;
       // optional bool no_standard_descriptor_accessor = 2 [default = false];
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
           _Internal::set_has_no_standard_descriptor_accessor(&has_bits);
           no_standard_descriptor_accessor_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -7099,7 +7270,7 @@
         continue;
       // optional bool deprecated = 3 [default = false];
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
           _Internal::set_has_deprecated(&has_bits);
           deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -7108,7 +7279,7 @@
         continue;
       // optional bool map_entry = 7;
       case 7:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) {
           _Internal::set_has_map_entry(&has_bits);
           map_entry_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -7117,7 +7288,7 @@
         continue;
       // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
       case 999:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           ptr -= 2;
           do {
             ptr += 2;
@@ -7157,10 +7328,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* MessageOptions::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* MessageOptions::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MessageOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -7214,7 +7385,7 @@
 
   total_size += _extensions_.ByteSize();
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -7267,7 +7438,7 @@
 void MessageOptions::MergeFrom(const MessageOptions& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MessageOptions)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -7287,7 +7458,7 @@
     }
     _has_bits_[0] |= cached_has_bits;
   }
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
 }
 
@@ -7303,7 +7474,8 @@
     return false;
   }
 
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_))
+    return false;
   return true;
 }
 
@@ -7368,14 +7540,14 @@
       _has_bits_(from._has_bits_),
       uninterpreted_option_(from.uninterpreted_option_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   ::memcpy(&ctype_, &from.ctype_,
     static_cast<size_t>(reinterpret_cast<char*>(&jstype_) -
     reinterpret_cast<char*>(&ctype_)) + sizeof(jstype_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldOptions)
 }
 
-void FieldOptions::SharedCtor() {
+inline void FieldOptions::SharedCtor() {
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&ctype_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&jstype_) -
@@ -7405,7 +7577,7 @@
 
 void FieldOptions::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -7425,13 +7597,13 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional .google.protobuf.FieldOptions.CType ctype = 1 [default = STRING];
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldOptions_CType_IsValid(val))) {
             _internal_set_ctype(static_cast<::PROTOBUF_NAMESPACE_ID::FieldOptions_CType>(val));
@@ -7443,7 +7615,7 @@
         continue;
       // optional bool packed = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
           _Internal::set_has_packed(&has_bits);
           packed_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -7452,7 +7624,7 @@
         continue;
       // optional bool deprecated = 3 [default = false];
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
           _Internal::set_has_deprecated(&has_bits);
           deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -7461,7 +7633,7 @@
         continue;
       // optional bool lazy = 5 [default = false];
       case 5:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
           _Internal::set_has_lazy(&has_bits);
           lazy_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -7470,8 +7642,8 @@
         continue;
       // optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];
       case 6:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 48)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType_IsValid(val))) {
             _internal_set_jstype(static_cast<::PROTOBUF_NAMESPACE_ID::FieldOptions_JSType>(val));
@@ -7483,7 +7655,7 @@
         continue;
       // optional bool weak = 10 [default = false];
       case 10:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 80)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 80)) {
           _Internal::set_has_weak(&has_bits);
           weak_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -7492,7 +7664,7 @@
         continue;
       // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
       case 999:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           ptr -= 2;
           do {
             ptr += 2;
@@ -7532,10 +7704,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* FieldOptions::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* FieldOptions::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -7603,7 +7775,7 @@
 
   total_size += _extensions_.ByteSize();
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -7668,7 +7840,7 @@
 void FieldOptions::MergeFrom(const FieldOptions& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldOptions)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -7694,7 +7866,7 @@
     }
     _has_bits_[0] |= cached_has_bits;
   }
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
 }
 
@@ -7710,7 +7882,8 @@
     return false;
   }
 
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_))
+    return false;
   return true;
 }
 
@@ -7755,11 +7928,11 @@
   : ::PROTOBUF_NAMESPACE_ID::Message(),
       uninterpreted_option_(from.uninterpreted_option_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   // @@protoc_insertion_point(copy_constructor:google.protobuf.OneofOptions)
 }
 
-void OneofOptions::SharedCtor() {
+inline void OneofOptions::SharedCtor() {
 }
 
 OneofOptions::~OneofOptions() {
@@ -7785,7 +7958,7 @@
 
 void OneofOptions::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.OneofOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -7797,12 +7970,12 @@
 const char* OneofOptions::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
       case 999:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           ptr -= 2;
           do {
             ptr += 2;
@@ -7841,10 +8014,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* OneofOptions::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* OneofOptions::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.OneofOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
@@ -7873,7 +8046,7 @@
 
   total_size += _extensions_.ByteSize();
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -7903,11 +8076,11 @@
 void OneofOptions::MergeFrom(const OneofOptions& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.OneofOptions)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
 }
 
@@ -7923,7 +8096,8 @@
     return false;
   }
 
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_))
+    return false;
   return true;
 }
 
@@ -7969,14 +8143,14 @@
       _has_bits_(from._has_bits_),
       uninterpreted_option_(from.uninterpreted_option_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   ::memcpy(&allow_alias_, &from.allow_alias_,
     static_cast<size_t>(reinterpret_cast<char*>(&deprecated_) -
     reinterpret_cast<char*>(&allow_alias_)) + sizeof(deprecated_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumOptions)
 }
 
-void EnumOptions::SharedCtor() {
+inline void EnumOptions::SharedCtor() {
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&allow_alias_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&deprecated_) -
@@ -8006,7 +8180,7 @@
 
 void EnumOptions::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -8023,12 +8197,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional bool allow_alias = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
           _Internal::set_has_allow_alias(&has_bits);
           allow_alias_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -8037,7 +8211,7 @@
         continue;
       // optional bool deprecated = 3 [default = false];
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
           _Internal::set_has_deprecated(&has_bits);
           deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -8046,7 +8220,7 @@
         continue;
       // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
       case 999:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           ptr -= 2;
           do {
             ptr += 2;
@@ -8086,10 +8260,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* EnumOptions::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* EnumOptions::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -8131,7 +8305,7 @@
 
   total_size += _extensions_.ByteSize();
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -8174,7 +8348,7 @@
 void EnumOptions::MergeFrom(const EnumOptions& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumOptions)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -8188,7 +8362,7 @@
     }
     _has_bits_[0] |= cached_has_bits;
   }
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
 }
 
@@ -8204,7 +8378,8 @@
     return false;
   }
 
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_))
+    return false;
   return true;
 }
 
@@ -8254,12 +8429,12 @@
       _has_bits_(from._has_bits_),
       uninterpreted_option_(from.uninterpreted_option_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   deprecated_ = from.deprecated_;
   // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValueOptions)
 }
 
-void EnumValueOptions::SharedCtor() {
+inline void EnumValueOptions::SharedCtor() {
 deprecated_ = false;
 }
 
@@ -8286,7 +8461,7 @@
 
 void EnumValueOptions::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValueOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -8301,12 +8476,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional bool deprecated = 1 [default = false];
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           _Internal::set_has_deprecated(&has_bits);
           deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -8315,7 +8490,7 @@
         continue;
       // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
       case 999:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           ptr -= 2;
           do {
             ptr += 2;
@@ -8355,10 +8530,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* EnumValueOptions::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* EnumValueOptions::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValueOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -8394,7 +8569,7 @@
 
   total_size += _extensions_.ByteSize();
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -8430,14 +8605,14 @@
 void EnumValueOptions::MergeFrom(const EnumValueOptions& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValueOptions)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
   if (from._internal_has_deprecated()) {
     _internal_set_deprecated(from._internal_deprecated());
   }
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
 }
 
@@ -8453,7 +8628,8 @@
     return false;
   }
 
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_))
+    return false;
   return true;
 }
 
@@ -8498,12 +8674,12 @@
       _has_bits_(from._has_bits_),
       uninterpreted_option_(from.uninterpreted_option_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   deprecated_ = from.deprecated_;
   // @@protoc_insertion_point(copy_constructor:google.protobuf.ServiceOptions)
 }
 
-void ServiceOptions::SharedCtor() {
+inline void ServiceOptions::SharedCtor() {
 deprecated_ = false;
 }
 
@@ -8530,7 +8706,7 @@
 
 void ServiceOptions::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.ServiceOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -8545,12 +8721,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional bool deprecated = 33 [default = false];
       case 33:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           _Internal::set_has_deprecated(&has_bits);
           deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -8559,7 +8735,7 @@
         continue;
       // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
       case 999:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           ptr -= 2;
           do {
             ptr += 2;
@@ -8599,10 +8775,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* ServiceOptions::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* ServiceOptions::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ServiceOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -8638,7 +8814,7 @@
 
   total_size += _extensions_.ByteSize();
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -8674,14 +8850,14 @@
 void ServiceOptions::MergeFrom(const ServiceOptions& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ServiceOptions)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
   if (from._internal_has_deprecated()) {
     _internal_set_deprecated(from._internal_deprecated());
   }
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
 }
 
@@ -8697,7 +8873,8 @@
     return false;
   }
 
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_))
+    return false;
   return true;
 }
 
@@ -8745,14 +8922,14 @@
       _has_bits_(from._has_bits_),
       uninterpreted_option_(from.uninterpreted_option_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   ::memcpy(&deprecated_, &from.deprecated_,
     static_cast<size_t>(reinterpret_cast<char*>(&idempotency_level_) -
     reinterpret_cast<char*>(&deprecated_)) + sizeof(idempotency_level_));
   // @@protoc_insertion_point(copy_constructor:google.protobuf.MethodOptions)
 }
 
-void MethodOptions::SharedCtor() {
+inline void MethodOptions::SharedCtor() {
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&deprecated_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&idempotency_level_) -
@@ -8782,7 +8959,7 @@
 
 void MethodOptions::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.MethodOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -8802,12 +8979,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // optional bool deprecated = 33 [default = false];
       case 33:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           _Internal::set_has_deprecated(&has_bits);
           deprecated_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -8816,8 +8993,8 @@
         continue;
       // optional .google.protobuf.MethodOptions.IdempotencyLevel idempotency_level = 34 [default = IDEMPOTENCY_UNKNOWN];
       case 34:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           if (PROTOBUF_PREDICT_TRUE(::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel_IsValid(val))) {
             _internal_set_idempotency_level(static_cast<::PROTOBUF_NAMESPACE_ID::MethodOptions_IdempotencyLevel>(val));
@@ -8829,7 +9006,7 @@
         continue;
       // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999;
       case 999:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           ptr -= 2;
           do {
             ptr += 2;
@@ -8869,10 +9046,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* MethodOptions::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* MethodOptions::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.MethodOptions)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -8915,7 +9092,7 @@
 
   total_size += _extensions_.ByteSize();
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -8959,7 +9136,7 @@
 void MethodOptions::MergeFrom(const MethodOptions& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.MethodOptions)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   uninterpreted_option_.MergeFrom(from.uninterpreted_option_);
@@ -8973,7 +9150,7 @@
     }
     _has_bits_[0] |= cached_has_bits;
   }
-  _extensions_.MergeFrom(from._extensions_);
+  _extensions_.MergeFrom(internal_default_instance(), from._extensions_);
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
 }
 
@@ -8989,7 +9166,8 @@
     return false;
   }
 
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(uninterpreted_option_))
+    return false;
   return true;
 }
 
@@ -9043,6 +9221,9 @@
       _has_bits_(from._has_bits_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_part_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_name_part()) {
     name_part_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name_part(), 
       GetArenaForAllocation());
@@ -9051,8 +9232,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption.NamePart)
 }
 
-void UninterpretedOption_NamePart::SharedCtor() {
+inline void UninterpretedOption_NamePart::SharedCtor() {
 name_part_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 is_extension_ = false;
 }
 
@@ -9080,7 +9264,7 @@
 
 void UninterpretedOption_NamePart::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption.NamePart)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -9097,12 +9281,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // required string name_part = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name_part();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -9114,7 +9298,7 @@
         continue;
       // required bool is_extension = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
           _Internal::set_has_is_extension(&has_bits);
           is_extension_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -9145,10 +9329,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* UninterpretedOption_NamePart::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* UninterpretedOption_NamePart::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UninterpretedOption.NamePart)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = _has_bits_[0];
@@ -9210,7 +9394,7 @@
   } else {
     total_size += RequiredFieldsByteSizeFallback();
   }
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -9233,7 +9417,7 @@
 void UninterpretedOption_NamePart::MergeFrom(const UninterpretedOption_NamePart& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UninterpretedOption.NamePart)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   cached_has_bits = from._has_bits_[0];
@@ -9322,16 +9506,25 @@
       name_(from.name_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   identifier_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_identifier_value()) {
     identifier_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_identifier_value(), 
       GetArenaForAllocation());
   }
   string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_string_value()) {
     string_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_string_value(), 
       GetArenaForAllocation());
   }
   aggregate_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_aggregate_value()) {
     aggregate_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_aggregate_value(), 
       GetArenaForAllocation());
@@ -9342,10 +9535,19 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.UninterpretedOption)
 }
 
-void UninterpretedOption::SharedCtor() {
+inline void UninterpretedOption::SharedCtor() {
 identifier_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 string_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 aggregate_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&positive_int_value_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&double_value_) -
@@ -9378,7 +9580,7 @@
 
 void UninterpretedOption::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.UninterpretedOption)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -9408,12 +9610,12 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -9426,7 +9628,7 @@
         continue;
       // optional string identifier_value = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           auto str = _internal_mutable_identifier_value();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -9438,7 +9640,7 @@
         continue;
       // optional uint64 positive_int_value = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
           _Internal::set_has_positive_int_value(&has_bits);
           positive_int_value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -9447,7 +9649,7 @@
         continue;
       // optional int64 negative_int_value = 5;
       case 5:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
           _Internal::set_has_negative_int_value(&has_bits);
           negative_int_value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
@@ -9456,7 +9658,7 @@
         continue;
       // optional double double_value = 6;
       case 6:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 49)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 49)) {
           _Internal::set_has_double_value(&has_bits);
           double_value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr);
           ptr += sizeof(double);
@@ -9465,7 +9667,7 @@
         continue;
       // optional bytes string_value = 7;
       case 7:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 58)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 58)) {
           auto str = _internal_mutable_string_value();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(ptr);
@@ -9474,7 +9676,7 @@
         continue;
       // optional string aggregate_value = 8;
       case 8:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 66)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 66)) {
           auto str = _internal_mutable_aggregate_value();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -9508,10 +9710,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* UninterpretedOption::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* UninterpretedOption::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UninterpretedOption)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // repeated .google.protobuf.UninterpretedOption.NamePart name = 2;
@@ -9579,7 +9781,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UninterpretedOption)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -9648,7 +9850,7 @@
 void UninterpretedOption::MergeFrom(const UninterpretedOption& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UninterpretedOption)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   name_.MergeFrom(from.name_);
@@ -9685,7 +9887,8 @@
 }
 
 bool UninterpretedOption::IsInitialized() const {
-  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(name_)) return false;
+  if (!::PROTOBUF_NAMESPACE_ID::internal::AllAreInitialized(name_))
+    return false;
   return true;
 }
 
@@ -9758,11 +9961,17 @@
       leading_detached_comments_(from.leading_detached_comments_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   leading_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_leading_comments()) {
     leading_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_leading_comments(), 
       GetArenaForAllocation());
   }
   trailing_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_trailing_comments()) {
     trailing_comments_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_trailing_comments(), 
       GetArenaForAllocation());
@@ -9770,9 +9979,15 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo.Location)
 }
 
-void SourceCodeInfo_Location::SharedCtor() {
+inline void SourceCodeInfo_Location::SharedCtor() {
 leading_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 trailing_comments_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 }
 
 SourceCodeInfo_Location::~SourceCodeInfo_Location() {
@@ -9800,7 +10015,7 @@
 
 void SourceCodeInfo_Location::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo.Location)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -9824,34 +10039,34 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // repeated int32 path = 1 [packed = true];
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_path(), ptr, ctx);
           CHK_(ptr);
-        } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8) {
-          _internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
+        } else if (static_cast<uint8_t>(tag) == 8) {
+          _internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // repeated int32 span = 2 [packed = true];
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_span(), ptr, ctx);
           CHK_(ptr);
-        } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16) {
-          _internal_add_span(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
+        } else if (static_cast<uint8_t>(tag) == 16) {
+          _internal_add_span(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional string leading_comments = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           auto str = _internal_mutable_leading_comments();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -9863,7 +10078,7 @@
         continue;
       // optional string trailing_comments = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
           auto str = _internal_mutable_trailing_comments();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -9875,7 +10090,7 @@
         continue;
       // repeated string leading_detached_comments = 6;
       case 6:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -9914,10 +10129,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* SourceCodeInfo_Location::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* SourceCodeInfo_Location::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceCodeInfo.Location)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // repeated int32 path = 1 [packed = true];
@@ -9981,7 +10196,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceCodeInfo.Location)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -9992,7 +10207,7 @@
     if (data_size > 0) {
       total_size += 1 +
         ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
-            static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size));
+            static_cast<int32_t>(data_size));
     }
     int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size);
     _path_cached_byte_size_.store(cached_size,
@@ -10007,7 +10222,7 @@
     if (data_size > 0) {
       total_size += 1 +
         ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
-            static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size));
+            static_cast<int32_t>(data_size));
     }
     int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size);
     _span_cached_byte_size_.store(cached_size,
@@ -10059,7 +10274,7 @@
 void SourceCodeInfo_Location::MergeFrom(const SourceCodeInfo_Location& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceCodeInfo.Location)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   path_.MergeFrom(from.path_);
@@ -10138,7 +10353,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceCodeInfo)
 }
 
-void SourceCodeInfo::SharedCtor() {
+inline void SourceCodeInfo::SharedCtor() {
 }
 
 SourceCodeInfo::~SourceCodeInfo() {
@@ -10164,7 +10379,7 @@
 
 void SourceCodeInfo::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceCodeInfo)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -10175,12 +10390,12 @@
 const char* SourceCodeInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // repeated .google.protobuf.SourceCodeInfo.Location location = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -10214,10 +10429,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* SourceCodeInfo::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* SourceCodeInfo::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceCodeInfo)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // repeated .google.protobuf.SourceCodeInfo.Location location = 1;
@@ -10240,7 +10455,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceCodeInfo)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -10270,7 +10485,7 @@
 void SourceCodeInfo::MergeFrom(const SourceCodeInfo& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceCodeInfo)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   location_.MergeFrom(from.location_);
@@ -10332,6 +10547,9 @@
       path_(from.path_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   source_file_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (from._internal_has_source_file()) {
     source_file_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_source_file(), 
       GetArenaForAllocation());
@@ -10342,8 +10560,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo.Annotation)
 }
 
-void GeneratedCodeInfo_Annotation::SharedCtor() {
+inline void GeneratedCodeInfo_Annotation::SharedCtor() {
 source_file_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&begin_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&end_) -
@@ -10374,7 +10595,7 @@
 
 void GeneratedCodeInfo_Annotation::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo.Annotation)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -10396,23 +10617,23 @@
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   _Internal::HasBits has_bits{};
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // repeated int32 path = 1 [packed = true];
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::PackedInt32Parser(_internal_mutable_path(), ptr, ctx);
           CHK_(ptr);
-        } else if (static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8) {
-          _internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
+        } else if (static_cast<uint8_t>(tag) == 8) {
+          _internal_add_path(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr));
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional string source_file = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           auto str = _internal_mutable_source_file();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           #ifndef NDEBUG
@@ -10424,18 +10645,18 @@
         continue;
       // optional int32 begin = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
           _Internal::set_has_begin(&has_bits);
-          begin_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          begin_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // optional int32 end = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
           _Internal::set_has_end(&has_bits);
-          end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+          end_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
@@ -10464,10 +10685,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* GeneratedCodeInfo_Annotation::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* GeneratedCodeInfo_Annotation::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo.Annotation)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // repeated int32 path = 1 [packed = true];
@@ -10514,7 +10735,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.GeneratedCodeInfo.Annotation)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -10525,7 +10746,7 @@
     if (data_size > 0) {
       total_size += 1 +
         ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
-            static_cast<::PROTOBUF_NAMESPACE_ID::int32>(data_size));
+            static_cast<int32_t>(data_size));
     }
     int cached_size = ::PROTOBUF_NAMESPACE_ID::internal::ToCachedSize(data_size);
     _path_cached_byte_size_.store(cached_size,
@@ -10572,7 +10793,7 @@
 void GeneratedCodeInfo_Annotation::MergeFrom(const GeneratedCodeInfo_Annotation& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.GeneratedCodeInfo.Annotation)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   path_.MergeFrom(from.path_);
@@ -10652,7 +10873,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo)
 }
 
-void GeneratedCodeInfo::SharedCtor() {
+inline void GeneratedCodeInfo::SharedCtor() {
 }
 
 GeneratedCodeInfo::~GeneratedCodeInfo() {
@@ -10678,7 +10899,7 @@
 
 void GeneratedCodeInfo::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.GeneratedCodeInfo)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -10689,12 +10910,12 @@
 const char* GeneratedCodeInfo::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -10728,10 +10949,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* GeneratedCodeInfo::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* GeneratedCodeInfo::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1;
@@ -10754,7 +10975,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.GeneratedCodeInfo)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -10784,7 +11005,7 @@
 void GeneratedCodeInfo::MergeFrom(const GeneratedCodeInfo& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.GeneratedCodeInfo)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   annotation_.MergeFrom(from.annotation_);
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index 51261e4..82fdb7f 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3018000
+#if PROTOBUF_VERSION < 3019000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
@@ -51,7 +51,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
   static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
-  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+  static const uint32_t offsets[];
 };
 PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fdescriptor_2eproto;
 PROTOBUF_NAMESPACE_OPEN
@@ -391,7 +391,12 @@
   }
   inline void Swap(FileDescriptorSet* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -405,11 +410,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline FileDescriptorSet* New() const final {
-    return new FileDescriptorSet();
-  }
-
-  FileDescriptorSet* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  FileDescriptorSet* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<FileDescriptorSet>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -424,8 +425,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -433,6 +434,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(FileDescriptorSet* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.FileDescriptorSet";
@@ -550,7 +553,12 @@
   }
   inline void Swap(FileDescriptorProto* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -564,11 +572,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline FileDescriptorProto* New() const final {
-    return new FileDescriptorProto();
-  }
-
-  FileDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  FileDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<FileDescriptorProto>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -583,8 +587,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -592,6 +596,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(FileDescriptorProto* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.FileDescriptorProto";
@@ -730,19 +736,19 @@
   public:
   void clear_public_dependency();
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_public_dependency(int index) const;
-  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+  int32_t _internal_public_dependency(int index) const;
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
       _internal_public_dependency() const;
-  void _internal_add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value);
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+  void _internal_add_public_dependency(int32_t value);
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
       _internal_mutable_public_dependency();
   public:
-  ::PROTOBUF_NAMESPACE_ID::int32 public_dependency(int index) const;
-  void set_public_dependency(int index, ::PROTOBUF_NAMESPACE_ID::int32 value);
-  void add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value);
-  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+  int32_t public_dependency(int index) const;
+  void set_public_dependency(int index, int32_t value);
+  void add_public_dependency(int32_t value);
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
       public_dependency() const;
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
       mutable_public_dependency();
 
   // repeated int32 weak_dependency = 11;
@@ -752,19 +758,19 @@
   public:
   void clear_weak_dependency();
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_weak_dependency(int index) const;
-  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+  int32_t _internal_weak_dependency(int index) const;
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
       _internal_weak_dependency() const;
-  void _internal_add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value);
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+  void _internal_add_weak_dependency(int32_t value);
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
       _internal_mutable_weak_dependency();
   public:
-  ::PROTOBUF_NAMESPACE_ID::int32 weak_dependency(int index) const;
-  void set_weak_dependency(int index, ::PROTOBUF_NAMESPACE_ID::int32 value);
-  void add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value);
-  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+  int32_t weak_dependency(int index) const;
+  void set_weak_dependency(int index, int32_t value);
+  void add_weak_dependency(int32_t value);
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
       weak_dependency() const;
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
       mutable_weak_dependency();
 
   // optional string name = 1;
@@ -777,7 +783,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -795,7 +801,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_package(ArgT0&& arg0, ArgT... args);
   std::string* mutable_package();
-  PROTOBUF_MUST_USE_RESULT std::string* release_package();
+  PROTOBUF_NODISCARD std::string* release_package();
   void set_allocated_package(std::string* package);
   private:
   const std::string& _internal_package() const;
@@ -813,7 +819,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_syntax(ArgT0&& arg0, ArgT... args);
   std::string* mutable_syntax();
-  PROTOBUF_MUST_USE_RESULT std::string* release_syntax();
+  PROTOBUF_NODISCARD std::string* release_syntax();
   void set_allocated_syntax(std::string* syntax);
   private:
   const std::string& _internal_syntax() const;
@@ -828,7 +834,7 @@
   public:
   void clear_options();
   const ::PROTOBUF_NAMESPACE_ID::FileOptions& options() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::FileOptions* release_options();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::FileOptions* release_options();
   ::PROTOBUF_NAMESPACE_ID::FileOptions* mutable_options();
   void set_allocated_options(::PROTOBUF_NAMESPACE_ID::FileOptions* options);
   private:
@@ -846,7 +852,7 @@
   public:
   void clear_source_code_info();
   const ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo& source_code_info() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* release_source_code_info();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* release_source_code_info();
   ::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* mutable_source_code_info();
   void set_allocated_source_code_info(::PROTOBUF_NAMESPACE_ID::SourceCodeInfo* source_code_info);
   private:
@@ -871,8 +877,8 @@
   ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::EnumDescriptorProto > enum_type_;
   ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::ServiceDescriptorProto > service_;
   ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::FieldDescriptorProto > extension_;
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > public_dependency_;
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > weak_dependency_;
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t > public_dependency_;
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t > weak_dependency_;
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr package_;
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr syntax_;
@@ -944,7 +950,12 @@
   }
   inline void Swap(DescriptorProto_ExtensionRange* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -958,11 +969,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline DescriptorProto_ExtensionRange* New() const final {
-    return new DescriptorProto_ExtensionRange();
-  }
-
-  DescriptorProto_ExtensionRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  DescriptorProto_ExtensionRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<DescriptorProto_ExtensionRange>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -977,8 +984,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -986,6 +993,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(DescriptorProto_ExtensionRange* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.DescriptorProto.ExtensionRange";
@@ -1019,7 +1028,7 @@
   public:
   void clear_options();
   const ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions& options() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* release_options();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* release_options();
   ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* mutable_options();
   void set_allocated_options(::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options);
   private:
@@ -1036,11 +1045,11 @@
   bool _internal_has_start() const;
   public:
   void clear_start();
-  ::PROTOBUF_NAMESPACE_ID::int32 start() const;
-  void set_start(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t start() const;
+  void set_start(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_start() const;
-  void _internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_start() const;
+  void _internal_set_start(int32_t value);
   public:
 
   // optional int32 end = 2;
@@ -1049,11 +1058,11 @@
   bool _internal_has_end() const;
   public:
   void clear_end();
-  ::PROTOBUF_NAMESPACE_ID::int32 end() const;
-  void set_end(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t end() const;
+  void set_end(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_end() const;
-  void _internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_end() const;
+  void _internal_set_end(int32_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto.ExtensionRange)
@@ -1066,8 +1075,8 @@
   ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
   ::PROTOBUF_NAMESPACE_ID::ExtensionRangeOptions* options_;
-  ::PROTOBUF_NAMESPACE_ID::int32 start_;
-  ::PROTOBUF_NAMESPACE_ID::int32 end_;
+  int32_t start_;
+  int32_t end_;
   friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto;
 };
 // -------------------------------------------------------------------
@@ -1134,7 +1143,12 @@
   }
   inline void Swap(DescriptorProto_ReservedRange* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1148,11 +1162,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline DescriptorProto_ReservedRange* New() const final {
-    return new DescriptorProto_ReservedRange();
-  }
-
-  DescriptorProto_ReservedRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  DescriptorProto_ReservedRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<DescriptorProto_ReservedRange>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -1167,8 +1177,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -1176,6 +1186,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(DescriptorProto_ReservedRange* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.DescriptorProto.ReservedRange";
@@ -1207,11 +1219,11 @@
   bool _internal_has_start() const;
   public:
   void clear_start();
-  ::PROTOBUF_NAMESPACE_ID::int32 start() const;
-  void set_start(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t start() const;
+  void set_start(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_start() const;
-  void _internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_start() const;
+  void _internal_set_start(int32_t value);
   public:
 
   // optional int32 end = 2;
@@ -1220,11 +1232,11 @@
   bool _internal_has_end() const;
   public:
   void clear_end();
-  ::PROTOBUF_NAMESPACE_ID::int32 end() const;
-  void set_end(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t end() const;
+  void set_end(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_end() const;
-  void _internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_end() const;
+  void _internal_set_end(int32_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.DescriptorProto.ReservedRange)
@@ -1236,8 +1248,8 @@
   typedef void DestructorSkippable_;
   ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
-  ::PROTOBUF_NAMESPACE_ID::int32 start_;
-  ::PROTOBUF_NAMESPACE_ID::int32 end_;
+  int32_t start_;
+  int32_t end_;
   friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto;
 };
 // -------------------------------------------------------------------
@@ -1304,7 +1316,12 @@
   }
   inline void Swap(DescriptorProto* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1318,11 +1335,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline DescriptorProto* New() const final {
-    return new DescriptorProto();
-  }
-
-  DescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  DescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<DescriptorProto>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -1337,8 +1350,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -1346,6 +1359,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(DescriptorProto* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.DescriptorProto";
@@ -1542,7 +1557,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -1557,7 +1572,7 @@
   public:
   void clear_options();
   const ::PROTOBUF_NAMESPACE_ID::MessageOptions& options() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::MessageOptions* release_options();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::MessageOptions* release_options();
   ::PROTOBUF_NAMESPACE_ID::MessageOptions* mutable_options();
   void set_allocated_options(::PROTOBUF_NAMESPACE_ID::MessageOptions* options);
   private:
@@ -1653,7 +1668,12 @@
   }
   inline void Swap(ExtensionRangeOptions* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1667,11 +1687,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline ExtensionRangeOptions* New() const final {
-    return new ExtensionRangeOptions();
-  }
-
-  ExtensionRangeOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  ExtensionRangeOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<ExtensionRangeOptions>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -1686,8 +1702,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -1695,6 +1711,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(ExtensionRangeOptions* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.ExtensionRangeOptions";
@@ -1826,7 +1844,7 @@
   template <typename _proto_TypeTraits,
             ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
             bool _is_packed>
-  inline PROTOBUF_MUST_USE_RESULT
+  PROTOBUF_NODISCARD inline
       typename _proto_TypeTraits::Singular::MutableType
       ReleaseExtension(
           const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
@@ -2004,7 +2022,12 @@
   }
   inline void Swap(FieldDescriptorProto* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -2018,11 +2041,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline FieldDescriptorProto* New() const final {
-    return new FieldDescriptorProto();
-  }
-
-  FieldDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  FieldDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<FieldDescriptorProto>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -2037,8 +2056,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -2046,6 +2065,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(FieldDescriptorProto* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.FieldDescriptorProto";
@@ -2184,7 +2205,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -2202,7 +2223,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_extendee(ArgT0&& arg0, ArgT... args);
   std::string* mutable_extendee();
-  PROTOBUF_MUST_USE_RESULT std::string* release_extendee();
+  PROTOBUF_NODISCARD std::string* release_extendee();
   void set_allocated_extendee(std::string* extendee);
   private:
   const std::string& _internal_extendee() const;
@@ -2220,7 +2241,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_type_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_type_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_type_name();
+  PROTOBUF_NODISCARD std::string* release_type_name();
   void set_allocated_type_name(std::string* type_name);
   private:
   const std::string& _internal_type_name() const;
@@ -2238,7 +2259,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_default_value(ArgT0&& arg0, ArgT... args);
   std::string* mutable_default_value();
-  PROTOBUF_MUST_USE_RESULT std::string* release_default_value();
+  PROTOBUF_NODISCARD std::string* release_default_value();
   void set_allocated_default_value(std::string* default_value);
   private:
   const std::string& _internal_default_value() const;
@@ -2256,7 +2277,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_json_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_json_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_json_name();
+  PROTOBUF_NODISCARD std::string* release_json_name();
   void set_allocated_json_name(std::string* json_name);
   private:
   const std::string& _internal_json_name() const;
@@ -2271,7 +2292,7 @@
   public:
   void clear_options();
   const ::PROTOBUF_NAMESPACE_ID::FieldOptions& options() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::FieldOptions* release_options();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::FieldOptions* release_options();
   ::PROTOBUF_NAMESPACE_ID::FieldOptions* mutable_options();
   void set_allocated_options(::PROTOBUF_NAMESPACE_ID::FieldOptions* options);
   private:
@@ -2288,11 +2309,11 @@
   bool _internal_has_number() const;
   public:
   void clear_number();
-  ::PROTOBUF_NAMESPACE_ID::int32 number() const;
-  void set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t number() const;
+  void set_number(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const;
-  void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_number() const;
+  void _internal_set_number(int32_t value);
   public:
 
   // optional int32 oneof_index = 9;
@@ -2301,11 +2322,11 @@
   bool _internal_has_oneof_index() const;
   public:
   void clear_oneof_index();
-  ::PROTOBUF_NAMESPACE_ID::int32 oneof_index() const;
-  void set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t oneof_index() const;
+  void set_oneof_index(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_oneof_index() const;
-  void _internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_oneof_index() const;
+  void _internal_set_oneof_index(int32_t value);
   public:
 
   // optional bool proto3_optional = 17;
@@ -2362,8 +2383,8 @@
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr default_value_;
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr json_name_;
   ::PROTOBUF_NAMESPACE_ID::FieldOptions* options_;
-  ::PROTOBUF_NAMESPACE_ID::int32 number_;
-  ::PROTOBUF_NAMESPACE_ID::int32 oneof_index_;
+  int32_t number_;
+  int32_t oneof_index_;
   bool proto3_optional_;
   int label_;
   int type_;
@@ -2433,7 +2454,12 @@
   }
   inline void Swap(OneofDescriptorProto* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -2447,11 +2473,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline OneofDescriptorProto* New() const final {
-    return new OneofDescriptorProto();
-  }
-
-  OneofDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  OneofDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<OneofDescriptorProto>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -2466,8 +2488,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -2475,6 +2497,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(OneofDescriptorProto* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.OneofDescriptorProto";
@@ -2510,7 +2534,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -2525,7 +2549,7 @@
   public:
   void clear_options();
   const ::PROTOBUF_NAMESPACE_ID::OneofOptions& options() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::OneofOptions* release_options();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::OneofOptions* release_options();
   ::PROTOBUF_NAMESPACE_ID::OneofOptions* mutable_options();
   void set_allocated_options(::PROTOBUF_NAMESPACE_ID::OneofOptions* options);
   private:
@@ -2613,7 +2637,12 @@
   }
   inline void Swap(EnumDescriptorProto_EnumReservedRange* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -2627,11 +2656,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline EnumDescriptorProto_EnumReservedRange* New() const final {
-    return new EnumDescriptorProto_EnumReservedRange();
-  }
-
-  EnumDescriptorProto_EnumReservedRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  EnumDescriptorProto_EnumReservedRange* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<EnumDescriptorProto_EnumReservedRange>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -2646,8 +2671,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -2655,6 +2680,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(EnumDescriptorProto_EnumReservedRange* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.EnumDescriptorProto.EnumReservedRange";
@@ -2686,11 +2713,11 @@
   bool _internal_has_start() const;
   public:
   void clear_start();
-  ::PROTOBUF_NAMESPACE_ID::int32 start() const;
-  void set_start(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t start() const;
+  void set_start(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_start() const;
-  void _internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_start() const;
+  void _internal_set_start(int32_t value);
   public:
 
   // optional int32 end = 2;
@@ -2699,11 +2726,11 @@
   bool _internal_has_end() const;
   public:
   void clear_end();
-  ::PROTOBUF_NAMESPACE_ID::int32 end() const;
-  void set_end(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t end() const;
+  void set_end(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_end() const;
-  void _internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_end() const;
+  void _internal_set_end(int32_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.EnumDescriptorProto.EnumReservedRange)
@@ -2715,8 +2742,8 @@
   typedef void DestructorSkippable_;
   ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
-  ::PROTOBUF_NAMESPACE_ID::int32 start_;
-  ::PROTOBUF_NAMESPACE_ID::int32 end_;
+  int32_t start_;
+  int32_t end_;
   friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto;
 };
 // -------------------------------------------------------------------
@@ -2783,7 +2810,12 @@
   }
   inline void Swap(EnumDescriptorProto* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -2797,11 +2829,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline EnumDescriptorProto* New() const final {
-    return new EnumDescriptorProto();
-  }
-
-  EnumDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  EnumDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<EnumDescriptorProto>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -2816,8 +2844,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -2825,6 +2853,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(EnumDescriptorProto* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.EnumDescriptorProto";
@@ -2925,7 +2955,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -2940,7 +2970,7 @@
   public:
   void clear_options();
   const ::PROTOBUF_NAMESPACE_ID::EnumOptions& options() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::EnumOptions* release_options();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::EnumOptions* release_options();
   ::PROTOBUF_NAMESPACE_ID::EnumOptions* mutable_options();
   void set_allocated_options(::PROTOBUF_NAMESPACE_ID::EnumOptions* options);
   private:
@@ -3031,7 +3061,12 @@
   }
   inline void Swap(EnumValueDescriptorProto* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -3045,11 +3080,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline EnumValueDescriptorProto* New() const final {
-    return new EnumValueDescriptorProto();
-  }
-
-  EnumValueDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  EnumValueDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<EnumValueDescriptorProto>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -3064,8 +3095,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -3073,6 +3104,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(EnumValueDescriptorProto* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.EnumValueDescriptorProto";
@@ -3109,7 +3142,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -3124,7 +3157,7 @@
   public:
   void clear_options();
   const ::PROTOBUF_NAMESPACE_ID::EnumValueOptions& options() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* release_options();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* release_options();
   ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* mutable_options();
   void set_allocated_options(::PROTOBUF_NAMESPACE_ID::EnumValueOptions* options);
   private:
@@ -3141,11 +3174,11 @@
   bool _internal_has_number() const;
   public:
   void clear_number();
-  ::PROTOBUF_NAMESPACE_ID::int32 number() const;
-  void set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t number() const;
+  void set_number(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const;
-  void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_number() const;
+  void _internal_set_number(int32_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.EnumValueDescriptorProto)
@@ -3159,7 +3192,7 @@
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
   ::PROTOBUF_NAMESPACE_ID::EnumValueOptions* options_;
-  ::PROTOBUF_NAMESPACE_ID::int32 number_;
+  int32_t number_;
   friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto;
 };
 // -------------------------------------------------------------------
@@ -3226,7 +3259,12 @@
   }
   inline void Swap(ServiceDescriptorProto* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -3240,11 +3278,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline ServiceDescriptorProto* New() const final {
-    return new ServiceDescriptorProto();
-  }
-
-  ServiceDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  ServiceDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<ServiceDescriptorProto>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -3259,8 +3293,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -3268,6 +3302,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(ServiceDescriptorProto* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.ServiceDescriptorProto";
@@ -3322,7 +3358,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -3337,7 +3373,7 @@
   public:
   void clear_options();
   const ::PROTOBUF_NAMESPACE_ID::ServiceOptions& options() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::ServiceOptions* release_options();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::ServiceOptions* release_options();
   ::PROTOBUF_NAMESPACE_ID::ServiceOptions* mutable_options();
   void set_allocated_options(::PROTOBUF_NAMESPACE_ID::ServiceOptions* options);
   private:
@@ -3426,7 +3462,12 @@
   }
   inline void Swap(MethodDescriptorProto* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -3440,11 +3481,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline MethodDescriptorProto* New() const final {
-    return new MethodDescriptorProto();
-  }
-
-  MethodDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  MethodDescriptorProto* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<MethodDescriptorProto>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -3459,8 +3496,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -3468,6 +3505,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(MethodDescriptorProto* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.MethodDescriptorProto";
@@ -3507,7 +3546,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -3525,7 +3564,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_input_type(ArgT0&& arg0, ArgT... args);
   std::string* mutable_input_type();
-  PROTOBUF_MUST_USE_RESULT std::string* release_input_type();
+  PROTOBUF_NODISCARD std::string* release_input_type();
   void set_allocated_input_type(std::string* input_type);
   private:
   const std::string& _internal_input_type() const;
@@ -3543,7 +3582,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_output_type(ArgT0&& arg0, ArgT... args);
   std::string* mutable_output_type();
-  PROTOBUF_MUST_USE_RESULT std::string* release_output_type();
+  PROTOBUF_NODISCARD std::string* release_output_type();
   void set_allocated_output_type(std::string* output_type);
   private:
   const std::string& _internal_output_type() const;
@@ -3558,7 +3597,7 @@
   public:
   void clear_options();
   const ::PROTOBUF_NAMESPACE_ID::MethodOptions& options() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::MethodOptions* release_options();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::MethodOptions* release_options();
   ::PROTOBUF_NAMESPACE_ID::MethodOptions* mutable_options();
   void set_allocated_options(::PROTOBUF_NAMESPACE_ID::MethodOptions* options);
   private:
@@ -3676,7 +3715,12 @@
   }
   inline void Swap(FileOptions* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -3690,11 +3734,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline FileOptions* New() const final {
-    return new FileOptions();
-  }
-
-  FileOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  FileOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<FileOptions>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -3709,8 +3749,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -3718,6 +3758,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(FileOptions* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.FileOptions";
@@ -3822,7 +3864,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_java_package(ArgT0&& arg0, ArgT... args);
   std::string* mutable_java_package();
-  PROTOBUF_MUST_USE_RESULT std::string* release_java_package();
+  PROTOBUF_NODISCARD std::string* release_java_package();
   void set_allocated_java_package(std::string* java_package);
   private:
   const std::string& _internal_java_package() const;
@@ -3840,7 +3882,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_java_outer_classname(ArgT0&& arg0, ArgT... args);
   std::string* mutable_java_outer_classname();
-  PROTOBUF_MUST_USE_RESULT std::string* release_java_outer_classname();
+  PROTOBUF_NODISCARD std::string* release_java_outer_classname();
   void set_allocated_java_outer_classname(std::string* java_outer_classname);
   private:
   const std::string& _internal_java_outer_classname() const;
@@ -3858,7 +3900,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_go_package(ArgT0&& arg0, ArgT... args);
   std::string* mutable_go_package();
-  PROTOBUF_MUST_USE_RESULT std::string* release_go_package();
+  PROTOBUF_NODISCARD std::string* release_go_package();
   void set_allocated_go_package(std::string* go_package);
   private:
   const std::string& _internal_go_package() const;
@@ -3876,7 +3918,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_objc_class_prefix(ArgT0&& arg0, ArgT... args);
   std::string* mutable_objc_class_prefix();
-  PROTOBUF_MUST_USE_RESULT std::string* release_objc_class_prefix();
+  PROTOBUF_NODISCARD std::string* release_objc_class_prefix();
   void set_allocated_objc_class_prefix(std::string* objc_class_prefix);
   private:
   const std::string& _internal_objc_class_prefix() const;
@@ -3894,7 +3936,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_csharp_namespace(ArgT0&& arg0, ArgT... args);
   std::string* mutable_csharp_namespace();
-  PROTOBUF_MUST_USE_RESULT std::string* release_csharp_namespace();
+  PROTOBUF_NODISCARD std::string* release_csharp_namespace();
   void set_allocated_csharp_namespace(std::string* csharp_namespace);
   private:
   const std::string& _internal_csharp_namespace() const;
@@ -3912,7 +3954,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_swift_prefix(ArgT0&& arg0, ArgT... args);
   std::string* mutable_swift_prefix();
-  PROTOBUF_MUST_USE_RESULT std::string* release_swift_prefix();
+  PROTOBUF_NODISCARD std::string* release_swift_prefix();
   void set_allocated_swift_prefix(std::string* swift_prefix);
   private:
   const std::string& _internal_swift_prefix() const;
@@ -3930,7 +3972,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_php_class_prefix(ArgT0&& arg0, ArgT... args);
   std::string* mutable_php_class_prefix();
-  PROTOBUF_MUST_USE_RESULT std::string* release_php_class_prefix();
+  PROTOBUF_NODISCARD std::string* release_php_class_prefix();
   void set_allocated_php_class_prefix(std::string* php_class_prefix);
   private:
   const std::string& _internal_php_class_prefix() const;
@@ -3948,7 +3990,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_php_namespace(ArgT0&& arg0, ArgT... args);
   std::string* mutable_php_namespace();
-  PROTOBUF_MUST_USE_RESULT std::string* release_php_namespace();
+  PROTOBUF_NODISCARD std::string* release_php_namespace();
   void set_allocated_php_namespace(std::string* php_namespace);
   private:
   const std::string& _internal_php_namespace() const;
@@ -3966,7 +4008,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_php_metadata_namespace(ArgT0&& arg0, ArgT... args);
   std::string* mutable_php_metadata_namespace();
-  PROTOBUF_MUST_USE_RESULT std::string* release_php_metadata_namespace();
+  PROTOBUF_NODISCARD std::string* release_php_metadata_namespace();
   void set_allocated_php_metadata_namespace(std::string* php_metadata_namespace);
   private:
   const std::string& _internal_php_metadata_namespace() const;
@@ -3984,7 +4026,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_ruby_package(ArgT0&& arg0, ArgT... args);
   std::string* mutable_ruby_package();
-  PROTOBUF_MUST_USE_RESULT std::string* release_ruby_package();
+  PROTOBUF_NODISCARD std::string* release_ruby_package();
   void set_allocated_ruby_package(std::string* ruby_package);
   private:
   const std::string& _internal_ruby_package() const;
@@ -4211,7 +4253,7 @@
   template <typename _proto_TypeTraits,
             ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
             bool _is_packed>
-  inline PROTOBUF_MUST_USE_RESULT
+  PROTOBUF_NODISCARD inline
       typename _proto_TypeTraits::Singular::MutableType
       ReleaseExtension(
           const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
@@ -4410,7 +4452,12 @@
   }
   inline void Swap(MessageOptions* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -4424,11 +4471,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline MessageOptions* New() const final {
-    return new MessageOptions();
-  }
-
-  MessageOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  MessageOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<MessageOptions>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -4443,8 +4486,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -4452,6 +4495,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(MessageOptions* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.MessageOptions";
@@ -4639,7 +4684,7 @@
   template <typename _proto_TypeTraits,
             ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
             bool _is_packed>
-  inline PROTOBUF_MUST_USE_RESULT
+  PROTOBUF_NODISCARD inline
       typename _proto_TypeTraits::Singular::MutableType
       ReleaseExtension(
           const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
@@ -4822,7 +4867,12 @@
   }
   inline void Swap(FieldOptions* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -4836,11 +4886,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline FieldOptions* New() const final {
-    return new FieldOptions();
-  }
-
-  FieldOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  FieldOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<FieldOptions>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -4855,8 +4901,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -4864,6 +4910,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(FieldOptions* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.FieldOptions";
@@ -5143,7 +5191,7 @@
   template <typename _proto_TypeTraits,
             ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
             bool _is_packed>
-  inline PROTOBUF_MUST_USE_RESULT
+  PROTOBUF_NODISCARD inline
       typename _proto_TypeTraits::Singular::MutableType
       ReleaseExtension(
           const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
@@ -5328,7 +5376,12 @@
   }
   inline void Swap(OneofOptions* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -5342,11 +5395,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline OneofOptions* New() const final {
-    return new OneofOptions();
-  }
-
-  OneofOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  OneofOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<OneofOptions>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -5361,8 +5410,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -5370,6 +5419,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(OneofOptions* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.OneofOptions";
@@ -5501,7 +5552,7 @@
   template <typename _proto_TypeTraits,
             ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
             bool _is_packed>
-  inline PROTOBUF_MUST_USE_RESULT
+  PROTOBUF_NODISCARD inline
       typename _proto_TypeTraits::Singular::MutableType
       ReleaseExtension(
           const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
@@ -5679,7 +5730,12 @@
   }
   inline void Swap(EnumOptions* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -5693,11 +5749,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline EnumOptions* New() const final {
-    return new EnumOptions();
-  }
-
-  EnumOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  EnumOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<EnumOptions>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -5712,8 +5764,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -5721,6 +5773,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(EnumOptions* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.EnumOptions";
@@ -5880,7 +5934,7 @@
   template <typename _proto_TypeTraits,
             ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
             bool _is_packed>
-  inline PROTOBUF_MUST_USE_RESULT
+  PROTOBUF_NODISCARD inline
       typename _proto_TypeTraits::Singular::MutableType
       ReleaseExtension(
           const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
@@ -6061,7 +6115,12 @@
   }
   inline void Swap(EnumValueOptions* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -6075,11 +6134,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline EnumValueOptions* New() const final {
-    return new EnumValueOptions();
-  }
-
-  EnumValueOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  EnumValueOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<EnumValueOptions>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -6094,8 +6149,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -6103,6 +6158,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(EnumValueOptions* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.EnumValueOptions";
@@ -6248,7 +6305,7 @@
   template <typename _proto_TypeTraits,
             ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
             bool _is_packed>
-  inline PROTOBUF_MUST_USE_RESULT
+  PROTOBUF_NODISCARD inline
       typename _proto_TypeTraits::Singular::MutableType
       ReleaseExtension(
           const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
@@ -6428,7 +6485,12 @@
   }
   inline void Swap(ServiceOptions* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -6442,11 +6504,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline ServiceOptions* New() const final {
-    return new ServiceOptions();
-  }
-
-  ServiceOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  ServiceOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<ServiceOptions>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -6461,8 +6519,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -6470,6 +6528,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(ServiceOptions* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.ServiceOptions";
@@ -6615,7 +6675,7 @@
   template <typename _proto_TypeTraits,
             ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
             bool _is_packed>
-  inline PROTOBUF_MUST_USE_RESULT
+  PROTOBUF_NODISCARD inline
       typename _proto_TypeTraits::Singular::MutableType
       ReleaseExtension(
           const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
@@ -6795,7 +6855,12 @@
   }
   inline void Swap(MethodOptions* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -6809,11 +6874,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline MethodOptions* New() const final {
-    return new MethodOptions();
-  }
-
-  MethodOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  MethodOptions* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<MethodOptions>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -6828,8 +6889,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -6837,6 +6898,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(MethodOptions* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.MethodOptions";
@@ -7028,7 +7091,7 @@
   template <typename _proto_TypeTraits,
             ::PROTOBUF_NAMESPACE_ID::internal::FieldType _field_type,
             bool _is_packed>
-  inline PROTOBUF_MUST_USE_RESULT
+  PROTOBUF_NODISCARD inline
       typename _proto_TypeTraits::Singular::MutableType
       ReleaseExtension(
           const ::PROTOBUF_NAMESPACE_ID::internal::ExtensionIdentifier<
@@ -7209,7 +7272,12 @@
   }
   inline void Swap(UninterpretedOption_NamePart* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -7223,11 +7291,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline UninterpretedOption_NamePart* New() const final {
-    return new UninterpretedOption_NamePart();
-  }
-
-  UninterpretedOption_NamePart* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  UninterpretedOption_NamePart* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<UninterpretedOption_NamePart>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -7242,8 +7306,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -7251,6 +7315,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(UninterpretedOption_NamePart* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.UninterpretedOption.NamePart";
@@ -7286,7 +7352,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name_part(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name_part();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name_part();
+  PROTOBUF_NODISCARD std::string* release_name_part();
   void set_allocated_name_part(std::string* name_part);
   private:
   const std::string& _internal_name_part() const;
@@ -7387,7 +7453,12 @@
   }
   inline void Swap(UninterpretedOption* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -7401,11 +7472,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline UninterpretedOption* New() const final {
-    return new UninterpretedOption();
-  }
-
-  UninterpretedOption* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  UninterpretedOption* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<UninterpretedOption>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -7420,8 +7487,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -7429,6 +7496,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(UninterpretedOption* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.UninterpretedOption";
@@ -7489,7 +7558,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_identifier_value(ArgT0&& arg0, ArgT... args);
   std::string* mutable_identifier_value();
-  PROTOBUF_MUST_USE_RESULT std::string* release_identifier_value();
+  PROTOBUF_NODISCARD std::string* release_identifier_value();
   void set_allocated_identifier_value(std::string* identifier_value);
   private:
   const std::string& _internal_identifier_value() const;
@@ -7507,7 +7576,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_string_value(ArgT0&& arg0, ArgT... args);
   std::string* mutable_string_value();
-  PROTOBUF_MUST_USE_RESULT std::string* release_string_value();
+  PROTOBUF_NODISCARD std::string* release_string_value();
   void set_allocated_string_value(std::string* string_value);
   private:
   const std::string& _internal_string_value() const;
@@ -7525,7 +7594,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_aggregate_value(ArgT0&& arg0, ArgT... args);
   std::string* mutable_aggregate_value();
-  PROTOBUF_MUST_USE_RESULT std::string* release_aggregate_value();
+  PROTOBUF_NODISCARD std::string* release_aggregate_value();
   void set_allocated_aggregate_value(std::string* aggregate_value);
   private:
   const std::string& _internal_aggregate_value() const;
@@ -7539,11 +7608,11 @@
   bool _internal_has_positive_int_value() const;
   public:
   void clear_positive_int_value();
-  ::PROTOBUF_NAMESPACE_ID::uint64 positive_int_value() const;
-  void set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value);
+  uint64_t positive_int_value() const;
+  void set_positive_int_value(uint64_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::uint64 _internal_positive_int_value() const;
-  void _internal_set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value);
+  uint64_t _internal_positive_int_value() const;
+  void _internal_set_positive_int_value(uint64_t value);
   public:
 
   // optional int64 negative_int_value = 5;
@@ -7552,11 +7621,11 @@
   bool _internal_has_negative_int_value() const;
   public:
   void clear_negative_int_value();
-  ::PROTOBUF_NAMESPACE_ID::int64 negative_int_value() const;
-  void set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value);
+  int64_t negative_int_value() const;
+  void set_negative_int_value(int64_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int64 _internal_negative_int_value() const;
-  void _internal_set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value);
+  int64_t _internal_negative_int_value() const;
+  void _internal_set_negative_int_value(int64_t value);
   public:
 
   // optional double double_value = 6;
@@ -7585,8 +7654,8 @@
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr identifier_value_;
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr string_value_;
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr aggregate_value_;
-  ::PROTOBUF_NAMESPACE_ID::uint64 positive_int_value_;
-  ::PROTOBUF_NAMESPACE_ID::int64 negative_int_value_;
+  uint64_t positive_int_value_;
+  int64_t negative_int_value_;
   double double_value_;
   friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto;
 };
@@ -7654,7 +7723,12 @@
   }
   inline void Swap(SourceCodeInfo_Location* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -7668,11 +7742,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline SourceCodeInfo_Location* New() const final {
-    return new SourceCodeInfo_Location();
-  }
-
-  SourceCodeInfo_Location* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  SourceCodeInfo_Location* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<SourceCodeInfo_Location>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -7687,8 +7757,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -7696,6 +7766,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(SourceCodeInfo_Location* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.SourceCodeInfo.Location";
@@ -7731,19 +7803,19 @@
   public:
   void clear_path();
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_path(int index) const;
-  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+  int32_t _internal_path(int index) const;
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
       _internal_path() const;
-  void _internal_add_path(::PROTOBUF_NAMESPACE_ID::int32 value);
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+  void _internal_add_path(int32_t value);
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
       _internal_mutable_path();
   public:
-  ::PROTOBUF_NAMESPACE_ID::int32 path(int index) const;
-  void set_path(int index, ::PROTOBUF_NAMESPACE_ID::int32 value);
-  void add_path(::PROTOBUF_NAMESPACE_ID::int32 value);
-  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+  int32_t path(int index) const;
+  void set_path(int index, int32_t value);
+  void add_path(int32_t value);
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
       path() const;
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
       mutable_path();
 
   // repeated int32 span = 2 [packed = true];
@@ -7753,19 +7825,19 @@
   public:
   void clear_span();
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_span(int index) const;
-  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+  int32_t _internal_span(int index) const;
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
       _internal_span() const;
-  void _internal_add_span(::PROTOBUF_NAMESPACE_ID::int32 value);
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+  void _internal_add_span(int32_t value);
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
       _internal_mutable_span();
   public:
-  ::PROTOBUF_NAMESPACE_ID::int32 span(int index) const;
-  void set_span(int index, ::PROTOBUF_NAMESPACE_ID::int32 value);
-  void add_span(::PROTOBUF_NAMESPACE_ID::int32 value);
-  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+  int32_t span(int index) const;
+  void set_span(int index, int32_t value);
+  void add_span(int32_t value);
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
       span() const;
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
       mutable_span();
 
   // repeated string leading_detached_comments = 6;
@@ -7802,7 +7874,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_leading_comments(ArgT0&& arg0, ArgT... args);
   std::string* mutable_leading_comments();
-  PROTOBUF_MUST_USE_RESULT std::string* release_leading_comments();
+  PROTOBUF_NODISCARD std::string* release_leading_comments();
   void set_allocated_leading_comments(std::string* leading_comments);
   private:
   const std::string& _internal_leading_comments() const;
@@ -7820,7 +7892,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_trailing_comments(ArgT0&& arg0, ArgT... args);
   std::string* mutable_trailing_comments();
-  PROTOBUF_MUST_USE_RESULT std::string* release_trailing_comments();
+  PROTOBUF_NODISCARD std::string* release_trailing_comments();
   void set_allocated_trailing_comments(std::string* trailing_comments);
   private:
   const std::string& _internal_trailing_comments() const;
@@ -7837,9 +7909,9 @@
   typedef void DestructorSkippable_;
   ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > path_;
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t > path_;
   mutable std::atomic<int> _path_cached_byte_size_;
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > span_;
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t > span_;
   mutable std::atomic<int> _span_cached_byte_size_;
   ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField<std::string> leading_detached_comments_;
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr leading_comments_;
@@ -7910,7 +7982,12 @@
   }
   inline void Swap(SourceCodeInfo* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -7924,11 +8001,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline SourceCodeInfo* New() const final {
-    return new SourceCodeInfo();
-  }
-
-  SourceCodeInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  SourceCodeInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<SourceCodeInfo>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -7943,8 +8016,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -7952,6 +8025,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(SourceCodeInfo* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.SourceCodeInfo";
@@ -8071,7 +8146,12 @@
   }
   inline void Swap(GeneratedCodeInfo_Annotation* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -8085,11 +8165,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline GeneratedCodeInfo_Annotation* New() const final {
-    return new GeneratedCodeInfo_Annotation();
-  }
-
-  GeneratedCodeInfo_Annotation* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  GeneratedCodeInfo_Annotation* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<GeneratedCodeInfo_Annotation>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -8104,8 +8180,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -8113,6 +8189,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(GeneratedCodeInfo_Annotation* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.GeneratedCodeInfo.Annotation";
@@ -8147,19 +8225,19 @@
   public:
   void clear_path();
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_path(int index) const;
-  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+  int32_t _internal_path(int index) const;
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
       _internal_path() const;
-  void _internal_add_path(::PROTOBUF_NAMESPACE_ID::int32 value);
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+  void _internal_add_path(int32_t value);
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
       _internal_mutable_path();
   public:
-  ::PROTOBUF_NAMESPACE_ID::int32 path(int index) const;
-  void set_path(int index, ::PROTOBUF_NAMESPACE_ID::int32 value);
-  void add_path(::PROTOBUF_NAMESPACE_ID::int32 value);
-  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+  int32_t path(int index) const;
+  void set_path(int index, int32_t value);
+  void add_path(int32_t value);
+  const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
       path() const;
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
       mutable_path();
 
   // optional string source_file = 2;
@@ -8172,7 +8250,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_source_file(ArgT0&& arg0, ArgT... args);
   std::string* mutable_source_file();
-  PROTOBUF_MUST_USE_RESULT std::string* release_source_file();
+  PROTOBUF_NODISCARD std::string* release_source_file();
   void set_allocated_source_file(std::string* source_file);
   private:
   const std::string& _internal_source_file() const;
@@ -8186,11 +8264,11 @@
   bool _internal_has_begin() const;
   public:
   void clear_begin();
-  ::PROTOBUF_NAMESPACE_ID::int32 begin() const;
-  void set_begin(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t begin() const;
+  void set_begin(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_begin() const;
-  void _internal_set_begin(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_begin() const;
+  void _internal_set_begin(int32_t value);
   public:
 
   // optional int32 end = 4;
@@ -8199,11 +8277,11 @@
   bool _internal_has_end() const;
   public:
   void clear_end();
-  ::PROTOBUF_NAMESPACE_ID::int32 end() const;
-  void set_end(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t end() const;
+  void set_end(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_end() const;
-  void _internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_end() const;
+  void _internal_set_end(int32_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.GeneratedCodeInfo.Annotation)
@@ -8215,11 +8293,11 @@
   typedef void DestructorSkippable_;
   ::PROTOBUF_NAMESPACE_ID::internal::HasBits<1> _has_bits_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
-  ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 > path_;
+  ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t > path_;
   mutable std::atomic<int> _path_cached_byte_size_;
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr source_file_;
-  ::PROTOBUF_NAMESPACE_ID::int32 begin_;
-  ::PROTOBUF_NAMESPACE_ID::int32 end_;
+  int32_t begin_;
+  int32_t end_;
   friend struct ::TableStruct_google_2fprotobuf_2fdescriptor_2eproto;
 };
 // -------------------------------------------------------------------
@@ -8286,7 +8364,12 @@
   }
   inline void Swap(GeneratedCodeInfo* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -8300,11 +8383,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline GeneratedCodeInfo* New() const final {
-    return new GeneratedCodeInfo();
-  }
-
-  GeneratedCodeInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  GeneratedCodeInfo* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<GeneratedCodeInfo>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -8319,8 +8398,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -8328,6 +8407,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(GeneratedCodeInfo* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.GeneratedCodeInfo";
@@ -8483,7 +8564,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileDescriptorProto::set_allocated_name(std::string* name) {
   if (name != nullptr) {
@@ -8493,6 +8580,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.name)
 }
 
@@ -8541,7 +8633,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000002u;
-  return package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileDescriptorProto::set_allocated_package(std::string* package) {
   if (package != nullptr) {
@@ -8551,6 +8649,11 @@
   }
   package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), package,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.package)
 }
 
@@ -8639,38 +8742,38 @@
 inline void FileDescriptorProto::clear_public_dependency() {
   public_dependency_.Clear();
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 FileDescriptorProto::_internal_public_dependency(int index) const {
+inline int32_t FileDescriptorProto::_internal_public_dependency(int index) const {
   return public_dependency_.Get(index);
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 FileDescriptorProto::public_dependency(int index) const {
+inline int32_t FileDescriptorProto::public_dependency(int index) const {
   // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.public_dependency)
   return _internal_public_dependency(index);
 }
-inline void FileDescriptorProto::set_public_dependency(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void FileDescriptorProto::set_public_dependency(int index, int32_t value) {
   public_dependency_.Set(index, value);
   // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.public_dependency)
 }
-inline void FileDescriptorProto::_internal_add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void FileDescriptorProto::_internal_add_public_dependency(int32_t value) {
   public_dependency_.Add(value);
 }
-inline void FileDescriptorProto::add_public_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void FileDescriptorProto::add_public_dependency(int32_t value) {
   _internal_add_public_dependency(value);
   // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.public_dependency)
 }
-inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
 FileDescriptorProto::_internal_public_dependency() const {
   return public_dependency_;
 }
-inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
 FileDescriptorProto::public_dependency() const {
   // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.public_dependency)
   return _internal_public_dependency();
 }
-inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
 FileDescriptorProto::_internal_mutable_public_dependency() {
   return &public_dependency_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
 FileDescriptorProto::mutable_public_dependency() {
   // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.public_dependency)
   return _internal_mutable_public_dependency();
@@ -8686,38 +8789,38 @@
 inline void FileDescriptorProto::clear_weak_dependency() {
   weak_dependency_.Clear();
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 FileDescriptorProto::_internal_weak_dependency(int index) const {
+inline int32_t FileDescriptorProto::_internal_weak_dependency(int index) const {
   return weak_dependency_.Get(index);
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 FileDescriptorProto::weak_dependency(int index) const {
+inline int32_t FileDescriptorProto::weak_dependency(int index) const {
   // @@protoc_insertion_point(field_get:google.protobuf.FileDescriptorProto.weak_dependency)
   return _internal_weak_dependency(index);
 }
-inline void FileDescriptorProto::set_weak_dependency(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void FileDescriptorProto::set_weak_dependency(int index, int32_t value) {
   weak_dependency_.Set(index, value);
   // @@protoc_insertion_point(field_set:google.protobuf.FileDescriptorProto.weak_dependency)
 }
-inline void FileDescriptorProto::_internal_add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void FileDescriptorProto::_internal_add_weak_dependency(int32_t value) {
   weak_dependency_.Add(value);
 }
-inline void FileDescriptorProto::add_weak_dependency(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void FileDescriptorProto::add_weak_dependency(int32_t value) {
   _internal_add_weak_dependency(value);
   // @@protoc_insertion_point(field_add:google.protobuf.FileDescriptorProto.weak_dependency)
 }
-inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
 FileDescriptorProto::_internal_weak_dependency() const {
   return weak_dependency_;
 }
-inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
 FileDescriptorProto::weak_dependency() const {
   // @@protoc_insertion_point(field_list:google.protobuf.FileDescriptorProto.weak_dependency)
   return _internal_weak_dependency();
 }
-inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
 FileDescriptorProto::_internal_mutable_weak_dependency() {
   return &weak_dependency_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
 FileDescriptorProto::mutable_weak_dependency() {
   // @@protoc_insertion_point(field_mutable_list:google.protobuf.FileDescriptorProto.weak_dependency)
   return _internal_mutable_weak_dependency();
@@ -9108,7 +9211,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000004u;
-  return syntax_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = syntax_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (syntax_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileDescriptorProto::set_allocated_syntax(std::string* syntax) {
   if (syntax != nullptr) {
@@ -9118,6 +9227,11 @@
   }
   syntax_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), syntax,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (syntax_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    syntax_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileDescriptorProto.syntax)
 }
 
@@ -9137,18 +9251,18 @@
   start_ = 0;
   _has_bits_[0] &= ~0x00000002u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ExtensionRange::_internal_start() const {
+inline int32_t DescriptorProto_ExtensionRange::_internal_start() const {
   return start_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ExtensionRange::start() const {
+inline int32_t DescriptorProto_ExtensionRange::start() const {
   // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.start)
   return _internal_start();
 }
-inline void DescriptorProto_ExtensionRange::_internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void DescriptorProto_ExtensionRange::_internal_set_start(int32_t value) {
   _has_bits_[0] |= 0x00000002u;
   start_ = value;
 }
-inline void DescriptorProto_ExtensionRange::set_start(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void DescriptorProto_ExtensionRange::set_start(int32_t value) {
   _internal_set_start(value);
   // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.start)
 }
@@ -9165,18 +9279,18 @@
   end_ = 0;
   _has_bits_[0] &= ~0x00000004u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ExtensionRange::_internal_end() const {
+inline int32_t DescriptorProto_ExtensionRange::_internal_end() const {
   return end_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ExtensionRange::end() const {
+inline int32_t DescriptorProto_ExtensionRange::end() const {
   // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ExtensionRange.end)
   return _internal_end();
 }
-inline void DescriptorProto_ExtensionRange::_internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void DescriptorProto_ExtensionRange::_internal_set_end(int32_t value) {
   _has_bits_[0] |= 0x00000004u;
   end_ = value;
 }
-inline void DescriptorProto_ExtensionRange::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void DescriptorProto_ExtensionRange::set_end(int32_t value) {
   _internal_set_end(value);
   // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ExtensionRange.end)
 }
@@ -9287,18 +9401,18 @@
   start_ = 0;
   _has_bits_[0] &= ~0x00000001u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ReservedRange::_internal_start() const {
+inline int32_t DescriptorProto_ReservedRange::_internal_start() const {
   return start_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ReservedRange::start() const {
+inline int32_t DescriptorProto_ReservedRange::start() const {
   // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ReservedRange.start)
   return _internal_start();
 }
-inline void DescriptorProto_ReservedRange::_internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void DescriptorProto_ReservedRange::_internal_set_start(int32_t value) {
   _has_bits_[0] |= 0x00000001u;
   start_ = value;
 }
-inline void DescriptorProto_ReservedRange::set_start(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void DescriptorProto_ReservedRange::set_start(int32_t value) {
   _internal_set_start(value);
   // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ReservedRange.start)
 }
@@ -9315,18 +9429,18 @@
   end_ = 0;
   _has_bits_[0] &= ~0x00000002u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ReservedRange::_internal_end() const {
+inline int32_t DescriptorProto_ReservedRange::_internal_end() const {
   return end_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 DescriptorProto_ReservedRange::end() const {
+inline int32_t DescriptorProto_ReservedRange::end() const {
   // @@protoc_insertion_point(field_get:google.protobuf.DescriptorProto.ReservedRange.end)
   return _internal_end();
 }
-inline void DescriptorProto_ReservedRange::_internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void DescriptorProto_ReservedRange::_internal_set_end(int32_t value) {
   _has_bits_[0] |= 0x00000002u;
   end_ = value;
 }
-inline void DescriptorProto_ReservedRange::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void DescriptorProto_ReservedRange::set_end(int32_t value) {
   _internal_set_end(value);
   // @@protoc_insertion_point(field_set:google.protobuf.DescriptorProto.ReservedRange.end)
 }
@@ -9380,7 +9494,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void DescriptorProto::set_allocated_name(std::string* name) {
   if (name != nullptr) {
@@ -9390,6 +9510,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.DescriptorProto.name)
 }
 
@@ -9931,7 +10056,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FieldDescriptorProto::set_allocated_name(std::string* name) {
   if (name != nullptr) {
@@ -9941,6 +10072,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.name)
 }
 
@@ -9956,18 +10092,18 @@
   number_ = 0;
   _has_bits_[0] &= ~0x00000040u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 FieldDescriptorProto::_internal_number() const {
+inline int32_t FieldDescriptorProto::_internal_number() const {
   return number_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 FieldDescriptorProto::number() const {
+inline int32_t FieldDescriptorProto::number() const {
   // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.number)
   return _internal_number();
 }
-inline void FieldDescriptorProto::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void FieldDescriptorProto::_internal_set_number(int32_t value) {
   _has_bits_[0] |= 0x00000040u;
   number_ = value;
 }
-inline void FieldDescriptorProto::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void FieldDescriptorProto::set_number(int32_t value) {
   _internal_set_number(value);
   // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.number)
 }
@@ -10075,7 +10211,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000004u;
-  return type_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = type_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (type_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FieldDescriptorProto::set_allocated_type_name(std::string* type_name) {
   if (type_name != nullptr) {
@@ -10085,6 +10227,11 @@
   }
   type_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (type_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    type_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.type_name)
 }
 
@@ -10133,7 +10280,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000002u;
-  return extendee_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = extendee_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (extendee_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FieldDescriptorProto::set_allocated_extendee(std::string* extendee) {
   if (extendee != nullptr) {
@@ -10143,6 +10296,11 @@
   }
   extendee_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), extendee,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (extendee_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    extendee_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.extendee)
 }
 
@@ -10191,7 +10349,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000008u;
-  return default_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = default_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (default_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FieldDescriptorProto::set_allocated_default_value(std::string* default_value) {
   if (default_value != nullptr) {
@@ -10201,6 +10365,11 @@
   }
   default_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), default_value,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (default_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.default_value)
 }
 
@@ -10216,18 +10385,18 @@
   oneof_index_ = 0;
   _has_bits_[0] &= ~0x00000080u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 FieldDescriptorProto::_internal_oneof_index() const {
+inline int32_t FieldDescriptorProto::_internal_oneof_index() const {
   return oneof_index_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 FieldDescriptorProto::oneof_index() const {
+inline int32_t FieldDescriptorProto::oneof_index() const {
   // @@protoc_insertion_point(field_get:google.protobuf.FieldDescriptorProto.oneof_index)
   return _internal_oneof_index();
 }
-inline void FieldDescriptorProto::_internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void FieldDescriptorProto::_internal_set_oneof_index(int32_t value) {
   _has_bits_[0] |= 0x00000080u;
   oneof_index_ = value;
 }
-inline void FieldDescriptorProto::set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void FieldDescriptorProto::set_oneof_index(int32_t value) {
   _internal_set_oneof_index(value);
   // @@protoc_insertion_point(field_set:google.protobuf.FieldDescriptorProto.oneof_index)
 }
@@ -10277,7 +10446,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000010u;
-  return json_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = json_name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (json_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FieldDescriptorProto::set_allocated_json_name(std::string* json_name) {
   if (json_name != nullptr) {
@@ -10287,6 +10462,11 @@
   }
   json_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), json_name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (json_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FieldDescriptorProto.json_name)
 }
 
@@ -10457,7 +10637,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void OneofDescriptorProto::set_allocated_name(std::string* name) {
   if (name != nullptr) {
@@ -10467,6 +10653,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.OneofDescriptorProto.name)
 }
 
@@ -10576,18 +10767,18 @@
   start_ = 0;
   _has_bits_[0] &= ~0x00000001u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 EnumDescriptorProto_EnumReservedRange::_internal_start() const {
+inline int32_t EnumDescriptorProto_EnumReservedRange::_internal_start() const {
   return start_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 EnumDescriptorProto_EnumReservedRange::start() const {
+inline int32_t EnumDescriptorProto_EnumReservedRange::start() const {
   // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.EnumReservedRange.start)
   return _internal_start();
 }
-inline void EnumDescriptorProto_EnumReservedRange::_internal_set_start(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void EnumDescriptorProto_EnumReservedRange::_internal_set_start(int32_t value) {
   _has_bits_[0] |= 0x00000001u;
   start_ = value;
 }
-inline void EnumDescriptorProto_EnumReservedRange::set_start(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void EnumDescriptorProto_EnumReservedRange::set_start(int32_t value) {
   _internal_set_start(value);
   // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.EnumReservedRange.start)
 }
@@ -10604,18 +10795,18 @@
   end_ = 0;
   _has_bits_[0] &= ~0x00000002u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 EnumDescriptorProto_EnumReservedRange::_internal_end() const {
+inline int32_t EnumDescriptorProto_EnumReservedRange::_internal_end() const {
   return end_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 EnumDescriptorProto_EnumReservedRange::end() const {
+inline int32_t EnumDescriptorProto_EnumReservedRange::end() const {
   // @@protoc_insertion_point(field_get:google.protobuf.EnumDescriptorProto.EnumReservedRange.end)
   return _internal_end();
 }
-inline void EnumDescriptorProto_EnumReservedRange::_internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void EnumDescriptorProto_EnumReservedRange::_internal_set_end(int32_t value) {
   _has_bits_[0] |= 0x00000002u;
   end_ = value;
 }
-inline void EnumDescriptorProto_EnumReservedRange::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void EnumDescriptorProto_EnumReservedRange::set_end(int32_t value) {
   _internal_set_end(value);
   // @@protoc_insertion_point(field_set:google.protobuf.EnumDescriptorProto.EnumReservedRange.end)
 }
@@ -10669,7 +10860,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void EnumDescriptorProto::set_allocated_name(std::string* name) {
   if (name != nullptr) {
@@ -10679,6 +10876,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumDescriptorProto.name)
 }
 
@@ -10976,7 +11178,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void EnumValueDescriptorProto::set_allocated_name(std::string* name) {
   if (name != nullptr) {
@@ -10986,6 +11194,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValueDescriptorProto.name)
 }
 
@@ -11001,18 +11214,18 @@
   number_ = 0;
   _has_bits_[0] &= ~0x00000004u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValueDescriptorProto::_internal_number() const {
+inline int32_t EnumValueDescriptorProto::_internal_number() const {
   return number_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValueDescriptorProto::number() const {
+inline int32_t EnumValueDescriptorProto::number() const {
   // @@protoc_insertion_point(field_get:google.protobuf.EnumValueDescriptorProto.number)
   return _internal_number();
 }
-inline void EnumValueDescriptorProto::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void EnumValueDescriptorProto::_internal_set_number(int32_t value) {
   _has_bits_[0] |= 0x00000004u;
   number_ = value;
 }
-inline void EnumValueDescriptorProto::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void EnumValueDescriptorProto::set_number(int32_t value) {
   _internal_set_number(value);
   // @@protoc_insertion_point(field_set:google.protobuf.EnumValueDescriptorProto.number)
 }
@@ -11156,7 +11369,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void ServiceDescriptorProto::set_allocated_name(std::string* name) {
   if (name != nullptr) {
@@ -11166,6 +11385,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.ServiceDescriptorProto.name)
 }
 
@@ -11348,7 +11572,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = name_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void MethodDescriptorProto::set_allocated_name(std::string* name) {
   if (name != nullptr) {
@@ -11358,6 +11588,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.name)
 }
 
@@ -11406,7 +11641,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000002u;
-  return input_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = input_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (input_type_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void MethodDescriptorProto::set_allocated_input_type(std::string* input_type) {
   if (input_type != nullptr) {
@@ -11416,6 +11657,11 @@
   }
   input_type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), input_type,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (input_type_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    input_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.input_type)
 }
 
@@ -11464,7 +11710,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000004u;
-  return output_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = output_type_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (output_type_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void MethodDescriptorProto::set_allocated_output_type(std::string* output_type) {
   if (output_type != nullptr) {
@@ -11474,6 +11726,11 @@
   }
   output_type_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), output_type,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (output_type_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    output_type_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.MethodDescriptorProto.output_type)
 }
 
@@ -11672,7 +11929,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return java_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = java_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (java_package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileOptions::set_allocated_java_package(std::string* java_package) {
   if (java_package != nullptr) {
@@ -11682,6 +11945,11 @@
   }
   java_package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), java_package,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (java_package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    java_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_package)
 }
 
@@ -11730,7 +11998,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000002u;
-  return java_outer_classname_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = java_outer_classname_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (java_outer_classname_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileOptions::set_allocated_java_outer_classname(std::string* java_outer_classname) {
   if (java_outer_classname != nullptr) {
@@ -11740,6 +12014,11 @@
   }
   java_outer_classname_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), java_outer_classname,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (java_outer_classname_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    java_outer_classname_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.java_outer_classname)
 }
 
@@ -11901,7 +12180,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000004u;
-  return go_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = go_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (go_package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileOptions::set_allocated_go_package(std::string* go_package) {
   if (go_package != nullptr) {
@@ -11911,6 +12196,11 @@
   }
   go_package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), go_package,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (go_package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    go_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.go_package)
 }
 
@@ -12127,7 +12417,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000008u;
-  return objc_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = objc_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (objc_class_prefix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileOptions::set_allocated_objc_class_prefix(std::string* objc_class_prefix) {
   if (objc_class_prefix != nullptr) {
@@ -12137,6 +12433,11 @@
   }
   objc_class_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), objc_class_prefix,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (objc_class_prefix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    objc_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.objc_class_prefix)
 }
 
@@ -12185,7 +12486,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000010u;
-  return csharp_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = csharp_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (csharp_namespace_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileOptions::set_allocated_csharp_namespace(std::string* csharp_namespace) {
   if (csharp_namespace != nullptr) {
@@ -12195,6 +12502,11 @@
   }
   csharp_namespace_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), csharp_namespace,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (csharp_namespace_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    csharp_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace)
 }
 
@@ -12243,7 +12555,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000020u;
-  return swift_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = swift_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (swift_prefix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileOptions::set_allocated_swift_prefix(std::string* swift_prefix) {
   if (swift_prefix != nullptr) {
@@ -12253,6 +12571,11 @@
   }
   swift_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), swift_prefix,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (swift_prefix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    swift_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.swift_prefix)
 }
 
@@ -12301,7 +12624,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000040u;
-  return php_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = php_class_prefix_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (php_class_prefix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileOptions::set_allocated_php_class_prefix(std::string* php_class_prefix) {
   if (php_class_prefix != nullptr) {
@@ -12311,6 +12640,11 @@
   }
   php_class_prefix_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), php_class_prefix,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (php_class_prefix_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    php_class_prefix_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_class_prefix)
 }
 
@@ -12359,7 +12693,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000080u;
-  return php_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = php_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (php_namespace_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileOptions::set_allocated_php_namespace(std::string* php_namespace) {
   if (php_namespace != nullptr) {
@@ -12369,6 +12709,11 @@
   }
   php_namespace_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), php_namespace,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (php_namespace_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    php_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_namespace)
 }
 
@@ -12417,7 +12762,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000100u;
-  return php_metadata_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = php_metadata_namespace_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (php_metadata_namespace_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileOptions::set_allocated_php_metadata_namespace(std::string* php_metadata_namespace) {
   if (php_metadata_namespace != nullptr) {
@@ -12427,6 +12778,11 @@
   }
   php_metadata_namespace_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), php_metadata_namespace,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (php_metadata_namespace_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    php_metadata_namespace_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.php_metadata_namespace)
 }
 
@@ -12475,7 +12831,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000200u;
-  return ruby_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = ruby_package_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (ruby_package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void FileOptions::set_allocated_ruby_package(std::string* ruby_package) {
   if (ruby_package != nullptr) {
@@ -12485,6 +12847,11 @@
   }
   ruby_package_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ruby_package,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (ruby_package_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    ruby_package_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.ruby_package)
 }
 
@@ -13336,7 +13703,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return name_part_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = name_part_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_part_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void UninterpretedOption_NamePart::set_allocated_name_part(std::string* name_part) {
   if (name_part != nullptr) {
@@ -13346,6 +13719,11 @@
   }
   name_part_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name_part,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_part_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_part_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.NamePart.name_part)
 }
 
@@ -13466,7 +13844,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return identifier_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = identifier_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (identifier_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void UninterpretedOption::set_allocated_identifier_value(std::string* identifier_value) {
   if (identifier_value != nullptr) {
@@ -13476,6 +13860,11 @@
   }
   identifier_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), identifier_value,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (identifier_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    identifier_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.identifier_value)
 }
 
@@ -13491,18 +13880,18 @@
   positive_int_value_ = uint64_t{0u};
   _has_bits_[0] &= ~0x00000008u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::uint64 UninterpretedOption::_internal_positive_int_value() const {
+inline uint64_t UninterpretedOption::_internal_positive_int_value() const {
   return positive_int_value_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::uint64 UninterpretedOption::positive_int_value() const {
+inline uint64_t UninterpretedOption::positive_int_value() const {
   // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.positive_int_value)
   return _internal_positive_int_value();
 }
-inline void UninterpretedOption::_internal_set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value) {
+inline void UninterpretedOption::_internal_set_positive_int_value(uint64_t value) {
   _has_bits_[0] |= 0x00000008u;
   positive_int_value_ = value;
 }
-inline void UninterpretedOption::set_positive_int_value(::PROTOBUF_NAMESPACE_ID::uint64 value) {
+inline void UninterpretedOption::set_positive_int_value(uint64_t value) {
   _internal_set_positive_int_value(value);
   // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.positive_int_value)
 }
@@ -13519,18 +13908,18 @@
   negative_int_value_ = int64_t{0};
   _has_bits_[0] &= ~0x00000010u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int64 UninterpretedOption::_internal_negative_int_value() const {
+inline int64_t UninterpretedOption::_internal_negative_int_value() const {
   return negative_int_value_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int64 UninterpretedOption::negative_int_value() const {
+inline int64_t UninterpretedOption::negative_int_value() const {
   // @@protoc_insertion_point(field_get:google.protobuf.UninterpretedOption.negative_int_value)
   return _internal_negative_int_value();
 }
-inline void UninterpretedOption::_internal_set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value) {
+inline void UninterpretedOption::_internal_set_negative_int_value(int64_t value) {
   _has_bits_[0] |= 0x00000010u;
   negative_int_value_ = value;
 }
-inline void UninterpretedOption::set_negative_int_value(::PROTOBUF_NAMESPACE_ID::int64 value) {
+inline void UninterpretedOption::set_negative_int_value(int64_t value) {
   _internal_set_negative_int_value(value);
   // @@protoc_insertion_point(field_set:google.protobuf.UninterpretedOption.negative_int_value)
 }
@@ -13608,7 +13997,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000002u;
-  return string_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = string_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (string_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void UninterpretedOption::set_allocated_string_value(std::string* string_value) {
   if (string_value != nullptr) {
@@ -13618,6 +14013,11 @@
   }
   string_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), string_value,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (string_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    string_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.string_value)
 }
 
@@ -13666,7 +14066,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000004u;
-  return aggregate_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = aggregate_value_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (aggregate_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void UninterpretedOption::set_allocated_aggregate_value(std::string* aggregate_value) {
   if (aggregate_value != nullptr) {
@@ -13676,6 +14082,11 @@
   }
   aggregate_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), aggregate_value,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (aggregate_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    aggregate_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.UninterpretedOption.aggregate_value)
 }
 
@@ -13693,38 +14104,38 @@
 inline void SourceCodeInfo_Location::clear_path() {
   path_.Clear();
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 SourceCodeInfo_Location::_internal_path(int index) const {
+inline int32_t SourceCodeInfo_Location::_internal_path(int index) const {
   return path_.Get(index);
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 SourceCodeInfo_Location::path(int index) const {
+inline int32_t SourceCodeInfo_Location::path(int index) const {
   // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.path)
   return _internal_path(index);
 }
-inline void SourceCodeInfo_Location::set_path(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void SourceCodeInfo_Location::set_path(int index, int32_t value) {
   path_.Set(index, value);
   // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.path)
 }
-inline void SourceCodeInfo_Location::_internal_add_path(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void SourceCodeInfo_Location::_internal_add_path(int32_t value) {
   path_.Add(value);
 }
-inline void SourceCodeInfo_Location::add_path(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void SourceCodeInfo_Location::add_path(int32_t value) {
   _internal_add_path(value);
   // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.path)
 }
-inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
 SourceCodeInfo_Location::_internal_path() const {
   return path_;
 }
-inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
 SourceCodeInfo_Location::path() const {
   // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.path)
   return _internal_path();
 }
-inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
 SourceCodeInfo_Location::_internal_mutable_path() {
   return &path_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
 SourceCodeInfo_Location::mutable_path() {
   // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.path)
   return _internal_mutable_path();
@@ -13740,38 +14151,38 @@
 inline void SourceCodeInfo_Location::clear_span() {
   span_.Clear();
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 SourceCodeInfo_Location::_internal_span(int index) const {
+inline int32_t SourceCodeInfo_Location::_internal_span(int index) const {
   return span_.Get(index);
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 SourceCodeInfo_Location::span(int index) const {
+inline int32_t SourceCodeInfo_Location::span(int index) const {
   // @@protoc_insertion_point(field_get:google.protobuf.SourceCodeInfo.Location.span)
   return _internal_span(index);
 }
-inline void SourceCodeInfo_Location::set_span(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void SourceCodeInfo_Location::set_span(int index, int32_t value) {
   span_.Set(index, value);
   // @@protoc_insertion_point(field_set:google.protobuf.SourceCodeInfo.Location.span)
 }
-inline void SourceCodeInfo_Location::_internal_add_span(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void SourceCodeInfo_Location::_internal_add_span(int32_t value) {
   span_.Add(value);
 }
-inline void SourceCodeInfo_Location::add_span(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void SourceCodeInfo_Location::add_span(int32_t value) {
   _internal_add_span(value);
   // @@protoc_insertion_point(field_add:google.protobuf.SourceCodeInfo.Location.span)
 }
-inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
 SourceCodeInfo_Location::_internal_span() const {
   return span_;
 }
-inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
 SourceCodeInfo_Location::span() const {
   // @@protoc_insertion_point(field_list:google.protobuf.SourceCodeInfo.Location.span)
   return _internal_span();
 }
-inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
 SourceCodeInfo_Location::_internal_mutable_span() {
   return &span_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
 SourceCodeInfo_Location::mutable_span() {
   // @@protoc_insertion_point(field_mutable_list:google.protobuf.SourceCodeInfo.Location.span)
   return _internal_mutable_span();
@@ -13822,7 +14233,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return leading_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = leading_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (leading_comments_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void SourceCodeInfo_Location::set_allocated_leading_comments(std::string* leading_comments) {
   if (leading_comments != nullptr) {
@@ -13832,6 +14249,11 @@
   }
   leading_comments_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), leading_comments,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (leading_comments_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    leading_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.leading_comments)
 }
 
@@ -13880,7 +14302,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000002u;
-  return trailing_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = trailing_comments_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (trailing_comments_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void SourceCodeInfo_Location::set_allocated_trailing_comments(std::string* trailing_comments) {
   if (trailing_comments != nullptr) {
@@ -13890,6 +14318,11 @@
   }
   trailing_comments_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), trailing_comments,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (trailing_comments_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    trailing_comments_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceCodeInfo.Location.trailing_comments)
 }
 
@@ -14026,38 +14459,38 @@
 inline void GeneratedCodeInfo_Annotation::clear_path() {
   path_.Clear();
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::_internal_path(int index) const {
+inline int32_t GeneratedCodeInfo_Annotation::_internal_path(int index) const {
   return path_.Get(index);
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::path(int index) const {
+inline int32_t GeneratedCodeInfo_Annotation::path(int index) const {
   // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.path)
   return _internal_path(index);
 }
-inline void GeneratedCodeInfo_Annotation::set_path(int index, ::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void GeneratedCodeInfo_Annotation::set_path(int index, int32_t value) {
   path_.Set(index, value);
   // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.path)
 }
-inline void GeneratedCodeInfo_Annotation::_internal_add_path(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void GeneratedCodeInfo_Annotation::_internal_add_path(int32_t value) {
   path_.Add(value);
 }
-inline void GeneratedCodeInfo_Annotation::add_path(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void GeneratedCodeInfo_Annotation::add_path(int32_t value) {
   _internal_add_path(value);
   // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.Annotation.path)
 }
-inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
 GeneratedCodeInfo_Annotation::_internal_path() const {
   return path_;
 }
-inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >&
+inline const ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >&
 GeneratedCodeInfo_Annotation::path() const {
   // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.Annotation.path)
   return _internal_path();
 }
-inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
 GeneratedCodeInfo_Annotation::_internal_mutable_path() {
   return &path_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< ::PROTOBUF_NAMESPACE_ID::int32 >*
+inline ::PROTOBUF_NAMESPACE_ID::RepeatedField< int32_t >*
 GeneratedCodeInfo_Annotation::mutable_path() {
   // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.Annotation.path)
   return _internal_mutable_path();
@@ -14108,7 +14541,13 @@
     return nullptr;
   }
   _has_bits_[0] &= ~0x00000001u;
-  return source_file_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+  auto* p = source_file_.ReleaseNonDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (source_file_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  return p;
 }
 inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(std::string* source_file) {
   if (source_file != nullptr) {
@@ -14118,6 +14557,11 @@
   }
   source_file_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), source_file,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (source_file_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    source_file_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file)
 }
 
@@ -14133,18 +14577,18 @@
   begin_ = 0;
   _has_bits_[0] &= ~0x00000002u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::_internal_begin() const {
+inline int32_t GeneratedCodeInfo_Annotation::_internal_begin() const {
   return begin_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::begin() const {
+inline int32_t GeneratedCodeInfo_Annotation::begin() const {
   // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.begin)
   return _internal_begin();
 }
-inline void GeneratedCodeInfo_Annotation::_internal_set_begin(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void GeneratedCodeInfo_Annotation::_internal_set_begin(int32_t value) {
   _has_bits_[0] |= 0x00000002u;
   begin_ = value;
 }
-inline void GeneratedCodeInfo_Annotation::set_begin(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void GeneratedCodeInfo_Annotation::set_begin(int32_t value) {
   _internal_set_begin(value);
   // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.begin)
 }
@@ -14161,18 +14605,18 @@
   end_ = 0;
   _has_bits_[0] &= ~0x00000004u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::_internal_end() const {
+inline int32_t GeneratedCodeInfo_Annotation::_internal_end() const {
   return end_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 GeneratedCodeInfo_Annotation::end() const {
+inline int32_t GeneratedCodeInfo_Annotation::end() const {
   // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.end)
   return _internal_end();
 }
-inline void GeneratedCodeInfo_Annotation::_internal_set_end(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void GeneratedCodeInfo_Annotation::_internal_set_end(int32_t value) {
   _has_bits_[0] |= 0x00000004u;
   end_ = value;
 }
-inline void GeneratedCodeInfo_Annotation::set_end(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void GeneratedCodeInfo_Annotation::set_end(int32_t value) {
   _internal_set_end(value);
   // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.end)
 }
diff --git a/src/google/protobuf/descriptor_database.cc b/src/google/protobuf/descriptor_database.cc
index b101dd2..be1afcb 100644
--- a/src/google/protobuf/descriptor_database.cc
+++ b/src/google/protobuf/descriptor_database.cc
@@ -381,7 +381,7 @@
 
 bool SimpleDescriptorDatabase::MaybeCopy(const FileDescriptorProto* file,
                                          FileDescriptorProto* output) {
-  if (file == NULL) return false;
+  if (file == nullptr) return false;
   output->CopyFrom(*file);
   return true;
 }
@@ -583,7 +583,7 @@
 bool EncodedDescriptorDatabase::FindNameOfFileContainingSymbol(
     const std::string& symbol_name, std::string* output) {
   auto encoded_file = index_->FindSymbol(symbol_name);
-  if (encoded_file.first == NULL) return false;
+  if (encoded_file.first == nullptr) return false;
 
   // Optimization:  The name should be the first field in the encoded message.
   //   Try to just read it directly.
@@ -871,7 +871,7 @@
 
 bool EncodedDescriptorDatabase::MaybeParse(
     std::pair<const void*, int> encoded_file, FileDescriptorProto* output) {
-  if (encoded_file.first == NULL) return false;
+  if (encoded_file.first == nullptr) return false;
   return output->ParseFromArray(encoded_file.first, encoded_file.second);
 }
 
@@ -893,7 +893,7 @@
 bool DescriptorPoolDatabase::FindFileByName(const std::string& filename,
                                             FileDescriptorProto* output) {
   const FileDescriptor* file = pool_.FindFileByName(filename);
-  if (file == NULL) return false;
+  if (file == nullptr) return false;
   output->Clear();
   file->CopyTo(output);
   return true;
@@ -902,7 +902,7 @@
 bool DescriptorPoolDatabase::FindFileContainingSymbol(
     const std::string& symbol_name, FileDescriptorProto* output) {
   const FileDescriptor* file = pool_.FindFileContainingSymbol(symbol_name);
-  if (file == NULL) return false;
+  if (file == nullptr) return false;
   output->Clear();
   file->CopyTo(output);
   return true;
@@ -912,11 +912,11 @@
     const std::string& containing_type, int field_number,
     FileDescriptorProto* output) {
   const Descriptor* extendee = pool_.FindMessageTypeByName(containing_type);
-  if (extendee == NULL) return false;
+  if (extendee == nullptr) return false;
 
   const FieldDescriptor* extension =
       pool_.FindExtensionByNumber(extendee, field_number);
-  if (extension == NULL) return false;
+  if (extension == nullptr) return false;
 
   output->Clear();
   extension->file()->CopyTo(output);
@@ -926,7 +926,7 @@
 bool DescriptorPoolDatabase::FindAllExtensionNumbers(
     const std::string& extendee_type, std::vector<int>* output) {
   const Descriptor* extendee = pool_.FindMessageTypeByName(extendee_type);
-  if (extendee == NULL) return false;
+  if (extendee == nullptr) return false;
 
   std::vector<const FieldDescriptor*> extensions;
   pool_.FindAllExtensions(extendee, &extensions);
diff --git a/src/google/protobuf/descriptor_database.h b/src/google/protobuf/descriptor_database.h
index 5fb593e..f2d144d 100644
--- a/src/google/protobuf/descriptor_database.h
+++ b/src/google/protobuf/descriptor_database.h
@@ -268,7 +268,7 @@
   DescriptorIndex<const FileDescriptorProto*> index_;
   std::vector<std::unique_ptr<const FileDescriptorProto>> files_to_delete_;
 
-  // If file is non-NULL, copy it into *output and return true, otherwise
+  // If file is non-nullptr, copy it into *output and return true, otherwise
   // return false.
   bool MaybeCopy(const FileDescriptorProto* file, FileDescriptorProto* output);
 
@@ -320,8 +320,8 @@
   std::unique_ptr<DescriptorIndex> index_;
   std::vector<void*> files_to_delete_;
 
-  // If encoded_file.first is non-NULL, parse the data into *output and return
-  // true, otherwise return false.
+  // If encoded_file.first is non-nullptr, parse the data into *output and
+  // return true, otherwise return false.
   bool MaybeParse(std::pair<const void*, int> encoded_file,
                   FileDescriptorProto* output);
 
diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc
index b98e7f7..6202f4f 100644
--- a/src/google/protobuf/descriptor_unittest.cc
+++ b/src/google/protobuf/descriptor_unittest.cc
@@ -299,7 +299,7 @@
 // Test simple files.
 class FileDescriptorTest : public testing::Test {
  protected:
-  virtual void SetUp() override {
+  void SetUp() override {
     // Build descriptors for the following definitions:
     //
     //   // in "foo.proto"
@@ -614,7 +614,7 @@
 // Test simple flat messages and fields.
 class DescriptorTest : public testing::Test {
  protected:
-  virtual void SetUp() override {
+  void SetUp() override {
     // Build descriptors for the following definitions:
     //
     //   // in "foo.proto"
@@ -776,6 +776,11 @@
     message->CopyJsonNameTo(proto);
   }
 
+  const EnumValueDescriptor* FindValueByNumberCreatingIfUnknown(
+      const EnumDescriptor* desc, int number) {
+    return desc->FindValueByNumberCreatingIfUnknown(number);
+  }
+
   DescriptorPool pool_;
 
   const FileDescriptor* foo_file_;
@@ -1101,7 +1106,7 @@
 // Test simple flat messages and fields.
 class OneofDescriptorTest : public testing::Test {
  protected:
-  virtual void SetUp() override {
+  void SetUp() override {
     // Build descriptors for the following definitions:
     //
     //   package garply;
@@ -1361,7 +1366,7 @@
 // Test enum descriptors.
 class EnumDescriptorTest : public testing::Test {
  protected:
-  virtual void SetUp() override {
+  void SetUp() override {
     // Build descriptors for the following definitions:
     //
     //   // in "foo.proto"
@@ -1512,7 +1517,7 @@
 // Test service descriptors.
 class ServiceDescriptorTest : public testing::Test {
  protected:
-  virtual void SetUp() override {
+  void SetUp() override {
     // Build descriptors for the following messages and service:
     //    // in "foo.proto"
     //    message FooRequest  {}
@@ -1673,7 +1678,7 @@
 // Test nested types.
 class NestedDescriptorTest : public testing::Test {
  protected:
-  virtual void SetUp() override {
+  void SetUp() override {
     // Build descriptors for the following definitions:
     //
     //   // in "foo.proto"
@@ -1887,7 +1892,7 @@
 // Test extensions.
 class ExtensionDescriptorTest : public testing::Test {
  protected:
-  virtual void SetUp() override {
+  void SetUp() override {
     // Build descriptors for the following definitions:
     //
     //   enum Baz {}
@@ -2210,7 +2215,7 @@
 // Test reserved fields.
 class ReservedDescriptorTest : public testing::Test {
  protected:
-  virtual void SetUp() override {
+  void SetUp() override {
     // Build descriptors for the following definitions:
     //
     //   message Foo {
@@ -2288,7 +2293,7 @@
 // Test reserved enum fields.
 class ReservedEnumDescriptorTest : public testing::Test {
  protected:
-  virtual void SetUp() override {
+  void SetUp() override {
     // Build descriptors for the following definitions:
     //
     //   enum Foo {
@@ -2814,7 +2819,7 @@
   DescriptorPoolMode mode() { return std::get<0>(GetParam()); }
   const char* syntax() { return std::get<1>(GetParam()); }
 
-  virtual void SetUp() override {
+  void SetUp() override {
     FileDescriptorProto foo_proto, bar_proto;
 
     switch (mode()) {
@@ -2942,6 +2947,8 @@
   EXPECT_EQ("Qux", qux_type->name());
   EXPECT_EQ("corge.Qux", qux_type->full_name());
   EXPECT_TRUE(qux_type->is_placeholder());
+  // Placeholder enum values should not be findable.
+  EXPECT_EQ(qux_type->FindValueByNumber(0), nullptr);
 
   // Placeholder types should not be findable.
   EXPECT_EQ(bar_type_, pool_->FindMessageTypeByName(bar_type_->full_name()));
@@ -3142,6 +3149,7 @@
   const FileDescriptor* file = message->file();
   const FieldDescriptor* field = message->FindFieldByName("field1");
   const OneofDescriptor* oneof = message->FindOneofByName("AnOneof");
+  const FieldDescriptor* map_field = message->FindFieldByName("map_field");
   const EnumDescriptor* enm = message->FindEnumTypeByName("AnEnum");
   // TODO(benjy): Support EnumValue options, once the compiler does.
   const ServiceDescriptor* service =
@@ -3157,6 +3165,8 @@
   EXPECT_EQ(42,  // Check that we get the default for an option we don't set.
             field->options().GetExtension(protobuf_unittest::field_opt2));
   EXPECT_EQ(-99, oneof->options().GetExtension(protobuf_unittest::oneof_opt1));
+  EXPECT_EQ(int64_t{12345},
+            map_field->options().GetExtension(protobuf_unittest::field_opt1));
   EXPECT_EQ(-789, enm->options().GetExtension(protobuf_unittest::enum_opt1));
   EXPECT_EQ(123, enm->value(1)->options().GetExtension(
                      protobuf_unittest::enum_value_opt1));
@@ -3173,6 +3183,13 @@
 TEST(CustomOptions, OptionTypes) {
   const MessageOptions* options = nullptr;
 
+  constexpr int32_t kint32min = std::numeric_limits<int32_t>::min();
+  constexpr int32_t kint32max = std::numeric_limits<int32_t>::max();
+  constexpr uint32_t kuint32max = std::numeric_limits<uint32_t>::max();
+  constexpr int64_t kint64min = std::numeric_limits<int64_t>::min();
+  constexpr int64_t kint64max = std::numeric_limits<int64_t>::max();
+  constexpr uint64_t kuint64max = std::numeric_limits<uint64_t>::max();
+
   options =
       &protobuf_unittest::CustomOptionMinIntegerValues::descriptor()->options();
   EXPECT_EQ(false, options->GetExtension(protobuf_unittest::bool_opt));
@@ -6792,7 +6809,7 @@
 
   SimpleDescriptorDatabase database_;
 
-  virtual void SetUp() override {
+  void SetUp() override {
     AddToDatabase(
         &database_,
         "name: 'foo.proto' "
@@ -7289,10 +7306,9 @@
  public:
   AbortingErrorCollector() {}
 
-  virtual void AddError(const std::string& filename,
-                        const std::string& element_name, const Message* message,
-                        ErrorLocation location,
-                        const std::string& error_message) override {
+  void AddError(const std::string& filename, const std::string& element_name,
+                const Message* message, ErrorLocation location,
+                const std::string& error_message) override {
     GOOGLE_LOG(FATAL) << "AddError() called unexpectedly: " << filename << " ["
                << element_name << "]: " << error_message;
   }
@@ -7307,7 +7323,7 @@
   SingletonSourceTree(const std::string& filename, const std::string& contents)
       : filename_(filename), contents_(contents) {}
 
-  virtual io::ZeroCopyInputStream* Open(const std::string& filename) override {
+  io::ZeroCopyInputStream* Open(const std::string& filename) override {
     return filename == filename_
                ? new io::ArrayInputStream(contents_.data(), contents_.size())
                : nullptr;
diff --git a/src/google/protobuf/duration.pb.cc b/src/google/protobuf/duration.pb.cc
index 2326c68..5a1bf18 100644
--- a/src/google/protobuf/duration.pb.cc
+++ b/src/google/protobuf/duration.pb.cc
@@ -35,7 +35,7 @@
 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr;
 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fduration_2eproto = nullptr;
 
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fduration_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   ~0u,  // no _has_bits_
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Duration, _internal_metadata_),
   ~0u,  // no _extensions_
@@ -100,7 +100,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Duration)
 }
 
-void Duration::SharedCtor() {
+inline void Duration::SharedCtor() {
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&seconds_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&nanos_) -
@@ -130,7 +130,7 @@
 
 void Duration::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Duration)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -143,12 +143,12 @@
 const char* Duration::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // int64 seconds = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           seconds_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
         } else
@@ -156,8 +156,8 @@
         continue;
       // int32 nanos = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
-          nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
+          nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
@@ -185,10 +185,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Duration::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Duration::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Duration)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // int64 seconds = 1;
@@ -215,7 +215,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Duration)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -248,7 +248,7 @@
 void Duration::MergeFrom(const Duration& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Duration)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (from._internal_seconds() != 0) {
diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h
index 4e7d6ad..2cfada9 100644
--- a/src/google/protobuf/duration.pb.h
+++ b/src/google/protobuf/duration.pb.h
@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3018000
+#if PROTOBUF_VERSION < 3019000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
@@ -50,7 +50,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
   static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
-  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+  static const uint32_t offsets[];
 };
 PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fduration_2eproto;
 PROTOBUF_NAMESPACE_OPEN
@@ -120,7 +120,12 @@
   }
   inline void Swap(Duration* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -134,11 +139,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Duration* New() const final {
-    return new Duration();
-  }
-
-  Duration* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Duration* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Duration>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -153,8 +154,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -162,6 +163,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Duration* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Duration";
@@ -189,20 +192,20 @@
   };
   // int64 seconds = 1;
   void clear_seconds();
-  ::PROTOBUF_NAMESPACE_ID::int64 seconds() const;
-  void set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value);
+  int64_t seconds() const;
+  void set_seconds(int64_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int64 _internal_seconds() const;
-  void _internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value);
+  int64_t _internal_seconds() const;
+  void _internal_set_seconds(int64_t value);
   public:
 
   // int32 nanos = 2;
   void clear_nanos();
-  ::PROTOBUF_NAMESPACE_ID::int32 nanos() const;
-  void set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t nanos() const;
+  void set_nanos(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_nanos() const;
-  void _internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_nanos() const;
+  void _internal_set_nanos(int32_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.Duration)
@@ -212,8 +215,8 @@
   template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
   typedef void InternalArenaConstructable_;
   typedef void DestructorSkippable_;
-  ::PROTOBUF_NAMESPACE_ID::int64 seconds_;
-  ::PROTOBUF_NAMESPACE_ID::int32 nanos_;
+  int64_t seconds_;
+  int32_t nanos_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
   friend struct ::TableStruct_google_2fprotobuf_2fduration_2eproto;
 };
@@ -232,18 +235,18 @@
 inline void Duration::clear_seconds() {
   seconds_ = int64_t{0};
 }
-inline ::PROTOBUF_NAMESPACE_ID::int64 Duration::_internal_seconds() const {
+inline int64_t Duration::_internal_seconds() const {
   return seconds_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int64 Duration::seconds() const {
+inline int64_t Duration::seconds() const {
   // @@protoc_insertion_point(field_get:google.protobuf.Duration.seconds)
   return _internal_seconds();
 }
-inline void Duration::_internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) {
+inline void Duration::_internal_set_seconds(int64_t value) {
   
   seconds_ = value;
 }
-inline void Duration::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) {
+inline void Duration::set_seconds(int64_t value) {
   _internal_set_seconds(value);
   // @@protoc_insertion_point(field_set:google.protobuf.Duration.seconds)
 }
@@ -252,18 +255,18 @@
 inline void Duration::clear_nanos() {
   nanos_ = 0;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Duration::_internal_nanos() const {
+inline int32_t Duration::_internal_nanos() const {
   return nanos_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Duration::nanos() const {
+inline int32_t Duration::nanos() const {
   // @@protoc_insertion_point(field_get:google.protobuf.Duration.nanos)
   return _internal_nanos();
 }
-inline void Duration::_internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Duration::_internal_set_nanos(int32_t value) {
   
   nanos_ = value;
 }
-inline void Duration::set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Duration::set_nanos(int32_t value) {
   _internal_set_nanos(value);
   // @@protoc_insertion_point(field_set:google.protobuf.Duration.nanos)
 }
diff --git a/src/google/protobuf/dynamic_message.cc b/src/google/protobuf/dynamic_message.cc
index b475c52..88c9844 100644
--- a/src/google/protobuf/dynamic_message.cc
+++ b/src/google/protobuf/dynamic_message.cc
@@ -246,7 +246,6 @@
 
   // implements Message ----------------------------------------------
 
-  Message* New() const override;
   Message* New(Arena* arena) const override;
 
   int GetCachedSize() const override;
@@ -450,7 +449,7 @@
 
       case FieldDescriptor::CPPTYPE_MESSAGE: {
         if (!field->is_repeated()) {
-          new (field_ptr) Message*(NULL);
+          new (field_ptr) Message*(nullptr);
         } else {
           if (IsMapFieldInApi(field)) {
             // We need to lock in most cases to avoid data racing. Only not lock
@@ -499,7 +498,7 @@
 
 bool DynamicMessage::is_prototype() const {
   return type_info_->prototype == this ||
-         // If type_info_->prototype is NULL, then we must be constructing
+         // If type_info_->prototype is nullptr, then we must be constructing
          // the prototype now, which means we must be the prototype.
          type_info_->prototype == nullptr;
 }
@@ -546,7 +545,7 @@
               // from reflection.
               const std::string* default_value = nullptr;
               reinterpret_cast<ArenaStringPtr*>(field_ptr)->Destroy(
-                  default_value, NULL);
+                  default_value, nullptr);
               break;
             }
           }
@@ -606,14 +605,14 @@
                       type_info_->offsets[i]))
                   ->GetPointer();
           reinterpret_cast<ArenaStringPtr*>(field_ptr)->Destroy(default_value,
-                                                                NULL);
+                                                                nullptr);
           break;
         }
       }
     } else if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
           if (!is_prototype()) {
         Message* message = *reinterpret_cast<Message**>(field_ptr);
-        if (message != NULL) {
+        if (message != nullptr) {
           delete message;
         }
       }
@@ -645,10 +644,8 @@
   }
 }
 
-Message* DynamicMessage::New() const { return New(NULL); }
-
 Message* DynamicMessage::New(Arena* arena) const {
-  if (arena != NULL) {
+  if (arena != nullptr) {
     void* new_base = Arena::CreateArray<char>(arena, type_info_->size);
     memset(new_base, 0, type_info_->size);
     return new (new_base) DynamicMessage(type_info_, arena);
@@ -701,7 +698,7 @@
   }
 
   const TypeInfo** target = &prototypes_[type];
-  if (*target != NULL) {
+  if (*target != nullptr) {
     // Already exists.
     return (*target)->prototype;
   }
@@ -710,7 +707,7 @@
   *target = type_info;
 
   type_info->type = type;
-  type_info->pool = (pool_ == NULL) ? type->file()->pool() : pool_;
+  type_info->pool = (pool_ == nullptr) ? type->file()->pool() : pool_;
   type_info->factory = this;
 
   // We need to construct all the structures passed to Reflection's constructor.
@@ -747,9 +744,9 @@
         // hasbits.
         type_info->has_bits_offset = size;
         uint32_t* has_bits_indices = new uint32_t[type->field_count()];
-        for (int i = 0; i < type->field_count(); i++) {
+        for (int j = 0; j < type->field_count(); j++) {
           // Initialize to -1, fields that need a hasbit will overwrite.
-          has_bits_indices[i] = static_cast<uint32_t>(-1);
+          has_bits_indices[j] = static_cast<uint32_t>(-1);
         }
         type_info->has_bits_indices.reset(has_bits_indices);
       }
diff --git a/src/google/protobuf/dynamic_message_unittest.cc b/src/google/protobuf/dynamic_message_unittest.cc
index e22926e..9391c8e 100644
--- a/src/google/protobuf/dynamic_message_unittest.cc
+++ b/src/google/protobuf/dynamic_message_unittest.cc
@@ -74,7 +74,7 @@
 
   DynamicMessageTest() : factory_(&pool_) {}
 
-  virtual void SetUp() override {
+  void SetUp() override {
     // We want to make sure that DynamicMessage works (particularly with
     // extensions) even if we use descriptors that are *not* from compiled-in
     // types, so we make copies of the descriptors for unittest.proto and
@@ -92,33 +92,33 @@
     proto2_nofieldpresence_unittest::TestAllTypes::descriptor()->file()->CopyTo(
         &unittest_no_field_presence_file);
 
-    ASSERT_TRUE(pool_.BuildFile(unittest_import_public_file) != NULL);
-    ASSERT_TRUE(pool_.BuildFile(unittest_import_file) != NULL);
-    ASSERT_TRUE(pool_.BuildFile(unittest_file) != NULL);
-    ASSERT_TRUE(pool_.BuildFile(unittest_no_field_presence_file) != NULL);
+    ASSERT_TRUE(pool_.BuildFile(unittest_import_public_file) != nullptr);
+    ASSERT_TRUE(pool_.BuildFile(unittest_import_file) != nullptr);
+    ASSERT_TRUE(pool_.BuildFile(unittest_file) != nullptr);
+    ASSERT_TRUE(pool_.BuildFile(unittest_no_field_presence_file) != nullptr);
 
     descriptor_ = pool_.FindMessageTypeByName("protobuf_unittest.TestAllTypes");
-    ASSERT_TRUE(descriptor_ != NULL);
+    ASSERT_TRUE(descriptor_ != nullptr);
     prototype_ = factory_.GetPrototype(descriptor_);
 
     extensions_descriptor_ =
         pool_.FindMessageTypeByName("protobuf_unittest.TestAllExtensions");
-    ASSERT_TRUE(extensions_descriptor_ != NULL);
+    ASSERT_TRUE(extensions_descriptor_ != nullptr);
     extensions_prototype_ = factory_.GetPrototype(extensions_descriptor_);
 
     packed_descriptor_ =
         pool_.FindMessageTypeByName("protobuf_unittest.TestPackedTypes");
-    ASSERT_TRUE(packed_descriptor_ != NULL);
+    ASSERT_TRUE(packed_descriptor_ != nullptr);
     packed_prototype_ = factory_.GetPrototype(packed_descriptor_);
 
     oneof_descriptor_ =
         pool_.FindMessageTypeByName("protobuf_unittest.TestOneof2");
-    ASSERT_TRUE(oneof_descriptor_ != NULL);
+    ASSERT_TRUE(oneof_descriptor_ != nullptr);
     oneof_prototype_ = factory_.GetPrototype(oneof_descriptor_);
 
     proto3_descriptor_ = pool_.FindMessageTypeByName(
         "proto2_nofieldpresence_unittest.TestAllTypes");
-    ASSERT_TRUE(proto3_descriptor_ != NULL);
+    ASSERT_TRUE(proto3_descriptor_ != nullptr);
     proto3_prototype_ = factory_.GetPrototype(proto3_descriptor_);
   }
 };
@@ -145,7 +145,7 @@
   // one to a unique value then checking that they all still have those
   // unique values (i.e. they don't stomp each other).
   Arena arena;
-  Message* message = prototype_->New(GetParam() ? &arena : NULL);
+  Message* message = prototype_->New(GetParam() ? &arena : nullptr);
   TestUtil::ReflectionTester reflection_tester(descriptor_);
 
   reflection_tester.SetAllFieldsViaReflection(message);
@@ -159,7 +159,7 @@
 TEST_P(DynamicMessageTest, Extensions) {
   // Check that extensions work.
   Arena arena;
-  Message* message = extensions_prototype_->New(GetParam() ? &arena : NULL);
+  Message* message = extensions_prototype_->New(GetParam() ? &arena : nullptr);
   TestUtil::ReflectionTester reflection_tester(extensions_descriptor_);
 
   reflection_tester.SetAllFieldsViaReflection(message);
@@ -173,7 +173,7 @@
 TEST_P(DynamicMessageTest, PackedFields) {
   // Check that packed fields work properly.
   Arena arena;
-  Message* message = packed_prototype_->New(GetParam() ? &arena : NULL);
+  Message* message = packed_prototype_->New(GetParam() ? &arena : nullptr);
   TestUtil::ReflectionTester reflection_tester(packed_descriptor_);
 
   reflection_tester.SetPackedFieldsViaReflection(message);
@@ -187,7 +187,7 @@
 TEST_P(DynamicMessageTest, Oneof) {
   // Check that oneof fields work properly.
   Arena arena;
-  Message* message = oneof_prototype_->New(GetParam() ? &arena : NULL);
+  Message* message = oneof_prototype_->New(GetParam() ? &arena : nullptr);
 
   // Check default values.
   const Descriptor* descriptor = message->GetDescriptor();
@@ -258,7 +258,7 @@
   // to test very much here.  Just make sure it appears to be working.
 
   Arena arena;
-  Message* message = prototype_->New(GetParam() ? &arena : NULL);
+  Message* message = prototype_->New(GetParam() ? &arena : nullptr);
   TestUtil::ReflectionTester reflection_tester(descriptor_);
 
   size_t initial_space_used = message->SpaceUsedLong();
@@ -300,8 +300,8 @@
       desc->FindFieldByName("optional_int32");
   const FieldDescriptor* optional_msg =
       desc->FindFieldByName("optional_nested_message");
-  EXPECT_TRUE(optional_int32 != NULL);
-  EXPECT_TRUE(optional_msg != NULL);
+  EXPECT_TRUE(optional_int32 != nullptr);
+  EXPECT_TRUE(optional_msg != nullptr);
 
   EXPECT_EQ(false, refl->HasField(*message, optional_int32));
   refl->SetInt32(message, optional_int32, 42);
diff --git a/src/google/protobuf/empty.pb.cc b/src/google/protobuf/empty.pb.cc
index f773af1..415cd41 100644
--- a/src/google/protobuf/empty.pb.cc
+++ b/src/google/protobuf/empty.pb.cc
@@ -33,7 +33,7 @@
 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fempty_2eproto = nullptr;
 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fempty_2eproto = nullptr;
 
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fempty_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fempty_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   ~0u,  // no _has_bits_
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Empty, _internal_metadata_),
   ~0u,  // no _extensions_
diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h
index 637ddf4..be4f73b 100644
--- a/src/google/protobuf/empty.pb.h
+++ b/src/google/protobuf/empty.pb.h
@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3018000
+#if PROTOBUF_VERSION < 3019000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
@@ -51,7 +51,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
   static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
-  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+  static const uint32_t offsets[];
 };
 PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fempty_2eproto;
 PROTOBUF_NAMESPACE_OPEN
@@ -120,7 +120,12 @@
   }
   inline void Swap(Empty* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -134,11 +139,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Empty* New() const final {
-    return new Empty();
-  }
-
-  Empty* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Empty* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Empty>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyFrom;
@@ -150,6 +151,8 @@
     ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeImpl(this, from);
   }
   public:
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Empty";
diff --git a/src/google/protobuf/explicitly_constructed.h b/src/google/protobuf/explicitly_constructed.h
new file mode 100644
index 0000000..e4a6d07
--- /dev/null
+++ b/src/google/protobuf/explicitly_constructed.h
@@ -0,0 +1,91 @@
+// 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 GOOGLE_PROTOBUF_EXPLICITLY_CONSTRUCTED_H__
+#define GOOGLE_PROTOBUF_EXPLICITLY_CONSTRUCTED_H__
+
+#include <stdint.h>
+
+#include <utility>
+
+#include <google/protobuf/stubs/logging.h>
+#include <google/protobuf/stubs/common.h>
+
+// clang-format off
+#include <google/protobuf/port_def.inc>
+// clang-format on
+
+namespace google {
+namespace protobuf {
+namespace internal {
+
+// Wraps a variable whose constructor and destructor are explicitly
+// called. It is particularly useful for a global variable, without its
+// constructor and destructor run on start and end of the program lifetime.
+// This circumvents the initial construction order fiasco, while keeping
+// the address of the empty string a compile time constant.
+//
+// Pay special attention to the initialization state of the object.
+// 1. The object is "uninitialized" to begin with.
+// 2. Call Construct() or DefaultConstruct() only if the object is
+//    uninitialized. After the call, the object becomes "initialized".
+// 3. Call get() and get_mutable() only if the object is initialized.
+// 4. Call Destruct() only if the object is initialized.
+//    After the call, the object becomes uninitialized.
+template <typename T>
+class ExplicitlyConstructed {
+ public:
+  void DefaultConstruct() { new (&union_) T(); }
+
+  template <typename... Args>
+  void Construct(Args&&... args) {
+    new (&union_) T(std::forward<Args>(args)...);
+  }
+
+  void Destruct() { get_mutable()->~T(); }
+
+  constexpr const T& get() const { return reinterpret_cast<const T&>(union_); }
+  T* get_mutable() { return reinterpret_cast<T*>(&union_); }
+
+ private:
+  union AlignedUnion {
+    alignas(T) char space[sizeof(T)];
+    int64_t align_to_int64;
+    void* align_to_ptr;
+  } union_;
+};
+
+}  // namespace internal
+}  // namespace protobuf
+}  // namespace google
+
+#include <google/protobuf/port_undef.inc>
+
+#endif  // GOOGLE_PROTOBUF_EXPLICITLY_CONSTRUCTED_H__
diff --git a/src/google/protobuf/extension_set.cc b/src/google/protobuf/extension_set.cc
index d1d5aa5..1bf7a36 100644
--- a/src/google/protobuf/extension_set.cc
+++ b/src/google/protobuf/extension_set.cc
@@ -142,7 +142,7 @@
 
 bool GeneratedExtensionFinder::Find(int number, ExtensionInfo* output) {
   const ExtensionInfo* extension = FindRegisteredExtension(extendee_, number);
-  if (extension == NULL) {
+  if (extension == nullptr) {
     return false;
   } else {
     *output = *extension;
@@ -204,12 +204,12 @@
       flat_capacity_(0),
       flat_size_(0),
       map_{flat_capacity_ == 0
-               ? NULL
+               ? nullptr
                : Arena::CreateArray<KeyValue>(arena_, flat_capacity_)} {}
 
 ExtensionSet::~ExtensionSet() {
   // Deletes all allocated extensions.
-  if (arena_ == NULL) {
+  if (arena_ == nullptr) {
     ForEach([](int /* number */, Extension& ext) { ext.Free(); });
     if (PROTOBUF_PREDICT_FALSE(is_large())) {
       delete map_.large;
@@ -242,11 +242,15 @@
 
 bool ExtensionSet::Has(int number) const {
   const Extension* ext = FindOrNull(number);
-  if (ext == NULL) return false;
+  if (ext == nullptr) return false;
   GOOGLE_DCHECK(!ext->is_repeated);
   return !ext->is_cleared;
 }
 
+bool ExtensionSet::HasLazy(int number) const {
+  return Has(number) && FindOrNull(number)->is_lazy;
+}
+
 int ExtensionSet::NumExtensions() const {
   int result = 0;
   ForEach([&result](int /* number */, const Extension& ext) {
@@ -259,12 +263,12 @@
 
 int ExtensionSet::ExtensionSize(int number) const {
   const Extension* ext = FindOrNull(number);
-  return ext == NULL ? 0 : ext->GetSize();
+  return ext == nullptr ? 0 : ext->GetSize();
 }
 
 FieldType ExtensionSet::ExtensionType(int number) const {
   const Extension* ext = FindOrNull(number);
-  if (ext == NULL) {
+  if (ext == nullptr) {
     GOOGLE_LOG(DFATAL) << "Don't lookup extension types if they aren't present (1). ";
     return 0;
   }
@@ -276,7 +280,7 @@
 
 void ExtensionSet::ClearExtension(int number) {
   Extension* ext = FindOrNull(number);
-  if (ext == NULL) return;
+  if (ext == nullptr) return;
   ext->Clear();
 }
 
@@ -301,7 +305,7 @@
   LOWERCASE ExtensionSet::Get##CAMELCASE(int number, LOWERCASE default_value) \
       const {                                                                 \
     const Extension* extension = FindOrNull(number);                          \
-    if (extension == NULL || extension->is_cleared) {                         \
+    if (extension == nullptr || extension->is_cleared) {                      \
       return default_value;                                                   \
     } else {                                                                  \
       GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, UPPERCASE);                     \
@@ -312,7 +316,7 @@
   const LOWERCASE& ExtensionSet::GetRef##CAMELCASE(                           \
       int number, const LOWERCASE& default_value) const {                     \
     const Extension* extension = FindOrNull(number);                          \
-    if (extension == NULL || extension->is_cleared) {                         \
+    if (extension == nullptr || extension->is_cleared) {                      \
       return default_value;                                                   \
     } else {                                                                  \
       GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, UPPERCASE);                     \
@@ -339,7 +343,7 @@
   LOWERCASE ExtensionSet::GetRepeated##CAMELCASE(int number, int index)       \
       const {                                                                 \
     const Extension* extension = FindOrNull(number);                          \
-    GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";      \
+    GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty).";   \
     GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, UPPERCASE);                       \
     return extension->repeated_##LOWERCASE##_value->Get(index);               \
   }                                                                           \
@@ -347,7 +351,7 @@
   const LOWERCASE& ExtensionSet::GetRefRepeated##CAMELCASE(int number,        \
                                                            int index) const { \
     const Extension* extension = FindOrNull(number);                          \
-    GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";      \
+    GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty).";   \
     GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, UPPERCASE);                       \
     return extension->repeated_##LOWERCASE##_value->Get(index);               \
   }                                                                           \
@@ -355,7 +359,7 @@
   void ExtensionSet::SetRepeated##CAMELCASE(int number, int index,            \
                                             LOWERCASE value) {                \
     Extension* extension = FindOrNull(number);                                \
-    GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";      \
+    GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty).";   \
     GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, UPPERCASE);                       \
     extension->repeated_##LOWERCASE##_value->Set(index, value);               \
   }                                                                           \
@@ -392,7 +396,7 @@
 const void* ExtensionSet::GetRawRepeatedField(int number,
                                               const void* default_value) const {
   const Extension* extension = FindOrNull(number);
-  if (extension == NULL) {
+  if (extension == nullptr) {
     return default_value;
   }
   // We assume that all the RepeatedField<>* pointers have the same
@@ -466,7 +470,7 @@
 // the don't already exist; instead, just GOOGLE_CHECK-fails.
 void* ExtensionSet::MutableRawRepeatedField(int number) {
   Extension* extension = FindOrNull(number);
-  GOOGLE_CHECK(extension != NULL) << "Extension not found.";
+  GOOGLE_CHECK(extension != nullptr) << "Extension not found.";
   // We assume that all the RepeatedField<>* pointers have the same
   // size and alignment within the anonymous union in Extension.
   return extension->repeated_int32_t_value;
@@ -477,7 +481,7 @@
 
 int ExtensionSet::GetEnum(int number, int default_value) const {
   const Extension* extension = FindOrNull(number);
-  if (extension == NULL || extension->is_cleared) {
+  if (extension == nullptr || extension->is_cleared) {
     // Not present.  Return the default value.
     return default_value;
   } else {
@@ -556,7 +560,7 @@
 const std::string& ExtensionSet::GetString(
     int number, const std::string& default_value) const {
   const Extension* extension = FindOrNull(number);
-  if (extension == NULL || extension->is_cleared) {
+  if (extension == nullptr || extension->is_cleared) {
     // Not present.  Return the default value.
     return default_value;
   } else {
@@ -583,14 +587,14 @@
 const std::string& ExtensionSet::GetRepeatedString(int number,
                                                    int index) const {
   const Extension* extension = FindOrNull(number);
-  GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
+  GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty).";
   GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, STRING);
   return extension->repeated_string_value->Get(index);
 }
 
 std::string* ExtensionSet::MutableRepeatedString(int number, int index) {
   Extension* extension = FindOrNull(number);
-  GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
+  GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty).";
   GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, STRING);
   return extension->repeated_string_value->Mutable(index);
 }
@@ -617,13 +621,13 @@
 const MessageLite& ExtensionSet::GetMessage(
     int number, const MessageLite& default_value) const {
   const Extension* extension = FindOrNull(number);
-  if (extension == NULL) {
+  if (extension == nullptr) {
     // Not present.  Return the default value.
     return default_value;
   } else {
     GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE);
     if (extension->is_lazy) {
-      return extension->lazymessage_value->GetMessage(default_value);
+      return extension->lazymessage_value->GetMessage(default_value, arena_);
     } else {
       return *extension->message_value;
     }
@@ -666,7 +670,7 @@
 void ExtensionSet::SetAllocatedMessage(int number, FieldType type,
                                        const FieldDescriptor* descriptor,
                                        MessageLite* message) {
-  if (message == NULL) {
+  if (message == nullptr) {
     ClearExtension(number);
     return;
   }
@@ -681,9 +685,9 @@
     extension->is_lazy = false;
     if (message_arena == arena_) {
       extension->message_value = message;
-    } else if (message_arena == NULL) {
+    } else if (message_arena == nullptr) {
       extension->message_value = message;
-      arena_->Own(message);  // not NULL because not equal to message_arena
+      arena_->Own(message);  // not nullptr because not equal to message_arena
     } else {
       extension->message_value = message->New(arena_);
       extension->message_value->CheckTypeAndMergeFrom(*message);
@@ -691,16 +695,16 @@
   } else {
     GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE);
     if (extension->is_lazy) {
-      extension->lazymessage_value->SetAllocatedMessage(message);
+      extension->lazymessage_value->SetAllocatedMessage(message, arena_);
     } else {
-      if (arena_ == NULL) {
+      if (arena_ == nullptr) {
         delete extension->message_value;
       }
       if (message_arena == arena_) {
         extension->message_value = message;
-      } else if (message_arena == NULL) {
+      } else if (message_arena == nullptr) {
         extension->message_value = message;
-        arena_->Own(message);  // not NULL because not equal to message_arena
+        arena_->Own(message);  // not nullptr because not equal to message_arena
       } else {
         extension->message_value = message->New(arena_);
         extension->message_value->CheckTypeAndMergeFrom(*message);
@@ -713,7 +717,7 @@
 void ExtensionSet::UnsafeArenaSetAllocatedMessage(
     int number, FieldType type, const FieldDescriptor* descriptor,
     MessageLite* message) {
-  if (message == NULL) {
+  if (message == nullptr) {
     ClearExtension(number);
     return;
   }
@@ -727,9 +731,10 @@
   } else {
     GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE);
     if (extension->is_lazy) {
-      extension->lazymessage_value->UnsafeArenaSetAllocatedMessage(message);
+      extension->lazymessage_value->UnsafeArenaSetAllocatedMessage(message,
+                                                                   arena_);
     } else {
-      if (arena_ == NULL) {
+      if (arena_ == nullptr) {
         delete extension->message_value;
       }
       extension->message_value = message;
@@ -741,19 +746,19 @@
 MessageLite* ExtensionSet::ReleaseMessage(int number,
                                           const MessageLite& prototype) {
   Extension* extension = FindOrNull(number);
-  if (extension == NULL) {
-    // Not present.  Return NULL.
-    return NULL;
+  if (extension == nullptr) {
+    // Not present.  Return nullptr.
+    return nullptr;
   } else {
     GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE);
-    MessageLite* ret = NULL;
+    MessageLite* ret = nullptr;
     if (extension->is_lazy) {
-      ret = extension->lazymessage_value->ReleaseMessage(prototype);
-      if (arena_ == NULL) {
+      ret = extension->lazymessage_value->ReleaseMessage(prototype, arena_);
+      if (arena_ == nullptr) {
         delete extension->lazymessage_value;
       }
     } else {
-      if (arena_ == NULL) {
+      if (arena_ == nullptr) {
         ret = extension->message_value;
       } else {
         // ReleaseMessage() always returns a heap-allocated message, and we are
@@ -770,15 +775,16 @@
 MessageLite* ExtensionSet::UnsafeArenaReleaseMessage(
     int number, const MessageLite& prototype) {
   Extension* extension = FindOrNull(number);
-  if (extension == NULL) {
-    // Not present.  Return NULL.
-    return NULL;
+  if (extension == nullptr) {
+    // Not present.  Return nullptr.
+    return nullptr;
   } else {
     GOOGLE_DCHECK_TYPE(*extension, OPTIONAL_FIELD, MESSAGE);
-    MessageLite* ret = NULL;
+    MessageLite* ret = nullptr;
     if (extension->is_lazy) {
-      ret = extension->lazymessage_value->UnsafeArenaReleaseMessage(prototype);
-      if (arena_ == NULL) {
+      ret = extension->lazymessage_value->UnsafeArenaReleaseMessage(prototype,
+                                                                    arena_);
+      if (arena_ == nullptr) {
         delete extension->lazymessage_value;
       }
     } else {
@@ -796,14 +802,14 @@
 const MessageLite& ExtensionSet::GetRepeatedMessage(int number,
                                                     int index) const {
   const Extension* extension = FindOrNull(number);
-  GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
+  GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty).";
   GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, MESSAGE);
   return extension->repeated_message_value->Get(index);
 }
 
 MessageLite* ExtensionSet::MutableRepeatedMessage(int number, int index) {
   Extension* extension = FindOrNull(number);
-  GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
+  GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty).";
   GOOGLE_DCHECK_TYPE(*extension, REPEATED_FIELD, MESSAGE);
   return extension->repeated_message_value->Mutable(index);
 }
@@ -827,7 +833,7 @@
   MessageLite* result = reinterpret_cast<internal::RepeatedPtrFieldBase*>(
                             extension->repeated_message_value)
                             ->AddFromCleared<GenericTypeHandler<MessageLite>>();
-  if (result == NULL) {
+  if (result == nullptr) {
     result = prototype.New(arena_);
     extension->repeated_message_value->AddAllocated(result);
   }
@@ -843,7 +849,7 @@
 
 void ExtensionSet::RemoveLast(int number) {
   Extension* extension = FindOrNull(number);
-  GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
+  GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty).";
   GOOGLE_DCHECK(extension->is_repeated);
 
   switch (cpp_type(extension->type)) {
@@ -882,7 +888,7 @@
 
 MessageLite* ExtensionSet::ReleaseLast(int number) {
   Extension* extension = FindOrNull(number);
-  GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
+  GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty).";
   GOOGLE_DCHECK(extension->is_repeated);
   GOOGLE_DCHECK(cpp_type(extension->type) == WireFormatLite::CPPTYPE_MESSAGE);
   return extension->repeated_message_value->ReleaseLast();
@@ -898,7 +904,7 @@
 
 void ExtensionSet::SwapElements(int number, int index1, int index2) {
   Extension* extension = FindOrNull(number);
-  GOOGLE_CHECK(extension != NULL) << "Index out-of-bounds (field is empty).";
+  GOOGLE_CHECK(extension != nullptr) << "Index out-of-bounds (field is empty).";
   GOOGLE_DCHECK(extension->is_repeated);
 
   switch (cpp_type(extension->type)) {
@@ -963,7 +969,8 @@
 }
 }  // namespace
 
-void ExtensionSet::MergeFrom(const ExtensionSet& other) {
+void ExtensionSet::MergeFrom(const MessageLite* extendee,
+                             const ExtensionSet& other) {
   if (PROTOBUF_PREDICT_TRUE(!is_large())) {
     if (PROTOBUF_PREDICT_TRUE(!other.is_large())) {
       GrowCapacity(SizeOfUnion(flat_begin(), flat_end(), other.flat_begin(),
@@ -974,13 +981,15 @@
                                other.map_.large->end()));
     }
   }
-  other.ForEach([this](int number, const Extension& ext) {
-    this->InternalExtensionMergeFrom(number, ext);
+  other.ForEach([extendee, this, &other](int number, const Extension& ext) {
+    this->InternalExtensionMergeFrom(extendee, number, ext, other.arena_);
   });
 }
 
-void ExtensionSet::InternalExtensionMergeFrom(
-    int number, const Extension& other_extension) {
+void ExtensionSet::InternalExtensionMergeFrom(const MessageLite* extendee,
+                                              int number,
+                                              const Extension& other_extension,
+                                              Arena* other_arena) {
   if (other_extension.is_repeated) {
     Extension* extension;
     bool is_new =
@@ -1033,7 +1042,7 @@
               reinterpret_cast<internal::RepeatedPtrFieldBase*>(
                   extension->repeated_message_value)
                   ->AddFromCleared<GenericTypeHandler<MessageLite>>();
-          if (target == NULL) {
+          if (target == nullptr) {
             target = other_message.New(arena_);
             extension->repeated_message_value->AddAllocated(target);
           }
@@ -1077,6 +1086,7 @@
               extension->lazymessage_value =
                   other_extension.lazymessage_value->New(arena_);
               extension->lazymessage_value->MergeFrom(
+                  GetPrototypeForLazyMessage(extendee, number),
                   *other_extension.lazymessage_value, arena_);
             } else {
               extension->is_lazy = false;
@@ -1092,11 +1102,12 @@
             if (other_extension.is_lazy) {
               if (extension->is_lazy) {
                 extension->lazymessage_value->MergeFrom(
+                    GetPrototypeForLazyMessage(extendee, number),
                     *other_extension.lazymessage_value, arena_);
               } else {
                 extension->message_value->CheckTypeAndMergeFrom(
                     other_extension.lazymessage_value->GetMessage(
-                        *extension->message_value));
+                        *extension->message_value, other_arena));
               }
             } else {
               if (extension->is_lazy) {
@@ -1117,23 +1128,23 @@
   }
 }
 
-void ExtensionSet::Swap(ExtensionSet* x) {
+void ExtensionSet::Swap(const MessageLite* extendee, ExtensionSet* other) {
 #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
-  if (GetArena() != nullptr && GetArena() == x->GetArena()) {
+  if (GetArena() != nullptr && GetArena() == other->GetArena()) {
 #else   // PROTOBUF_FORCE_COPY_IN_SWAP
-  if (GetArena() == x->GetArena()) {
+  if (GetArena() == other->GetArena()) {
 #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
-    InternalSwap(x);
+    InternalSwap(other);
   } else {
     // TODO(cfallin, rohananil): We maybe able to optimize a case where we are
     // swapping from heap to arena-allocated extension set, by just Own()'ing
     // the extensions.
     ExtensionSet extension_set;
-    extension_set.MergeFrom(*x);
-    x->Clear();
-    x->MergeFrom(*this);
+    extension_set.MergeFrom(extendee, *other);
+    other->Clear();
+    other->MergeFrom(extendee, *this);
     Clear();
-    MergeFrom(extension_set);
+    MergeFrom(extendee, extension_set);
   }
 }
 
@@ -1145,7 +1156,8 @@
   swap(map_, other->map_);
 }
 
-void ExtensionSet::SwapExtension(ExtensionSet* other, int number) {
+void ExtensionSet::SwapExtension(const MessageLite* extendee,
+                                 ExtensionSet* other, int number) {
   if (this == other) return;
 
   if (GetArena() == other->GetArena()) {
@@ -1165,18 +1177,22 @@
     // We do it this way to reuse the copy-across-arenas logic already
     // implemented in ExtensionSet's MergeFrom.
     ExtensionSet temp;
-    temp.InternalExtensionMergeFrom(number, *other_ext);
+    temp.InternalExtensionMergeFrom(extendee, number, *other_ext,
+                                    other->GetArena());
     Extension* temp_ext = temp.FindOrNull(number);
+
     other_ext->Clear();
-    other->InternalExtensionMergeFrom(number, *this_ext);
+    other->InternalExtensionMergeFrom(extendee, number, *this_ext,
+                                      this->GetArena());
     this_ext->Clear();
-    InternalExtensionMergeFrom(number, *temp_ext);
+    InternalExtensionMergeFrom(extendee, number, *temp_ext, temp.GetArena());
   } else if (this_ext == nullptr) {
-    InternalExtensionMergeFrom(number, *other_ext);
+    InternalExtensionMergeFrom(extendee, number, *other_ext, other->GetArena());
     if (other->GetArena() == nullptr) other_ext->Free();
     other->Erase(number);
   } else {
-    other->InternalExtensionMergeFrom(number, *this_ext);
+    other->InternalExtensionMergeFrom(extendee, number, *this_ext,
+                                      this->GetArena());
     if (GetArena() == nullptr) this_ext->Free();
     Erase(number);
   }
@@ -1888,7 +1904,7 @@
   if (it != map_.large->end()) {
     return &it->second;
   }
-  return NULL;
+  return nullptr;
 }
 
 ExtensionSet::Extension* ExtensionSet::FindOrNull(int key) {
@@ -1960,8 +1976,12 @@
   map_ = new_map;
 }
 
+#if (__cplusplus < 201703) && \
+    (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 // static
 constexpr uint16_t ExtensionSet::kMaximumFlatCapacity;
+#endif  //  (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900
+        //  && _MSC_VER < 1912))
 
 void ExtensionSet::Erase(int key) {
   if (PROTOBUF_PREDICT_FALSE(is_large())) {
diff --git a/src/google/protobuf/extension_set.h b/src/google/protobuf/extension_set.h
index fdeed2e..beb4202 100644
--- a/src/google/protobuf/extension_set.h
+++ b/src/google/protobuf/extension_set.h
@@ -70,6 +70,7 @@
 class MessageLite;      // message_lite.h
 class Message;          // message.h
 class MessageFactory;   // message.h
+class Reflection;       // message.h
 class UnknownFieldSet;  // unknown_field_set.h
 namespace internal {
 class FieldSkipper;  // wire_format_lite.h
@@ -100,22 +101,22 @@
 
 // Information about a registered extension.
 struct ExtensionInfo {
-  inline ExtensionInfo() {}
-  inline ExtensionInfo(const MessageLite* extendee, int param_number,
-                       FieldType type_param, bool isrepeated, bool ispacked)
+  constexpr ExtensionInfo() : enum_validity_check() {}
+  constexpr ExtensionInfo(const MessageLite* extendee, int param_number,
+                          FieldType type_param, bool isrepeated, bool ispacked)
       : message(extendee),
         number(param_number),
         type(type_param),
         is_repeated(isrepeated),
         is_packed(ispacked),
-        descriptor(NULL) {}
+        enum_validity_check() {}
 
-  const MessageLite* message;
-  int number;
+  const MessageLite* message = nullptr;
+  int number = 0;
 
-  FieldType type;
-  bool is_repeated;
-  bool is_packed;
+  FieldType type = 0;
+  bool is_repeated = false;
+  bool is_packed = false;
 
   struct EnumValidityCheck {
     EnumValidityFuncWithArg* func;
@@ -132,9 +133,9 @@
   };
 
   // The descriptor for this extension, if one exists and is known.  May be
-  // NULL.  Must not be NULL if the descriptor for the extension does not
+  // nullptr.  Must not be nullptr if the descriptor for the extension does not
   // live in the same pool as the descriptor for the containing type.
-  const FieldDescriptor* descriptor;
+  const FieldDescriptor* descriptor = nullptr;
 };
 
 // Abstract interface for an object which looks up extension definitions.  Used
@@ -261,7 +262,7 @@
   const MessageLite& GetMessage(int number, const Descriptor* message_type,
                                 MessageFactory* factory) const;
 
-  // |descriptor| may be NULL so long as it is known that the descriptor for
+  // |descriptor| may be nullptr so long as it is known that the descriptor for
   // the extension lives in the same pool as the descriptor for the containing
   // type.
 #define desc const FieldDescriptor* descriptor  // avoid line wrapping
@@ -281,19 +282,19 @@
                               MessageFactory* factory);
   // Adds the given message to the ExtensionSet, taking ownership of the
   // message object. Existing message with the same number will be deleted.
-  // If "message" is NULL, this is equivalent to "ClearExtension(number)".
+  // If "message" is nullptr, this is equivalent to "ClearExtension(number)".
   void SetAllocatedMessage(int number, FieldType type,
                            const FieldDescriptor* descriptor,
                            MessageLite* message);
   void UnsafeArenaSetAllocatedMessage(int number, FieldType type,
                                       const FieldDescriptor* descriptor,
                                       MessageLite* message);
-  PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseMessage(
-      int number, const MessageLite& prototype);
+  PROTOBUF_NODISCARD MessageLite* ReleaseMessage(int number,
+                                                 const MessageLite& prototype);
   MessageLite* UnsafeArenaReleaseMessage(int number,
                                          const MessageLite& prototype);
 
-  PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseMessage(
+  PROTOBUF_NODISCARD MessageLite* ReleaseMessage(
       const FieldDescriptor* descriptor, MessageFactory* factory);
   MessageLite* UnsafeArenaReleaseMessage(const FieldDescriptor* descriptor,
                                          MessageFactory* factory);
@@ -363,7 +364,7 @@
 #undef desc
 
   void RemoveLast(int number);
-  PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseLast(int number);
+  PROTOBUF_NODISCARD MessageLite* ReleaseLast(int number);
   MessageLite* UnsafeArenaReleaseLast(int number);
   void SwapElements(int number, int index1, int index2);
 
@@ -377,10 +378,11 @@
   // class, but providing them here helps keep the generated code size down.
 
   void Clear();
-  void MergeFrom(const ExtensionSet& other);
-  void Swap(ExtensionSet* other);
+  void MergeFrom(const MessageLite* extendee, const ExtensionSet& other);
+  void Swap(const MessageLite* extendee, ExtensionSet* other);
   void InternalSwap(ExtensionSet* other);
-  void SwapExtension(ExtensionSet* other, int number);
+  void SwapExtension(const MessageLite* extendee, ExtensionSet* other,
+                     int number);
   void UnsafeShallowSwapExtension(ExtensionSet* other, int number);
   bool IsInitialized() const;
 
@@ -544,6 +546,8 @@
   template <typename Type, bool IsValid(int)>
   friend class RepeatedEnumTypeTraits;
 
+  friend class google::protobuf::Reflection;
+
   const int32_t& GetRefInt32(int number, const int32_t& default_value) const;
   const int64_t& GetRefInt64(int number, const int64_t& default_value) const;
   const uint32_t& GetRefUInt32(int number, const uint32_t& default_value) const;
@@ -573,16 +577,17 @@
     virtual ~LazyMessageExtension() {}
 
     virtual LazyMessageExtension* New(Arena* arena) const = 0;
-    virtual const MessageLite& GetMessage(
-        const MessageLite& prototype) const = 0;
+    virtual const MessageLite& GetMessage(const MessageLite& prototype,
+                                          Arena* arena) const = 0;
     virtual MessageLite* MutableMessage(const MessageLite& prototype,
                                         Arena* arena) = 0;
-    virtual void SetAllocatedMessage(MessageLite* message) = 0;
-    virtual void UnsafeArenaSetAllocatedMessage(MessageLite* message) = 0;
-    virtual PROTOBUF_MUST_USE_RESULT MessageLite* ReleaseMessage(
-        const MessageLite& prototype) = 0;
-    virtual MessageLite* UnsafeArenaReleaseMessage(
-        const MessageLite& prototype) = 0;
+    virtual void SetAllocatedMessage(MessageLite* message, Arena* arena) = 0;
+    virtual void UnsafeArenaSetAllocatedMessage(MessageLite* message,
+                                                Arena* arena) = 0;
+    PROTOBUF_NODISCARD virtual MessageLite* ReleaseMessage(
+        const MessageLite& prototype, Arena* arena) = 0;
+    virtual MessageLite* UnsafeArenaReleaseMessage(const MessageLite& prototype,
+                                                   Arena* arena) = 0;
 
     virtual bool IsInitialized() const = 0;
 
@@ -591,13 +596,15 @@
     virtual size_t ByteSizeLong() const = 0;
     virtual size_t SpaceUsedLong() const = 0;
 
-    virtual void MergeFrom(const LazyMessageExtension& other, Arena* arena) = 0;
+    virtual void MergeFrom(const MessageLite* prototype,
+                           const LazyMessageExtension& other, Arena* arena) = 0;
     virtual void MergeFromMessage(const MessageLite& msg, Arena* arena) = 0;
     virtual void Clear() = 0;
 
     virtual bool ReadMessage(const MessageLite& prototype,
                              io::CodedInputStream* input) = 0;
-    virtual const char* _InternalParse(const char* ptr, ParseContext* ctx) = 0;
+    virtual const char* _InternalParse(const Message& prototype, Arena* arena,
+                                       const char* ptr, ParseContext* ctx) = 0;
     virtual uint8_t* WriteMessageToArray(
         const MessageLite* prototype, int number, uint8_t* target,
         io::EpsCopyOutputStream* stream) const = 0;
@@ -664,8 +671,8 @@
     mutable int cached_size;
 
     // The descriptor for this extension, if one exists and is known.  May be
-    // NULL.  Must not be NULL if the descriptor for the extension does not
-    // live in the same pool as the descriptor for the containing type.
+    // nullptr.  Must not be nullptr if the descriptor for the extension does
+    // not live in the same pool as the descriptor for the containing type.
     const FieldDescriptor* descriptor;
 
     // Some helper methods for operations on a single Extension.
@@ -766,7 +773,9 @@
   }
 
   // Merges existing Extension from other_extension
-  void InternalExtensionMergeFrom(int number, const Extension& other_extension);
+  void InternalExtensionMergeFrom(const MessageLite* extendee, int number,
+                                  const Extension& other_extension,
+                                  Arena* other_arena);
 
   // Returns true and fills field_number and extension if extension is found.
   // Note to support packed repeated field compatibility, it also fills whether
@@ -806,6 +815,9 @@
                              ExtensionFinder* extension_finder,
                              MessageSetFieldSkipper* field_skipper);
 
+  // Returns true if extension is present and lazy.
+  bool HasLazy(int number) const;
+
   // Gets the extension with the given number, creating it if it does not
   // already exist.  Returns true if the extension did not already exist.
   bool MaybeNewExtension(int number, const FieldDescriptor* descriptor,
@@ -1078,7 +1090,7 @@
   template <>                                                                  \
   inline void PrimitiveTypeTraits<TYPE>::Set(int number, FieldType field_type, \
                                              TYPE value, ExtensionSet* set) {  \
-    set->Set##METHOD(number, field_type, value, NULL);                         \
+    set->Set##METHOD(number, field_type, value, nullptr);                      \
   }                                                                            \
                                                                                \
   template <>                                                                  \
@@ -1100,7 +1112,7 @@
   inline void RepeatedPrimitiveTypeTraits<TYPE>::Add(                          \
       int number, FieldType field_type, bool is_packed, TYPE value,            \
       ExtensionSet* set) {                                                     \
-    set->Add##METHOD(number, field_type, is_packed, value, NULL);              \
+    set->Add##METHOD(number, field_type, is_packed, value, nullptr);           \
   }                                                                            \
   template <>                                                                  \
   inline const RepeatedField<TYPE>*                                            \
@@ -1126,7 +1138,7 @@
   RepeatedPrimitiveTypeTraits<TYPE>::MutableRepeated(                          \
       int number, FieldType field_type, bool is_packed, ExtensionSet* set) {   \
     return reinterpret_cast<RepeatedField<TYPE>*>(                             \
-        set->MutableRawRepeatedField(number, field_type, is_packed, NULL));    \
+        set->MutableRawRepeatedField(number, field_type, is_packed, nullptr)); \
   }
 
 PROTOBUF_DEFINE_PRIMITIVE_TYPE(int32_t, Int32)
@@ -1159,11 +1171,11 @@
   }
   static inline void Set(int number, FieldType field_type,
                          const std::string& value, ExtensionSet* set) {
-    set->SetString(number, field_type, value, NULL);
+    set->SetString(number, field_type, value, nullptr);
   }
   static inline std::string* Mutable(int number, FieldType field_type,
                                      ExtensionSet* set) {
-    return set->MutableString(number, field_type, NULL);
+    return set->MutableString(number, field_type, nullptr);
   }
   template <typename ExtendeeT>
   static void Register(int number, FieldType type, bool is_packed) {
@@ -1201,11 +1213,11 @@
   }
   static inline void Add(int number, FieldType field_type, bool /*is_packed*/,
                          const std::string& value, ExtensionSet* set) {
-    set->AddString(number, field_type, value, NULL);
+    set->AddString(number, field_type, value, nullptr);
   }
   static inline std::string* Add(int number, FieldType field_type,
                                  ExtensionSet* set) {
-    return set->AddString(number, field_type, NULL);
+    return set->AddString(number, field_type, nullptr);
   }
   static inline const RepeatedPtrField<std::string>& GetRepeated(
       int number, const ExtensionSet& set) {
@@ -1216,7 +1228,7 @@
   static inline RepeatedPtrField<std::string>* MutableRepeated(
       int number, FieldType field_type, bool is_packed, ExtensionSet* set) {
     return reinterpret_cast<RepeatedPtrField<std::string>*>(
-        set->MutableRawRepeatedField(number, field_type, is_packed, NULL));
+        set->MutableRawRepeatedField(number, field_type, is_packed, nullptr));
   }
 
   static const RepeatedFieldType* GetDefaultRepeatedField();
@@ -1256,7 +1268,7 @@
   static inline void Set(int number, FieldType field_type, ConstType value,
                          ExtensionSet* set) {
     GOOGLE_DCHECK(IsValid(value));
-    set->SetEnum(number, field_type, value, NULL);
+    set->SetEnum(number, field_type, value, nullptr);
   }
   template <typename ExtendeeT>
   static void Register(int number, FieldType type, bool is_packed) {
@@ -1290,7 +1302,7 @@
   static inline void Add(int number, FieldType field_type, bool is_packed,
                          ConstType value, ExtensionSet* set) {
     GOOGLE_DCHECK(IsValid(value));
-    set->AddEnum(number, field_type, is_packed, value, NULL);
+    set->AddEnum(number, field_type, is_packed, value, nullptr);
   }
   static inline const RepeatedField<Type>& GetRepeated(
       int number, const ExtensionSet& set) {
@@ -1310,7 +1322,7 @@
                                                      bool is_packed,
                                                      ExtensionSet* set) {
     return reinterpret_cast<RepeatedField<Type>*>(
-        set->MutableRawRepeatedField(number, field_type, is_packed, NULL));
+        set->MutableRawRepeatedField(number, field_type, is_packed, nullptr));
   }
 
   static const RepeatedFieldType* GetDefaultRepeatedField() {
@@ -1347,27 +1359,27 @@
                               ConstType default_value) {
     return static_cast<const Type&>(set.GetMessage(number, default_value));
   }
-  static inline std::nullptr_t GetPtr(int number, const ExtensionSet& set,
-                                      ConstType default_value) {
+  static inline std::nullptr_t GetPtr(int /* number */, const ExtensionSet& /* set */,
+                                      ConstType /* default_value */) {
     // Cannot be implemented because of forward declared messages?
     return nullptr;
   }
   static inline MutableType Mutable(int number, FieldType field_type,
                                     ExtensionSet* set) {
     return static_cast<Type*>(set->MutableMessage(
-        number, field_type, Type::default_instance(), NULL));
+        number, field_type, Type::default_instance(), nullptr));
   }
   static inline void SetAllocated(int number, FieldType field_type,
                                   MutableType message, ExtensionSet* set) {
-    set->SetAllocatedMessage(number, field_type, NULL, message);
+    set->SetAllocatedMessage(number, field_type, nullptr, message);
   }
   static inline void UnsafeArenaSetAllocated(int number, FieldType field_type,
                                              MutableType message,
                                              ExtensionSet* set) {
-    set->UnsafeArenaSetAllocatedMessage(number, field_type, NULL, message);
+    set->UnsafeArenaSetAllocatedMessage(number, field_type, nullptr, message);
   }
-  static inline PROTOBUF_MUST_USE_RESULT MutableType
-  Release(int number, FieldType /* field_type */, ExtensionSet* set) {
+  PROTOBUF_NODISCARD static inline MutableType Release(
+      int number, FieldType /* field_type */, ExtensionSet* set) {
     return static_cast<Type*>(
         set->ReleaseMessage(number, Type::default_instance()));
   }
@@ -1400,13 +1412,13 @@
   static inline ConstType Get(int number, const ExtensionSet& set, int index) {
     return static_cast<const Type&>(set.GetRepeatedMessage(number, index));
   }
-  static inline std::nullptr_t GetPtr(int number, const ExtensionSet& set,
-                                      int index) {
+  static inline std::nullptr_t GetPtr(int /* number */, const ExtensionSet& /* set */,
+                                      int /* index */) {
     // Cannot be implemented because of forward declared messages?
     return nullptr;
   }
-  static inline std::nullptr_t GetRepeatedPtr(int number,
-                                              const ExtensionSet& set) {
+  static inline std::nullptr_t GetRepeatedPtr(int /* number */,
+                                              const ExtensionSet& /* set */) {
     // Cannot be implemented because of forward declared messages?
     return nullptr;
   }
@@ -1416,7 +1428,7 @@
   static inline MutableType Add(int number, FieldType field_type,
                                 ExtensionSet* set) {
     return static_cast<Type*>(
-        set->AddMessage(number, field_type, Type::default_instance(), NULL));
+        set->AddMessage(number, field_type, Type::default_instance(), nullptr));
   }
   static inline const RepeatedPtrField<Type>& GetRepeated(
       int number, const ExtensionSet& set) {
@@ -1433,7 +1445,7 @@
                                                         bool is_packed,
                                                         ExtensionSet* set) {
     return reinterpret_cast<RepeatedPtrField<Type>*>(
-        set->MutableRawRepeatedField(number, field_type, is_packed, NULL));
+        set->MutableRawRepeatedField(number, field_type, is_packed, nullptr));
   }
 
   static const RepeatedFieldType* GetDefaultRepeatedField();
diff --git a/src/google/protobuf/extension_set_heavy.cc b/src/google/protobuf/extension_set_heavy.cc
index feb6dfb..91187af 100644
--- a/src/google/protobuf/extension_set_heavy.cc
+++ b/src/google/protobuf/extension_set_heavy.cc
@@ -157,7 +157,7 @@
     GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
     if (extension->is_lazy) {
       return extension->lazymessage_value->GetMessage(
-          *factory->GetPrototype(message_type));
+          *factory->GetPrototype(message_type), arena_);
     } else {
       return *extension->message_value;
     }
@@ -194,14 +194,14 @@
                                           MessageFactory* factory) {
   Extension* extension = FindOrNull(descriptor->number());
   if (extension == nullptr) {
-    // Not present.  Return NULL.
+    // Not present.  Return nullptr.
     return nullptr;
   } else {
     GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
     MessageLite* ret = nullptr;
     if (extension->is_lazy) {
       ret = extension->lazymessage_value->ReleaseMessage(
-          *factory->GetPrototype(descriptor->message_type()));
+          *factory->GetPrototype(descriptor->message_type()), arena_);
       if (arena_ == nullptr) {
         delete extension->lazymessage_value;
       }
@@ -222,14 +222,14 @@
     const FieldDescriptor* descriptor, MessageFactory* factory) {
   Extension* extension = FindOrNull(descriptor->number());
   if (extension == nullptr) {
-    // Not present.  Return NULL.
+    // Not present.  Return nullptr.
     return nullptr;
   } else {
     GOOGLE_DCHECK_TYPE(*extension, OPTIONAL, MESSAGE);
     MessageLite* ret = nullptr;
     if (extension->is_lazy) {
       ret = extension->lazymessage_value->UnsafeArenaReleaseMessage(
-          *factory->GetPrototype(descriptor->message_type()));
+          *factory->GetPrototype(descriptor->message_type()), arena_);
       if (arena_ == nullptr) {
         delete extension->lazymessage_value;
       }
@@ -313,7 +313,7 @@
       output->message_info.prototype =
           factory_->GetPrototype(extension->message_type());
       GOOGLE_CHECK(output->message_info.prototype != nullptr)
-          << "Extension factory's GetPrototype() returned NULL for extension: "
+          << "Extension factory's GetPrototype() returned nullptr; extension: "
           << extension->full_name();
     } else if (extension->cpp_type() == FieldDescriptor::CPPTYPE_ENUM) {
       output->enum_validity_check.func = ValidateEnumUsingDescriptor;
diff --git a/src/google/protobuf/extension_set_unittest.cc b/src/google/protobuf/extension_set_unittest.cc
index 870f313..debdd66 100644
--- a/src/google/protobuf/extension_set_unittest.cc
+++ b/src/google/protobuf/extension_set_unittest.cc
@@ -170,9 +170,9 @@
   message.SetAllocatedExtension(unittest::optional_foreign_message_extension,
                                 new unittest::ForeignMessage());
 
-  // SetAllocatedExtension with a NULL parameter is equivalent to ClearExtenion.
+  // SetAllocatedExtension with nullptr is equivalent to ClearExtenion.
   message.SetAllocatedExtension(unittest::optional_foreign_message_extension,
-                                NULL);
+                                nullptr);
   EXPECT_FALSE(
       message.HasExtension(unittest::optional_foreign_message_extension));
 }
@@ -204,7 +204,7 @@
       unittest::TestMessageSetExtension1::message_set_extension);
   released_extension = message.ReleaseExtension(
       unittest::TestMessageSetExtension1::message_set_extension);
-  EXPECT_TRUE(released_extension != NULL);
+  EXPECT_TRUE(released_extension != nullptr);
   delete released_extension;
 }
 
@@ -457,7 +457,7 @@
   message2->SetExtension(unittest::optional_int32_extension, 101);
   TestUtil::ExpectAllExtensionsSet(*message1);
   TestUtil::ExpectAllExtensionsSet(*message2);
-  arena2.reset(NULL);
+  arena2.reset(nullptr);
   TestUtil::ExpectAllExtensionsSet(*message1);
   // Test corner cases, when one is empty and other is not.
   Arena arena3, arena4;
@@ -1205,7 +1205,7 @@
   // Now build the file, using the generated pool as an underlay.
   DescriptorPool dynamic_pool(DescriptorPool::generated_pool());
   const FileDescriptor* file = dynamic_pool.BuildFile(dynamic_proto);
-  ASSERT_TRUE(file != NULL);
+  ASSERT_TRUE(file != nullptr);
   DynamicMessageFactory dynamic_factory(&dynamic_pool);
   dynamic_factory.SetDelegateToGeneratedFactory(true);
 
@@ -1292,7 +1292,7 @@
   {
     const FieldDescriptor* message_extension =
         file->FindExtensionByName("message_extension");
-    ASSERT_TRUE(message_extension != NULL);
+    ASSERT_TRUE(message_extension != nullptr);
     const Message& sub_message =
         message.GetReflection()->GetMessage(message, message_extension);
     const unittest::ForeignMessage* typed_sub_message =
@@ -1301,7 +1301,7 @@
 #else
         static_cast<const unittest::ForeignMessage*>(&sub_message);
 #endif
-    ASSERT_TRUE(typed_sub_message != NULL);
+    ASSERT_TRUE(typed_sub_message != nullptr);
     EXPECT_EQ(456, typed_sub_message->c());
   }
 
@@ -1310,7 +1310,7 @@
   {
     const FieldDescriptor* dynamic_message_extension =
         file->FindExtensionByName("dynamic_message_extension");
-    ASSERT_TRUE(dynamic_message_extension != NULL);
+    ASSERT_TRUE(dynamic_message_extension != nullptr);
     const Message& parent = unittest::TestAllExtensions::default_instance();
     const Message& sub_message = parent.GetReflection()->GetMessage(
         parent, dynamic_message_extension, &dynamic_factory);
diff --git a/src/google/protobuf/field_mask.pb.cc b/src/google/protobuf/field_mask.pb.cc
index fbb4f12..60edb1e 100644
--- a/src/google/protobuf/field_mask.pb.cc
+++ b/src/google/protobuf/field_mask.pb.cc
@@ -34,7 +34,7 @@
 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2ffield_5fmask_2eproto = nullptr;
 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2ffield_5fmask_2eproto = nullptr;
 
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2ffield_5fmask_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   ~0u,  // no _has_bits_
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::FieldMask, _internal_metadata_),
   ~0u,  // no _extensions_
@@ -97,7 +97,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.FieldMask)
 }
 
-void FieldMask::SharedCtor() {
+inline void FieldMask::SharedCtor() {
 }
 
 FieldMask::~FieldMask() {
@@ -123,7 +123,7 @@
 
 void FieldMask::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.FieldMask)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -134,12 +134,12 @@
 const char* FieldMask::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // repeated string paths = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -175,10 +175,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* FieldMask::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* FieldMask::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FieldMask)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // repeated string paths = 1;
@@ -203,7 +203,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FieldMask)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -234,7 +234,7 @@
 void FieldMask::MergeFrom(const FieldMask& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FieldMask)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   paths_.MergeFrom(from.paths_);
diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h
index 849f4f2..dac4f5f 100644
--- a/src/google/protobuf/field_mask.pb.h
+++ b/src/google/protobuf/field_mask.pb.h
@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3018000
+#if PROTOBUF_VERSION < 3019000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
@@ -50,7 +50,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
   static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
-  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+  static const uint32_t offsets[];
 };
 PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ffield_5fmask_2eproto;
 PROTOBUF_NAMESPACE_OPEN
@@ -120,7 +120,12 @@
   }
   inline void Swap(FieldMask* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -134,11 +139,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline FieldMask* New() const final {
-    return new FieldMask();
-  }
-
-  FieldMask* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  FieldMask* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<FieldMask>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -153,8 +154,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -162,6 +163,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(FieldMask* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.FieldMask";
diff --git a/src/google/protobuf/generated_message_reflection.cc b/src/google/protobuf/generated_message_reflection.cc
index 7962327..cf7cd85 100644
--- a/src/google/protobuf/generated_message_reflection.cc
+++ b/src/google/protobuf/generated_message_reflection.cc
@@ -50,10 +50,13 @@
 #include <google/protobuf/repeated_field.h>
 #include <google/protobuf/unknown_field_set.h>
 #include <google/protobuf/wire_format.h>
+#include <google/protobuf/stubs/casts.h>
 #include <google/protobuf/stubs/strutil.h>
 
 
+// clang-format off
 #include <google/protobuf/port_def.inc>
+// clang-format on
 
 #define GOOGLE_PROTOBUF_HAS_ONEOF
 
@@ -248,6 +251,12 @@
       ->mutable_unknown_fields<UnknownFieldSet>();
 }
 
+bool Reflection::IsLazyExtension(const Message& message,
+                                 const FieldDescriptor* field) const {
+  return field->is_extension() &&
+         GetExtensionSet(message).HasLazy(field->number());
+}
+
 bool Reflection::IsLazilyVerifiedLazyField(const FieldDescriptor* field) const {
   return field->options().lazy();
 }
@@ -987,6 +996,8 @@
   GOOGLE_DCHECK(!unsafe_shallow_swap || message1->GetArenaForAllocation() ==
                                      message2->GetArenaForAllocation());
 
+  const Message* prototype =
+      message_factory_->GetPrototype(message1->GetDescriptor());
   for (const auto* field : fields) {
     CheckInvalidAccess(schema_, field);
     if (field->is_extension()) {
@@ -995,7 +1006,7 @@
             MutableExtensionSet(message2), field->number());
       } else {
         MutableExtensionSet(message1)->SwapExtension(
-            MutableExtensionSet(message2), field->number());
+            prototype, MutableExtensionSet(message2), field->number());
       }
     } else {
       if (schema_.InRealOneof(field)) {
@@ -1604,6 +1615,7 @@
 const std::string& Reflection::GetStringReference(const Message& message,
                                                   const FieldDescriptor* field,
                                                   std::string* scratch) const {
+  (void)scratch;  // Parameter is used by Google-internal code.
   USAGE_CHECK_ALL(GetStringReference, SINGULAR, STRING);
   if (field->is_extension()) {
     return GetExtensionSet(message).GetString(field->number(),
@@ -1692,6 +1704,7 @@
 const std::string& Reflection::GetRepeatedStringReference(
     const Message& message, const FieldDescriptor* field, int index,
     std::string* scratch) const {
+  (void)scratch;  // Parameter is used by Google-internal code.
   USAGE_CHECK_ALL(GetRepeatedStringReference, REPEATED, STRING);
   if (field->is_extension()) {
     return GetExtensionSet(message).GetRepeatedString(field->number(), index);
@@ -2231,6 +2244,7 @@
                                           FieldDescriptor::CppType cpptype,
                                           int ctype,
                                           const Descriptor* desc) const {
+  (void)ctype;  // Parameter is used by Google-internal code.
   USAGE_CHECK_REPEATED("MutableRawRepeatedField");
   CheckInvalidAccess(schema_, field);
 
@@ -2508,9 +2522,13 @@
       case FieldDescriptor::CPPTYPE_UINT64:
         return GetRaw<uint64_t>(message, field) != 0;
       case FieldDescriptor::CPPTYPE_FLOAT:
-        return GetRaw<float>(message, field) != 0.0;
+        static_assert(sizeof(uint32_t) == sizeof(float),
+                      "Code assumes uint32_t and float are the same size.");
+        return GetRaw<uint32_t>(message, field) != 0;
       case FieldDescriptor::CPPTYPE_DOUBLE:
-        return GetRaw<double>(message, field) != 0.0;
+        static_assert(sizeof(uint64_t) == sizeof(double),
+                      "Code assumes uint64_t and double are the same size.");
+        return GetRaw<uint64_t>(message, field) != 0;
       case FieldDescriptor::CPPTYPE_ENUM:
         return GetRaw<int>(message, field) != 0;
       case FieldDescriptor::CPPTYPE_MESSAGE:
@@ -2620,19 +2638,19 @@
   }
 }
 
-#define HANDLE_TYPE(TYPE, CPPTYPE, CTYPE)                                \
-  template <>                                                            \
-  const RepeatedField<TYPE>& Reflection::GetRepeatedFieldInternal<TYPE>( \
-      const Message& message, const FieldDescriptor* field) const {      \
-    return *static_cast<RepeatedField<TYPE>*>(MutableRawRepeatedField(   \
-        const_cast<Message*>(&message), field, CPPTYPE, CTYPE, NULL));   \
-  }                                                                      \
-                                                                         \
-  template <>                                                            \
-  RepeatedField<TYPE>* Reflection::MutableRepeatedFieldInternal<TYPE>(   \
-      Message * message, const FieldDescriptor* field) const {           \
-    return static_cast<RepeatedField<TYPE>*>(                            \
-        MutableRawRepeatedField(message, field, CPPTYPE, CTYPE, NULL));  \
+#define HANDLE_TYPE(TYPE, CPPTYPE, CTYPE)                                  \
+  template <>                                                              \
+  const RepeatedField<TYPE>& Reflection::GetRepeatedFieldInternal<TYPE>(   \
+      const Message& message, const FieldDescriptor* field) const {        \
+    return *static_cast<RepeatedField<TYPE>*>(MutableRawRepeatedField(     \
+        const_cast<Message*>(&message), field, CPPTYPE, CTYPE, nullptr));  \
+  }                                                                        \
+                                                                           \
+  template <>                                                              \
+  RepeatedField<TYPE>* Reflection::MutableRepeatedFieldInternal<TYPE>(     \
+      Message * message, const FieldDescriptor* field) const {             \
+    return static_cast<RepeatedField<TYPE>*>(                              \
+        MutableRawRepeatedField(message, field, CPPTYPE, CTYPE, nullptr)); \
   }
 
 HANDLE_TYPE(int32_t, FieldDescriptor::CPPTYPE_INT32, -1);
@@ -2649,9 +2667,10 @@
 void* Reflection::MutableRawRepeatedString(Message* message,
                                            const FieldDescriptor* field,
                                            bool is_string) const {
+  (void)is_string;  // Parameter is used by Google-internal code.
   return MutableRawRepeatedField(message, field,
                                  FieldDescriptor::CPPTYPE_STRING,
-                                 FieldOptions::STRING, NULL);
+                                 FieldOptions::STRING, nullptr);
 }
 
 // Template implementations of basic accessors.  Inline because each
@@ -3003,7 +3022,7 @@
 }
 
 void UnknownFieldSetSerializer(const uint8_t* base, uint32_t offset,
-                               uint32_t tag, uint32_t has_offset,
+                               uint32_t /*tag*/, uint32_t /*has_offset*/,
                                io::CodedOutputStream* output) {
   const void* ptr = base + offset;
   const InternalMetadata* metadata = static_cast<const InternalMetadata*>(ptr);
diff --git a/src/google/protobuf/generated_message_reflection_unittest.cc b/src/google/protobuf/generated_message_reflection_unittest.cc
index a0c4ea5..8607d09 100644
--- a/src/google/protobuf/generated_message_reflection_unittest.cc
+++ b/src/google/protobuf/generated_message_reflection_unittest.cc
@@ -52,6 +52,8 @@
 #include <google/protobuf/map_unittest.pb.h>
 #include <google/protobuf/test_util.h>
 #include <google/protobuf/unittest.pb.h>
+#include <google/protobuf/unittest_mset.pb.h>
+#include <google/protobuf/unittest_mset_wire_format.pb.h>
 #include <google/protobuf/arena.h>
 #include <google/protobuf/descriptor.h>
 #include <google/protobuf/testing/googletest.h>
@@ -70,6 +72,9 @@
       const std::vector<const FieldDescriptor*>& fields) {
     lhs->GetReflection()->UnsafeShallowSwapFields(lhs, rhs, fields);
   }
+  static bool IsLazyExtension(const Message& msg, const FieldDescriptor* ext) {
+    return msg.GetReflection()->IsLazyExtension(msg, ext);
+  }
 };
 
 namespace {
@@ -78,7 +83,7 @@
 const FieldDescriptor* F(const std::string& name) {
   const FieldDescriptor* result =
       unittest::TestAllTypes::descriptor()->FindFieldByName(name);
-  GOOGLE_CHECK(result != NULL);
+  GOOGLE_CHECK(result != nullptr);
   return result;
 }
 
@@ -705,13 +710,14 @@
             reflection->FindKnownExtensionByNumber(extension2->number()));
 
   // Non-existent extension.
-  EXPECT_TRUE(reflection->FindKnownExtensionByNumber(62341) == NULL);
+  EXPECT_TRUE(reflection->FindKnownExtensionByNumber(62341) == nullptr);
 
   // Extensions of TestAllExtensions should not show up as extensions of
   // other types.
   EXPECT_TRUE(unittest::TestAllTypes::default_instance()
                   .GetReflection()
-                  ->FindKnownExtensionByNumber(extension1->number()) == NULL);
+                  ->FindKnownExtensionByNumber(extension1->number()) ==
+              nullptr);
 }
 
 TEST(GeneratedMessageReflectionTest, FindKnownExtensionByName) {
@@ -731,13 +737,14 @@
             reflection->FindKnownExtensionByName(extension2->full_name()));
 
   // Non-existent extension.
-  EXPECT_TRUE(reflection->FindKnownExtensionByName("no_such_ext") == NULL);
+  EXPECT_TRUE(reflection->FindKnownExtensionByName("no_such_ext") == nullptr);
 
   // Extensions of TestAllExtensions should not show up as extensions of
   // other types.
   EXPECT_TRUE(unittest::TestAllTypes::default_instance()
                   .GetReflection()
-                  ->FindKnownExtensionByName(extension1->full_name()) == NULL);
+                  ->FindKnownExtensionByName(extension1->full_name()) ==
+              nullptr);
 }
 
 
@@ -750,11 +757,11 @@
   reflection_tester.SetAllFieldsViaReflection(&from_message1);
   reflection_tester.SetAllFieldsViaReflection(&from_message2);
 
-  // Before moving fields, we expect the nested messages to be NULL.
+  // Before moving fields, we expect the nested messages to be nullptr.
   reflection_tester.ExpectMessagesReleasedViaReflection(
       &to_message, TestUtil::ReflectionTester::IS_NULL);
 
-  // After fields are moved we should get non-NULL releases.
+  // After fields are moved we should get non-nullptr releases.
   reflection_tester.SetAllocatedOptionalMessageFieldsToMessageViaReflection(
       &from_message1, &to_message);
   reflection_tester.ExpectMessagesReleasedViaReflection(
@@ -767,7 +774,7 @@
       &to_message, TestUtil::ReflectionTester::NOT_NULL);
 
   // After SetAllocatedOptionalMessageFieldsToNullViaReflection() we expect the
-  // releases to be NULL again.
+  // releases to be nullptr again.
   reflection_tester.SetAllocatedOptionalMessageFieldsToNullViaReflection(
       &to_message);
   reflection_tester.ExpectMessagesReleasedViaReflection(
@@ -785,11 +792,11 @@
   reflection_tester.SetAllFieldsViaReflection(&from_message1);
   reflection_tester.SetAllFieldsViaReflection(&from_message2);
 
-  // Before moving fields, we expect the nested messages to be NULL.
+  // Before moving fields, we expect the nested messages to be nullptr.
   reflection_tester.ExpectMessagesReleasedViaReflection(
       to_message, TestUtil::ReflectionTester::IS_NULL);
 
-  // After fields are moved we should get non-NULL releases.
+  // After fields are moved we should get non-nullptr releases.
   reflection_tester.SetAllocatedOptionalMessageFieldsToMessageViaReflection(
       &from_message1, to_message);
   reflection_tester.ExpectMessagesReleasedViaReflection(
@@ -802,7 +809,7 @@
       to_message, TestUtil::ReflectionTester::NOT_NULL);
 
   // After SetAllocatedOptionalMessageFieldsToNullViaReflection() we expect the
-  // releases to be NULL again.
+  // releases to be nullptr again.
   reflection_tester.SetAllocatedOptionalMessageFieldsToNullViaReflection(
       to_message);
   reflection_tester.ExpectMessagesReleasedViaReflection(
@@ -818,11 +825,11 @@
   reflection_tester.SetAllFieldsViaReflection(&from_message1);
   reflection_tester.SetAllFieldsViaReflection(&from_message2);
 
-  // Before moving fields, we expect the nested messages to be NULL.
+  // Before moving fields, we expect the nested messages to be nullptr.
   reflection_tester.ExpectMessagesReleasedViaReflection(
       &to_message, TestUtil::ReflectionTester::IS_NULL);
 
-  // After fields are moved we should get non-NULL releases.
+  // After fields are moved we should get non-nullptr releases.
   reflection_tester.SetAllocatedOptionalMessageFieldsToMessageViaReflection(
       &from_message1, &to_message);
   reflection_tester.ExpectMessagesReleasedViaReflection(
@@ -835,7 +842,7 @@
       &to_message, TestUtil::ReflectionTester::NOT_NULL);
 
   // After SetAllocatedOptionalMessageFieldsToNullViaReflection() we expect the
-  // releases to be NULL again.
+  // releases to be nullptr again.
   reflection_tester.SetAllocatedOptionalMessageFieldsToNullViaReflection(
       &to_message);
   reflection_tester.ExpectMessagesReleasedViaReflection(
@@ -853,11 +860,11 @@
   reflection_tester.SetAllFieldsViaReflection(&from_message1);
   reflection_tester.SetAllFieldsViaReflection(&from_message2);
 
-  // Before moving fields, we expect the nested messages to be NULL.
+  // Before moving fields, we expect the nested messages to be nullptr.
   reflection_tester.ExpectMessagesReleasedViaReflection(
       to_message, TestUtil::ReflectionTester::IS_NULL);
 
-  // After fields are moved we should get non-NULL releases.
+  // After fields are moved we should get non-nullptr releases.
   reflection_tester.SetAllocatedOptionalMessageFieldsToMessageViaReflection(
       &from_message1, to_message);
   reflection_tester.ExpectMessagesReleasedViaReflection(
@@ -870,7 +877,7 @@
       to_message, TestUtil::ReflectionTester::NOT_NULL);
 
   // After SetAllocatedOptionalMessageFieldsToNullViaReflection() we expect the
-  // releases to be NULL again.
+  // releases to be nullptr again.
   reflection_tester.SetAllocatedOptionalMessageFieldsToNullViaReflection(
       to_message);
   reflection_tester.ExpectMessagesReleasedViaReflection(
@@ -1022,10 +1029,10 @@
 
   Message* released = reflection->ReleaseMessage(
       &to_message, descriptor->FindFieldByName("foo_lazy_message"));
-  EXPECT_TRUE(released == NULL);
+  EXPECT_TRUE(released == nullptr);
   released = reflection->ReleaseMessage(
       &to_message, descriptor->FindFieldByName("foo_message"));
-  EXPECT_TRUE(released == NULL);
+  EXPECT_TRUE(released == nullptr);
 
   TestUtil::ReflectionTester::SetOneofViaReflection(&from_message1);
   TestUtil::ReflectionTester::ExpectOneofSetViaReflection(from_message1);
@@ -1038,7 +1045,7 @@
   (void)sub_message;  // unused in somce configurations
   released = reflection->ReleaseMessage(
       &to_message, descriptor->FindFieldByName("foo_lazy_message"));
-  EXPECT_TRUE(released != NULL);
+  EXPECT_TRUE(released != nullptr);
   EXPECT_EQ(&sub_message, released);
   delete released;
 
@@ -1056,7 +1063,7 @@
   (void)sub_message2;  // unused in somce configurations
   released = reflection->ReleaseMessage(
       &to_message, descriptor->FindFieldByName("foo_message"));
-  EXPECT_TRUE(released != NULL);
+  EXPECT_TRUE(released != nullptr);
   EXPECT_EQ(&sub_message2, released);
   delete released;
 }
@@ -1072,10 +1079,10 @@
 
   Message* released = reflection->ReleaseMessage(
       to_message, descriptor->FindFieldByName("foo_lazy_message"));
-  EXPECT_TRUE(released == NULL);
+  EXPECT_TRUE(released == nullptr);
   released = reflection->ReleaseMessage(
       to_message, descriptor->FindFieldByName("foo_message"));
-  EXPECT_TRUE(released == NULL);
+  EXPECT_TRUE(released == nullptr);
 
   TestUtil::ReflectionTester::SetOneofViaReflection(&from_message1);
   TestUtil::ReflectionTester::ExpectOneofSetViaReflection(from_message1);
@@ -1087,7 +1094,7 @@
       *to_message, descriptor->FindFieldByName("foo_lazy_message"));
   released = reflection->ReleaseMessage(
       to_message, descriptor->FindFieldByName("foo_lazy_message"));
-  EXPECT_TRUE(released != NULL);
+  EXPECT_TRUE(released != nullptr);
   // Since sub_message is arena allocated, releasing it results in copying it
   // into new heap-allocated memory.
   EXPECT_NE(&sub_message, released);
@@ -1106,7 +1113,7 @@
       *to_message, descriptor->FindFieldByName("foo_message"));
   released = reflection->ReleaseMessage(
       to_message, descriptor->FindFieldByName("foo_message"));
-  EXPECT_TRUE(released != NULL);
+  EXPECT_TRUE(released != nullptr);
   // Since sub_message2 is arena allocated, releasing it results in copying it
   // into new heap-allocated memory.
   EXPECT_NE(&sub_message2, released);
@@ -1118,11 +1125,11 @@
   TestUtil::ReflectionTester reflection_tester(
       unittest::TestAllTypes::descriptor());
 
-  // When nothing is set, we expect all released messages to be NULL.
+  // When nothing is set, we expect all released messages to be nullptr.
   reflection_tester.ExpectMessagesReleasedViaReflection(
       &message, TestUtil::ReflectionTester::IS_NULL);
 
-  // After fields are set we should get non-NULL releases.
+  // After fields are set we should get non-nullptr releases.
   reflection_tester.SetAllFieldsViaReflection(&message);
   reflection_tester.ExpectMessagesReleasedViaReflection(
       &message, TestUtil::ReflectionTester::NOT_NULL);
@@ -1144,11 +1151,11 @@
   TestUtil::ReflectionTester reflection_tester(
       unittest::TestAllExtensions::descriptor());
 
-  // When nothing is set, we expect all released messages to be NULL.
+  // When nothing is set, we expect all released messages to be nullptr.
   reflection_tester.ExpectMessagesReleasedViaReflection(
       &message, TestUtil::ReflectionTester::IS_NULL);
 
-  // After fields are set we should get non-NULL releases.
+  // After fields are set we should get non-nullptr releases.
   reflection_tester.SetAllFieldsViaReflection(&message);
   reflection_tester.ExpectMessagesReleasedViaReflection(
       &message, TestUtil::ReflectionTester::NOT_NULL);
@@ -1177,13 +1184,13 @@
   Message* released = reflection->ReleaseMessage(
       &message, descriptor->FindFieldByName("foo_lazy_message"));
 
-  EXPECT_TRUE(released != NULL);
+  EXPECT_TRUE(released != nullptr);
   EXPECT_EQ(&sub_message, released);
   delete released;
 
   released = reflection->ReleaseMessage(
       &message, descriptor->FindFieldByName("foo_lazy_message"));
-  EXPECT_TRUE(released == NULL);
+  EXPECT_TRUE(released == nullptr);
 }
 
 TEST(GeneratedMessageReflectionTest, ArenaReleaseMessageTest) {
@@ -1193,11 +1200,11 @@
   TestUtil::ReflectionTester reflection_tester(
       unittest::TestAllTypes::descriptor());
 
-  // When nothing is set, we expect all released messages to be NULL.
+  // When nothing is set, we expect all released messages to be nullptr.
   reflection_tester.ExpectMessagesReleasedViaReflection(
       message, TestUtil::ReflectionTester::IS_NULL);
 
-  // After fields are set we should get non-NULL releases.
+  // After fields are set we should get non-nullptr releases.
   reflection_tester.SetAllFieldsViaReflection(message);
   reflection_tester.ExpectMessagesReleasedViaReflection(
       message, TestUtil::ReflectionTester::NOT_NULL);
@@ -1217,11 +1224,11 @@
   TestUtil::ReflectionTester reflection_tester(
       unittest::TestAllExtensions::descriptor());
 
-  // When nothing is set, we expect all released messages to be NULL.
+  // When nothing is set, we expect all released messages to be nullptr.
   reflection_tester.ExpectMessagesReleasedViaReflection(
       message, TestUtil::ReflectionTester::IS_NULL);
 
-  // After fields are set we should get non-NULL releases.
+  // After fields are set we should get non-nullptr releases.
   reflection_tester.SetAllFieldsViaReflection(message);
   reflection_tester.ExpectMessagesReleasedViaReflection(
       message, TestUtil::ReflectionTester::NOT_NULL);
@@ -1245,12 +1252,12 @@
   Message* released = reflection->ReleaseMessage(
       message, descriptor->FindFieldByName("foo_lazy_message"));
 
-  EXPECT_TRUE(released != NULL);
+  EXPECT_TRUE(released != nullptr);
   delete released;
 
   released = reflection->ReleaseMessage(
       message, descriptor->FindFieldByName("foo_lazy_message"));
-  EXPECT_TRUE(released == NULL);
+  EXPECT_TRUE(released == nullptr);
 }
 
 #ifdef PROTOBUF_HAS_DEATH_TEST
diff --git a/src/google/protobuf/generated_message_table_driven.cc b/src/google/protobuf/generated_message_table_driven.cc
index 71ee647..f963d90 100644
--- a/src/google/protobuf/generated_message_table_driven.cc
+++ b/src/google/protobuf/generated_message_table_driven.cc
@@ -74,14 +74,14 @@
   static bool ParseExtension(MessageLite* msg, const ParseTable& table,
                              io::CodedInputStream* input, int tag) {
     ExtensionSet* extensions = GetExtensionSet(msg, table.extension_offset);
-    if (extensions == NULL) {
+    if (extensions == nullptr) {
       return false;
     }
 
     const Message* prototype =
         down_cast<const Message*>(table.default_instance());
 
-    GOOGLE_DCHECK(prototype != NULL);
+    GOOGLE_DCHECK(prototype != nullptr);
     GOOGLE_DCHECK(table.unknown_field_set);
     UnknownFieldSet* unknown_fields =
         MutableUnknownFields(msg, table.arena_offset);
diff --git a/src/google/protobuf/generated_message_table_driven.h b/src/google/protobuf/generated_message_table_driven.h
index 178a0c1..15eebcb 100644
--- a/src/google/protobuf/generated_message_table_driven.h
+++ b/src/google/protobuf/generated_message_table_driven.h
@@ -267,9 +267,10 @@
 }
 
 PROTOBUF_EXPORT uint8_t* SerializeInternalToArray(const uint8_t* base,
-                                  const FieldMetadata* table,
-                                  int32_t num_fields, bool is_deterministic,
-                                  uint8_t* buffer);
+                                                  const FieldMetadata* table,
+                                                  int32_t num_fields,
+                                                  bool is_deterministic,
+                                                  uint8_t* buffer);
 
 inline uint8_t* TableSerializeToArray(const MessageLite& msg,
                                       const SerializationTable* table,
diff --git a/src/google/protobuf/generated_message_table_driven_lite.cc b/src/google/protobuf/generated_message_table_driven_lite.cc
index 42c3475..596f356 100644
--- a/src/google/protobuf/generated_message_table_driven_lite.cc
+++ b/src/google/protobuf/generated_message_table_driven_lite.cc
@@ -78,7 +78,7 @@
   static bool ParseExtension(MessageLite* msg, const ParseTable& table,
                              io::CodedInputStream* input, int tag) {
     ExtensionSet* extensions = GetExtensionSet(msg, table.extension_offset);
-    if (extensions == NULL) {
+    if (extensions == nullptr) {
       return false;
     }
 
diff --git a/src/google/protobuf/generated_message_table_driven_lite.h b/src/google/protobuf/generated_message_table_driven_lite.h
index 032dd0e..a05afc0 100644
--- a/src/google/protobuf/generated_message_table_driven_lite.h
+++ b/src/google/protobuf/generated_message_table_driven_lite.h
@@ -83,7 +83,7 @@
 inline ExtensionSet* GetExtensionSet(MessageLite* msg,
                                      int64_t extension_offset) {
   if (extension_offset == -1) {
-    return NULL;
+    return nullptr;
   }
 
   return Raw<ExtensionSet>(msg, extension_offset);
@@ -148,7 +148,7 @@
                             MessageLite* msg) {
   switch (field.processing_type & kTypeMask) {
     case WireFormatLite::TYPE_MESSAGE:
-      if (arena == NULL) {
+      if (arena == nullptr) {
         delete *Raw<MessageLite*>(msg, field.offset);
       }
       break;
@@ -161,7 +161,7 @@
 
     case TYPE_STRING_INLINED:
     case TYPE_BYTES_INLINED:
-      Raw<InlinedStringField>(msg, field.offset)->DestroyNoArena(NULL);
+      Raw<InlinedStringField>(msg, field.offset)->DestroyNoArena(nullptr);
       break;
 
     default:
@@ -343,15 +343,12 @@
   typedef MessageLite Type;
   typedef MessageLite WeakType;
   static Arena* GetArena(Type* t) { return t->GetArena(); }
-  static void* GetMaybeArenaPointer(Type* t) {
-    return t->GetMaybeArenaPointer();
-  }
   static inline Type* NewFromPrototype(const Type* prototype,
-                                       Arena* arena = NULL) {
+                                       Arena* arena = nullptr) {
     return prototype->New(arena);
   }
-  static void Delete(Type* t, Arena* arena = NULL) {
-    if (arena == NULL) {
+  static void Delete(Type* t, Arena* arena = nullptr) {
+    if (arena == nullptr) {
       delete t;
     }
   }
@@ -376,7 +373,7 @@
   // TODO(ckennelly):  Make this a compile-time parameter with templates.
   GOOGLE_DCHECK_GE(table.has_bits_offset, 0);
   uint32_t* has_bits = Raw<uint32_t>(msg, table.has_bits_offset);
-  GOOGLE_DCHECK(has_bits != NULL);
+  GOOGLE_DCHECK(has_bits != nullptr);
 
   while (true) {
     uint32_t tag = input->ReadTagWithCutoffNoLastTag(kMaxTag).first;
@@ -623,7 +620,7 @@
               MutableField<MessageLite*>(msg, has_bits, presence_index, offset);
           MessageLite* submsg = *submsg_holder;
 
-          if (submsg == NULL) {
+          if (submsg == nullptr) {
             Arena* const arena = msg->GetArena();
             const MessageLite* prototype =
                 table.aux[field_number].messages.default_message();
@@ -642,7 +639,7 @@
           RepeatedPtrFieldBase* field = Raw<RepeatedPtrFieldBase>(msg, offset);
           const MessageLite* prototype =
               table.aux[field_number].messages.default_message();
-          GOOGLE_DCHECK(prototype != NULL);
+          GOOGLE_DCHECK(prototype != nullptr);
 
           MessageLite* submsg =
               MergePartialFromCodedStreamHelper::Add(field, prototype);
@@ -659,11 +656,11 @@
               MutableField<MessageLite*>(msg, has_bits, presence_index, offset);
           MessageLite* submsg = *submsg_holder;
 
-          if (submsg == NULL) {
+          if (submsg == nullptr) {
             Arena* const arena = msg->GetArena();
             const MessageLite* prototype =
                 table.aux[field_number].messages.default_message();
-            if (prototype == NULL) {
+            if (prototype == nullptr) {
               prototype = ImplicitWeakMessage::default_instance();
             }
             submsg = prototype->New(arena);
@@ -683,7 +680,7 @@
           RepeatedPtrFieldBase* field = Raw<RepeatedPtrFieldBase>(msg, offset);
           const MessageLite* prototype =
               table.aux[field_number].messages.default_message();
-          if (prototype == NULL) {
+          if (prototype == nullptr) {
             prototype = ImplicitWeakMessage::default_instance();
           }
 
@@ -703,7 +700,7 @@
           MessageLite** submsg_holder = Raw<MessageLite*>(msg, offset);
           ResetOneofField<ProcessingType_MESSAGE>(
               table, field_number, arena, msg, oneof_case + presence_index,
-              offset, NULL);
+              offset, nullptr);
           MessageLite* submsg = *submsg_holder;
 
           if (PROTOBUF_PREDICT_FALSE(
diff --git a/src/google/protobuf/generated_message_tctable_decl.h b/src/google/protobuf/generated_message_tctable_decl.h
index d294caa..4e5c1ea 100644
--- a/src/google/protobuf/generated_message_tctable_decl.h
+++ b/src/google/protobuf/generated_message_tctable_decl.h
@@ -65,39 +65,42 @@
   uint64_t data;
 };
 
-struct TailCallParseTableBase;
+struct TcParseTableBase;
 
 // TailCallParseFunc is the function pointer type used in the tailcall table.
 typedef const char* (*TailCallParseFunc)(PROTOBUF_TC_PARAM_DECL);
 
 #if defined(_MSC_VER) && !defined(_WIN64)
 #pragma warning(push)
-// TailCallParseTableBase is intentionally overaligned on 32 bit targets.
+// TcParseTableBase is intentionally overaligned on 32 bit targets.
 #pragma warning(disable : 4324)
 #endif
 
 // Base class for message-level table with info for the tail-call parser.
-struct alignas(uint64_t) TailCallParseTableBase {
+struct alignas(uint64_t) TcParseTableBase {
   // Common attributes for message layout:
   uint16_t has_bits_offset;
   uint16_t extension_offset;
   uint32_t extension_range_low;
   uint32_t extension_range_high;
+  uint8_t fast_idx_mask;
+  uint8_t reserved;
+  uint16_t num_fields;
   const MessageLite* default_instance;
 
   // Handler for fields which are not handled by table dispatch.
   TailCallParseFunc fallback;
 
   // Table entry for fast-path tailcall dispatch handling.
-  struct FieldEntry {
+  struct FastFieldEntry {
     // Target function for dispatch:
     TailCallParseFunc target;
     // Field data used during parse:
     TcFieldData bits;
   };
   // There is always at least one table entry.
-  const FieldEntry* table() const {
-    return reinterpret_cast<const FieldEntry*>(this + 1);
+  const FastFieldEntry* fast_entry(size_t idx) const {
+    return reinterpret_cast<const FastFieldEntry*>(this + 1) + idx;
   }
 };
 
@@ -105,12 +108,12 @@
 #pragma warning(pop)
 #endif
 
-static_assert(sizeof(TailCallParseTableBase::FieldEntry) <= 16,
+static_assert(sizeof(TcParseTableBase::FastFieldEntry) <= 16,
               "Field entry is too big.");
 
-template <size_t kTableSizeLog2>
-struct TailCallParseTable {
-  TailCallParseTableBase header;
+template <size_t kFastTableSizeLog2>
+struct TcParseTable {
+  TcParseTableBase header;
 
   // Entries for each field.
   //
@@ -118,15 +121,14 @@
   // number is masked to fit inside the table. Note that the parsing logic
   // generally calls `TailCallParseTableBase::table()` instead of accessing
   // this field directly.
-  TailCallParseTableBase::FieldEntry entries[(1 << kTableSizeLog2)];
+  TcParseTableBase::FastFieldEntry entries[(1 << kFastTableSizeLog2)];
 };
 
-static_assert(std::is_standard_layout<TailCallParseTable<1>>::value,
-              "TailCallParseTable must be standard layout.");
+static_assert(std::is_standard_layout<TcParseTable<1>>::value,
+              "TcParseTable must be standard layout.");
 
-static_assert(offsetof(TailCallParseTable<1>, entries) ==
-                  sizeof(TailCallParseTableBase),
-              "Table entries must be laid out after TailCallParseTableBase.");
+static_assert(offsetof(TcParseTable<1>, entries) == sizeof(TcParseTableBase),
+              "Table entries must be laid out after TcParseTableBase.");
 
 }  // namespace internal
 }  // namespace protobuf
diff --git a/src/google/protobuf/generated_message_tctable_full.cc b/src/google/protobuf/generated_message_tctable_full.cc
index 634c663..44dcddc 100644
--- a/src/google/protobuf/generated_message_tctable_full.cc
+++ b/src/google/protobuf/generated_message_tctable_full.cc
@@ -44,7 +44,7 @@
 namespace protobuf {
 namespace internal {
 
-const char* TcParserBase::GenericFallback(PROTOBUF_TC_PARAM_DECL) {
+const char* TcParser::GenericFallback(PROTOBUF_TC_PARAM_DECL) {
   return GenericFallbackImpl<Message, UnknownFieldSet>(PROTOBUF_TC_PARAM_PASS);
 }
 
diff --git a/src/google/protobuf/generated_message_tctable_impl.h b/src/google/protobuf/generated_message_tctable_impl.h
index 33a351d..3f2b1ca 100644
--- a/src/google/protobuf/generated_message_tctable_impl.h
+++ b/src/google/protobuf/generated_message_tctable_impl.h
@@ -69,28 +69,28 @@
 #define PROTOBUF_TC_PARSE_SINGULAR1(MESSAGE) MESSAGE::Tct_ParseS1
 #else
 #define PROTOBUF_TC_PARSE_SINGULAR1(MESSAGE) \
-  ::google::protobuf::internal::TcParserBase::SingularParseMessage<MESSAGE, uint8_t>
+  ::google::protobuf::internal::TcParser::SingularParseMessage<MESSAGE, uint8_t>
 #endif  // PROTOBUF_TC_STATIC_PARSE_SINGULAR1
 
 #if PROTOBUF_TC_STATIC_PARSE_SINGULAR2
 #define PROTOBUF_TC_PARSE_SINGULAR2(MESSAGE) MESSAGE::Tct_ParseS2
 #else
 #define PROTOBUF_TC_PARSE_SINGULAR2(MESSAGE) \
-  ::google::protobuf::internal::TcParserBase::SingularParseMessage<MESSAGE, uint16_t>
+  ::google::protobuf::internal::TcParser::SingularParseMessage<MESSAGE, uint16_t>
 #endif  // PROTOBUF_TC_STATIC_PARSE_SINGULAR2
 
 #if PROTOBUF_TC_STATIC_PARSE_REPEATED1
 #define PROTOBUF_TC_PARSE_REPEATED1(MESSAGE) MESSAGE::Tct_ParseR1
 #else
 #define PROTOBUF_TC_PARSE_REPEATED1(MESSAGE) \
-  ::google::protobuf::internal::TcParserBase::RepeatedParseMessage<MESSAGE, uint8_t>
+  ::google::protobuf::internal::TcParser::RepeatedParseMessage<MESSAGE, uint8_t>
 #endif  // PROTOBUF_TC_STATIC_PARSE_REPEATED1
 
 #if PROTOBUF_TC_STATIC_PARSE_REPEATED2
 #define PROTOBUF_TC_PARSE_REPEATED2(MESSAGE) MESSAGE::Tct_ParseR2
 #else
 #define PROTOBUF_TC_PARSE_REPEATED2(MESSAGE) \
-  ::google::protobuf::internal::TcParserBase::RepeatedParseMessage<MESSAGE, uint16_t>
+  ::google::protobuf::internal::TcParser::RepeatedParseMessage<MESSAGE, uint16_t>
 #endif  // PROTOBUF_TC_STATIC_PARSE_REPEATED2
 
 #ifndef NDEBUG
@@ -106,11 +106,52 @@
 extern template void AlignFail<8>(uintptr_t);
 #endif
 
-class TcParserBase {
+// TcParser implements most of the parsing logic for tailcall tables.
+class TcParser final {
  public:
   static const char* GenericFallback(PROTOBUF_TC_PARAM_DECL);
   static const char* GenericFallbackLite(PROTOBUF_TC_PARAM_DECL);
 
+  // Dispatch to the designated parse function
+  inline PROTOBUF_ALWAYS_INLINE static const char* TagDispatch(
+      PROTOBUF_TC_PARAM_DECL) {
+    const auto coded_tag = UnalignedLoad<uint16_t>(ptr);
+    const size_t idx = coded_tag & table->fast_idx_mask;
+    PROTOBUF_ASSUME((idx & 7) == 0);
+    auto* fast_entry = table->fast_entry(idx >> 3);
+    data = fast_entry->bits;
+    data.data ^= coded_tag;
+    PROTOBUF_MUSTTAIL return fast_entry->target(PROTOBUF_TC_PARAM_PASS);
+  }
+
+  // We can only safely call from field to next field if the call is optimized
+  // to a proper tail call. Otherwise we blow through stack. Clang and gcc
+  // reliably do this optimization in opt mode, but do not perform this in debug
+  // mode. Luckily the structure of the algorithm is such that it's always
+  // possible to just return and use the enclosing parse loop as a trampoline.
+  static const char* ToTagDispatch(PROTOBUF_TC_PARAM_DECL) {
+    constexpr bool always_return = !PROTOBUF_TAILCALL;
+    if (always_return || !ctx->DataAvailable(ptr)) {
+      PROTOBUF_MUSTTAIL return ToParseLoop(PROTOBUF_TC_PARAM_PASS);
+    }
+    PROTOBUF_MUSTTAIL return TagDispatch(PROTOBUF_TC_PARAM_PASS);
+  }
+
+  static const char* ParseLoop(MessageLite* msg, const char* ptr,
+                               ParseContext* ctx,
+                               const TcParseTableBase* table) {
+    ScopedArenaSwap saved(msg, ctx);
+    const uint32_t has_bits_offset = table->has_bits_offset;
+    while (!ctx->Done(&ptr)) {
+      uint64_t hasbits = 0;
+      if (has_bits_offset) hasbits = RefAt<uint32_t>(msg, has_bits_offset);
+      ptr = TagDispatch(msg, ptr, ctx, table, hasbits, {});
+      if (ptr == nullptr) break;
+      if (ctx->LastTag() != 1) break;  // Ended on terminating tag
+    }
+    return ptr;
+  }
+
   template <typename FieldType, typename TagType>
   PROTOBUF_NOINLINE static const char* SingularParseMessage(
       PROTOBUF_TC_PARAM_DECL) {
@@ -146,12 +187,16 @@
   }
 
   template <typename LayoutType, typename TagType>
+  static const char* SingularFixed(PROTOBUF_TC_PARAM_DECL);
+  template <typename LayoutType, typename TagType>
   static const char* RepeatedFixed(PROTOBUF_TC_PARAM_DECL);
   template <typename LayoutType, typename TagType>
   static const char* PackedFixed(PROTOBUF_TC_PARAM_DECL);
 
   enum VarintDecode { kNoConversion = 0, kZigZag = 1 };
   template <typename FieldType, typename TagType, VarintDecode zigzag>
+  static const char* SingularVarint(PROTOBUF_TC_PARAM_DECL);
+  template <typename FieldType, typename TagType, VarintDecode zigzag>
   static const char* RepeatedVarint(PROTOBUF_TC_PARAM_DECL);
   template <typename FieldType, typename TagType, VarintDecode zigzag>
   static const char* PackedVarint(PROTOBUF_TC_PARAM_DECL);
@@ -175,7 +220,7 @@
   }
 
   static inline PROTOBUF_ALWAYS_INLINE void SyncHasbits(
-      MessageLite* msg, uint64_t hasbits, const TailCallParseTableBase* table) {
+      MessageLite* msg, uint64_t hasbits, const TcParseTableBase* table) {
     const uint32_t has_bits_offset = table->has_bits_offset;
     if (has_bits_offset) {
       // Only the first 32 has-bits are updated. Nothing above those is stored,
@@ -185,14 +230,19 @@
   }
 
  protected:
-  static inline PROTOBUF_ALWAYS_INLINE const char* Return(
+  static inline PROTOBUF_ALWAYS_INLINE const char* ToParseLoop(
       PROTOBUF_TC_PARAM_DECL) {
+    (void)data;
+    (void)ctx;
     SyncHasbits(msg, hasbits, table);
     return ptr;
   }
 
   static inline PROTOBUF_ALWAYS_INLINE const char* Error(
       PROTOBUF_TC_PARAM_DECL) {
+    (void)data;
+    (void)ctx;
+    (void)ptr;
     SyncHasbits(msg, hasbits, table);
     return nullptr;
   }
@@ -224,6 +274,7 @@
       ctx->SetLastTag(tag);
       return ptr;
     }
+    (void)data;
     uint32_t num = tag >> 3;
     if (table->extension_range_low <= num &&
         num <= table->extension_range_high) {
@@ -239,59 +290,6 @@
   }
 };
 
-// TcParser implements most of the parsing logic for tailcall tables.
-//
-// This is templated on lg2(table size), since dispatching depends upon the size
-// of the table. The template parameter avoids runtime overhead for computing
-// the table entry index.
-template <uint32_t kPowerOf2>
-struct TcParser final : TcParserBase {
-  // Dispatch to the designated parse function
-  inline PROTOBUF_ALWAYS_INLINE static const char* TagDispatch(
-      PROTOBUF_TC_PARAM_DECL) {
-    const auto coded_tag = UnalignedLoad<uint16_t>(ptr);
-    constexpr size_t kIdxMask = ((1 << (kPowerOf2)) - 1);
-    const size_t idx = (coded_tag >> 3) & kIdxMask;
-    data = table->table()[idx].bits;
-    data.data ^= coded_tag;
-    PROTOBUF_MUSTTAIL return table->table()[idx].target(PROTOBUF_TC_PARAM_PASS);
-  }
-
-  // We can only safely call from field to next field if the call is optimized
-  // to a proper tail call. Otherwise we blow through stack. Clang and gcc
-  // reliably do this optimization in opt mode, but do not perform this in debug
-  // mode. Luckily the structure of the algorithm is such that it's always
-  // possible to just return and use the enclosing parse loop as a trampoline.
-  static const char* TailCall(PROTOBUF_TC_PARAM_DECL) {
-    constexpr bool always_return = !PROTOBUF_TAILCALL;
-    if (always_return || !ctx->DataAvailable(ptr)) {
-      PROTOBUF_MUSTTAIL return Return(PROTOBUF_TC_PARAM_PASS);
-    }
-    PROTOBUF_MUSTTAIL return TagDispatch(PROTOBUF_TC_PARAM_PASS);
-  }
-
-  static const char* ParseLoop(MessageLite* msg, const char* ptr,
-                               ParseContext* ctx,
-                               const TailCallParseTableBase* table) {
-    ScopedArenaSwap saved(msg, ctx);
-    const uint32_t has_bits_offset = table->has_bits_offset;
-    while (!ctx->Done(&ptr)) {
-      uint64_t hasbits = 0;
-      if (has_bits_offset) hasbits = RefAt<uint32_t>(msg, has_bits_offset);
-      ptr = TagDispatch(msg, ptr, ctx, table, hasbits, {});
-      if (ptr == nullptr) break;
-      if (ctx->LastTag() != 1) break;  // Ended on terminating tag
-    }
-    return ptr;
-  }
-
-  template <typename LayoutType, typename TagType>
-  static const char* SingularFixed(PROTOBUF_TC_PARAM_DECL);
-
-  template <typename FieldType, typename TagType, VarintDecode zigzag>
-  static const char* SingularVarint(PROTOBUF_TC_PARAM_DECL);
-};
-
 // Declare helper functions:
 #include <google/protobuf/generated_message_tctable_impl.inc>
 
diff --git a/src/google/protobuf/generated_message_tctable_impl.inc b/src/google/protobuf/generated_message_tctable_impl.inc
index 8d38a51..a6831b5 100644
--- a/src/google/protobuf/generated_message_tctable_impl.inc
+++ b/src/google/protobuf/generated_message_tctable_impl.inc
@@ -34,120 +34,59 @@
 #else
 #define PROTOBUF_TCT_EXTERN extern
 #endif
-PROTOBUF_TCT_EXTERN template const char *TcParser<1>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*);
-PROTOBUF_TCT_EXTERN template const char *TcParser<2>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*);
-PROTOBUF_TCT_EXTERN template const char *TcParser<3>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*);
-PROTOBUF_TCT_EXTERN template const char *TcParser<4>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*);
-PROTOBUF_TCT_EXTERN template const char *TcParser<5>::ParseLoop(::PROTOBUF_NAMESPACE_ID::MessageLite*, char const*, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext*, ::PROTOBUF_NAMESPACE_ID::internal::TailCallParseTableBase const*);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kZigZag>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<1>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<2>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<3>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<4>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParser<5>::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::PackedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
-PROTOBUF_TCT_EXTERN template const char* TcParserBase::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParserBase::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedFixed<uint64_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedFixed<uint32_t, uint8_t>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<uint64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<uint32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<int64_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<int32_t, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<bool, uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedString<uint8_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedFixed<uint64_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedFixed<uint32_t, uint16_t>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<uint64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<uint32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<int64_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<int32_t, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kZigZag>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::PackedVarint<bool, uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoConversion>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kNoUtf8>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::SingularString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
+PROTOBUF_TCT_EXTERN template const char* TcParser::RepeatedString<uint16_t, ::PROTOBUF_NAMESPACE_ID::internal::TcParser::kUtf8ValidateOnly>(PROTOBUF_TC_PARAM_DECL);
 #undef PROTOBUF_TCT_EXTERN
 // clang-format on
diff --git a/src/google/protobuf/generated_message_tctable_lite.cc b/src/google/protobuf/generated_message_tctable_lite.cc
index 231ad46..4350929 100644
--- a/src/google/protobuf/generated_message_tctable_lite.cc
+++ b/src/google/protobuf/generated_message_tctable_lite.cc
@@ -50,7 +50,7 @@
 template void AlignFail<8>(uintptr_t);
 #endif
 
-const char* TcParserBase::GenericFallbackLite(PROTOBUF_TC_PARAM_DECL) {
+const char* TcParser::GenericFallbackLite(PROTOBUF_TC_PARAM_DECL) {
   return GenericFallbackImpl<MessageLite, std::string>(PROTOBUF_TC_PARAM_PASS);
 }
 
@@ -75,9 +75,8 @@
 // Fixed fields
 //////////////////////////////////////////////////////////////////////////////
 
-template <uint32_t kPowerOf2>
 template <typename LayoutType, typename TagType>
-const char* TcParser<kPowerOf2>::SingularFixed(PROTOBUF_TC_PARAM_DECL) {
+const char* TcParser::SingularFixed(PROTOBUF_TC_PARAM_DECL) {
   if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) {
     return table->fallback(PROTOBUF_TC_PARAM_PASS);
   }
@@ -85,12 +84,11 @@
   hasbits |= (uint64_t{1} << data.hasbit_idx());
   std::memcpy(Offset(msg, data.offset()), ptr, sizeof(LayoutType));
   ptr += sizeof(LayoutType);
-  // TailCall syncs any pending hasbits:
-  PROTOBUF_MUSTTAIL return TailCall(PROTOBUF_TC_PARAM_PASS);
+  PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_PASS);
 }
 
 template <typename LayoutType, typename TagType>
-const char* TcParserBase::RepeatedFixed(PROTOBUF_TC_PARAM_DECL) {
+const char* TcParser::RepeatedFixed(PROTOBUF_TC_PARAM_DECL) {
   if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) {
     // Check if the field can be parsed as packed repeated:
     constexpr WireFormatLite::WireType fallback_wt =
@@ -117,11 +115,11 @@
     if (!ctx->DataAvailable(ptr)) break;
   } while (UnalignedLoad<TagType>(ptr) == expected_tag);
   field.AddNAlreadyReserved(idx - 1);
-  return Return(PROTOBUF_TC_PARAM_PASS);
+  return ToParseLoop(PROTOBUF_TC_PARAM_PASS);
 }
 
 template <typename LayoutType, typename TagType>
-const char* TcParserBase::PackedFixed(PROTOBUF_TC_PARAM_DECL) {
+const char* TcParser::PackedFixed(PROTOBUF_TC_PARAM_DECL) {
   if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) {
     // Try parsing as non-packed repeated:
     constexpr WireFormatLite::WireType fallback_wt =
@@ -278,30 +276,28 @@
   }
 }
 
-template <typename FieldType, TcParserBase::VarintDecode =
-                                  TcParserBase::VarintDecode::kNoConversion>
+template <typename FieldType,
+          TcParser::VarintDecode = TcParser::VarintDecode::kNoConversion>
 FieldType ZigZagDecodeHelper(uint64_t value) {
   return static_cast<FieldType>(value);
 }
 
 template <>
-int32_t ZigZagDecodeHelper<int32_t, TcParserBase::VarintDecode::kZigZag>(
+int32_t ZigZagDecodeHelper<int32_t, TcParser::VarintDecode::kZigZag>(
     uint64_t value) {
   return WireFormatLite::ZigZagDecode32(value);
 }
 
 template <>
-int64_t ZigZagDecodeHelper<int64_t, TcParserBase::VarintDecode::kZigZag>(
+int64_t ZigZagDecodeHelper<int64_t, TcParser::VarintDecode::kZigZag>(
     uint64_t value) {
   return WireFormatLite::ZigZagDecode64(value);
 }
 
 }  // namespace
 
-template <uint32_t kPowerOf2>
-template <typename FieldType, typename TagType,
-          TcParserBase::VarintDecode zigzag>
-const char* TcParser<kPowerOf2>::SingularVarint(PROTOBUF_TC_PARAM_DECL) {
+template <typename FieldType, typename TagType, TcParser::VarintDecode zigzag>
+const char* TcParser::SingularVarint(PROTOBUF_TC_PARAM_DECL) {
   if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) {
     return table->fallback(PROTOBUF_TC_PARAM_PASS);
   }
@@ -314,13 +310,11 @@
   }
   RefAt<FieldType>(msg, data.offset()) =
       ZigZagDecodeHelper<FieldType, zigzag>(tmp);
-  PROTOBUF_MUSTTAIL return TailCall(PROTOBUF_TC_PARAM_PASS);
+  PROTOBUF_MUSTTAIL return ToTagDispatch(PROTOBUF_TC_PARAM_PASS);
 }
 
-template <typename FieldType, typename TagType,
-          TcParserBase::VarintDecode zigzag>
-PROTOBUF_NOINLINE const char* TcParserBase::RepeatedVarint(
-    PROTOBUF_TC_PARAM_DECL) {
+template <typename FieldType, typename TagType, TcParser::VarintDecode zigzag>
+PROTOBUF_NOINLINE const char* TcParser::RepeatedVarint(PROTOBUF_TC_PARAM_DECL) {
   if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) {
     // Try parsing as non-packed repeated:
     InvertPacked<WireFormatLite::WIRETYPE_VARINT>(data);
@@ -344,13 +338,11 @@
       break;
     }
   } while (UnalignedLoad<TagType>(ptr) == expected_tag);
-  return Return(PROTOBUF_TC_PARAM_PASS);
+  return ToParseLoop(PROTOBUF_TC_PARAM_PASS);
 }
 
-template <typename FieldType, typename TagType,
-          TcParserBase::VarintDecode zigzag>
-PROTOBUF_NOINLINE const char* TcParserBase::PackedVarint(
-    PROTOBUF_TC_PARAM_DECL) {
+template <typename FieldType, typename TagType, TcParser::VarintDecode zigzag>
+PROTOBUF_NOINLINE const char* TcParser::PackedVarint(PROTOBUF_TC_PARAM_DECL) {
   if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) {
     InvertPacked<WireFormatLite::WIRETYPE_VARINT>(data);
     if (data.coded_tag<TagType>() == 0) {
@@ -400,8 +392,8 @@
 
 }  // namespace
 
-template <typename TagType, TcParserBase::Utf8Type utf8>
-const char* TcParserBase::SingularString(PROTOBUF_TC_PARAM_DECL) {
+template <typename TagType, TcParser::Utf8Type utf8>
+const char* TcParser::SingularString(PROTOBUF_TC_PARAM_DECL) {
   if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) {
     return table->fallback(PROTOBUF_TC_PARAM_PASS);
   }
@@ -420,19 +412,19 @@
 #ifdef NDEBUG
     case kUtf8ValidateOnly:
 #endif
-      return Return(PROTOBUF_TC_PARAM_PASS);
+      return ToParseLoop(PROTOBUF_TC_PARAM_PASS);
     default:
       if (PROTOBUF_PREDICT_TRUE(IsStructurallyValidUTF8(field.Get()))) {
-        return Return(PROTOBUF_TC_PARAM_PASS);
+        return ToParseLoop(PROTOBUF_TC_PARAM_PASS);
       }
       PrintUTF8ErrorLog("unknown", "parsing", false);
       return utf8 == kUtf8 ? Error(PROTOBUF_TC_PARAM_PASS)
-                           : Return(PROTOBUF_TC_PARAM_PASS);
+                           : ToParseLoop(PROTOBUF_TC_PARAM_PASS);
   }
 }
 
-template <typename TagType, TcParserBase::Utf8Type utf8>
-const char* TcParserBase::RepeatedString(PROTOBUF_TC_PARAM_DECL) {
+template <typename TagType, TcParser::Utf8Type utf8>
+const char* TcParser::RepeatedString(PROTOBUF_TC_PARAM_DECL) {
   if (PROTOBUF_PREDICT_FALSE(data.coded_tag<TagType>() != 0)) {
     return table->fallback(PROTOBUF_TC_PARAM_PASS);
   }
@@ -453,7 +445,7 @@
     }
     if (!ctx->DataAvailable(ptr)) break;
   } while (UnalignedLoad<TagType>(ptr) == expected_tag);
-  return Return(PROTOBUF_TC_PARAM_PASS);
+  return ToParseLoop(PROTOBUF_TC_PARAM_PASS);
 }
 
 #define PROTOBUF_TCT_SOURCE
diff --git a/src/google/protobuf/generated_message_util.cc b/src/google/protobuf/generated_message_util.cc
index cbe771e..32a57d3 100644
--- a/src/google/protobuf/generated_message_util.cc
+++ b/src/google/protobuf/generated_message_util.cc
@@ -316,7 +316,7 @@
 // Helper to branch to fast path if possible
 void SerializeMessageDispatch(const MessageLite& msg,
                               const FieldMetadata* field_table, int num_fields,
-                              int32_t cached_size,
+                              int32_t /*cached_size*/,
                               io::CodedOutputStream* output) {
   const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg);
   SerializeInternal(base, field_table, num_fields, output);
@@ -325,7 +325,7 @@
 // Helper to branch to fast path if possible
 void SerializeMessageDispatch(const MessageLite& msg,
                               const FieldMetadata* field_table, int num_fields,
-                              int32_t cached_size, ArrayOutput* output) {
+                              int32_t /*cached_size*/, ArrayOutput* output) {
   const uint8_t* base = reinterpret_cast<const uint8_t*>(&msg);
   output->ptr = SerializeInternalToArray(base, field_table, num_fields,
                                          output->is_deterministic, output->ptr);
@@ -523,7 +523,8 @@
 template <>
 struct PackedFieldHelper<WireFormatLite::TYPE_STRING> {
   template <typename O>
-  static void Serialize(const void* field, const FieldMetadata& md, O* output) {
+  static void Serialize(const void* /*field*/, const FieldMetadata& md,
+                        O* /*output*/) {
     GOOGLE_LOG(FATAL) << "Not implemented field number " << md.tag << " with type "
                << md.type;
   }
@@ -591,12 +592,12 @@
 
 template <>
 bool IsNull<WireFormatLite::TYPE_GROUP>(const void* ptr) {
-  return Get<const MessageLite*>(ptr) == NULL;
+  return Get<const MessageLite*>(ptr) == nullptr;
 }
 
 template <>
 bool IsNull<WireFormatLite::TYPE_MESSAGE>(const void* ptr) {
-  return Get<const MessageLite*>(ptr) == NULL;
+  return Get<const MessageLite*>(ptr) == nullptr;
 }
 
 
@@ -701,13 +702,13 @@
       // Special cases
       case FieldMetadata::kSpecial: {
         io::ArrayOutputStream array_stream(array_output.ptr, INT_MAX);
-        io::CodedOutputStream output(&array_stream);
-        output.SetSerializationDeterministic(is_deterministic);
+        io::CodedOutputStream output_stream(&array_stream);
+        output_stream.SetSerializationDeterministic(is_deterministic);
         func = reinterpret_cast<SpecialSerializer>(
             const_cast<void*>(field_metadata.ptr));
         func(base, field_metadata.offset, field_metadata.tag,
-             field_metadata.has_offset, &output);
-        array_output.ptr += output.ByteCount();
+             field_metadata.has_offset, &output_stream);
+        array_output.ptr += output_stream.ByteCount();
       } break;
       default:
         // __builtin_unreachable()
@@ -726,7 +727,7 @@
 }
 
 void UnknownFieldSerializerLite(const uint8_t* ptr, uint32_t offset,
-                                uint32_t tag, uint32_t has_offset,
+                                uint32_t /*tag*/, uint32_t /*has_offset*/,
                                 io::CodedOutputStream* output) {
   output->WriteString(
       reinterpret_cast<const InternalMetadata*>(ptr + offset)
@@ -739,7 +740,7 @@
     ret->CheckTypeAndMergeFrom(*message);
     return ret;
   } else {
-    return NULL;
+    return nullptr;
   }
 }
 
@@ -761,7 +762,7 @@
          submessage_arena);
   GOOGLE_DCHECK(message_arena != submessage_arena);
   GOOGLE_DCHECK_EQ(submessage_arena, nullptr);
-  if (message_arena != NULL && submessage_arena == NULL) {
+  if (message_arena != nullptr && submessage_arena == nullptr) {
     message_arena->Own(submessage);
     return submessage;
   } else {
diff --git a/src/google/protobuf/implicit_weak_message.h b/src/google/protobuf/implicit_weak_message.h
index 561e472..5db8b9c 100644
--- a/src/google/protobuf/implicit_weak_message.h
+++ b/src/google/protobuf/implicit_weak_message.h
@@ -63,7 +63,6 @@
 
   std::string GetTypeName() const override { return ""; }
 
-  MessageLite* New() const override { return new ImplicitWeakMessage; }
   MessageLite* New(Arena* arena) const override {
     return Arena::CreateMessage<ImplicitWeakMessage>(arena);
   }
@@ -103,21 +102,18 @@
   static constexpr bool Moveable = false;
 
   static inline MessageLite* NewFromPrototype(const MessageLite* prototype,
-                                              Arena* arena = NULL) {
+                                              Arena* arena = nullptr) {
     return prototype->New(arena);
   }
 
   static inline void Delete(MessageLite* value, Arena* arena) {
-    if (arena == NULL) {
+    if (arena == nullptr) {
       delete value;
     }
   }
   static inline Arena* GetArena(MessageLite* value) {
     return value->GetArena();
   }
-  static inline void* GetMaybeArenaPointer(MessageLite* value) {
-    return value->GetArena();
-  }
   static inline void Clear(MessageLite* value) { value->Clear(); }
   static void Merge(const MessageLite& from, MessageLite* to) {
     to->CheckTypeAndMergeFrom(from);
diff --git a/src/google/protobuf/inlined_string_field.h b/src/google/protobuf/inlined_string_field.h
index 17373f5..1fe639f 100644
--- a/src/google/protobuf/inlined_string_field.h
+++ b/src/google/protobuf/inlined_string_field.h
@@ -199,12 +199,12 @@
                        uint32_t* donating_states, uint32_t mask);
 
   // Release returns a std::string* instance that is heap-allocated and is not
-  // Own()'d by any arena. If the field is not set, this returns NULL. The
-  // caller retains ownership. Clears this field back to NULL state. Used to
+  // Own()'d by any arena. If the field is not set, this returns nullptr. The
+  // caller retains ownership. Clears this field back to nullptr state. Used to
   // implement release_<field>() methods on generated classes.
-  PROTOBUF_MUST_USE_RESULT std::string* Release(
-      const std::string* default_value, Arena* arena, bool donated);
-  PROTOBUF_MUST_USE_RESULT std::string* ReleaseNonDefault(
+  PROTOBUF_NODISCARD std::string* Release(const std::string* default_value,
+                                          Arena* arena, bool donated);
+  PROTOBUF_NODISCARD std::string* ReleaseNonDefault(
       const std::string* default_value, Arena* arena);
   std::string* ReleaseNonDefaultNoArena(const std::string* default_value);
 
@@ -248,9 +248,9 @@
     get_mutable()->clear();
   }
 
-  // Clears content, but keeps allocated std::string if arena != NULL, to avoid
-  // the overhead of heap operations. After this returns, the content (as seen
-  // by the user) will always be equal to |default_value|.
+  // Clears content, but keeps allocated std::string if arena != nullptr, to
+  // avoid the overhead of heap operations. After this returns, the content (as
+  // seen by the user) will always be equal to |default_value|.
   void ClearToDefault(const LazyString& default_value, Arena* arena,
                       bool donated);
 
diff --git a/src/google/protobuf/io/coded_stream.cc b/src/google/protobuf/io/coded_stream.cc
index 1b80068..20977b7 100644
--- a/src/google/protobuf/io/coded_stream.cc
+++ b/src/google/protobuf/io/coded_stream.cc
@@ -946,7 +946,7 @@
 
 uint8_t* CodedOutputStream::WriteStringWithSizeToArray(const std::string& str,
                                                      uint8_t* target) {
-  GOOGLE_DCHECK_LE(str.size(), kuint32max);
+  GOOGLE_DCHECK_LE(str.size(), std::numeric_limits<uint32_t>::max());
   target = WriteVarint32ToArray(str.size(), target);
   return WriteStringToArray(str, target);
 }
diff --git a/src/google/protobuf/io/coded_stream.h b/src/google/protobuf/io/coded_stream.h
index 40896e7..45963ef 100644
--- a/src/google/protobuf/io/coded_stream.h
+++ b/src/google/protobuf/io/coded_stream.h
@@ -116,6 +116,7 @@
 #include <climits>
 #include <cstddef>
 #include <cstring>
+#include <limits>
 #include <string>
 #include <type_traits>
 #include <utility>
@@ -135,6 +136,10 @@
 #include <machine/endian.h>  // __BYTE_ORDER
 #elif defined(__FreeBSD__)
 #include <sys/endian.h>  // __BYTE_ORDER
+#elif (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))
+#include <sys/isa_defs.h>  // __BYTE_ORDER
+#elif defined(_AIX) || defined(__TOS_AIX__)
+#include <sys/machine.h>  // BYTE_ORDER
 #else
 #if !defined(__QNX__)
 #include <endian.h>  // __BYTE_ORDER
@@ -241,10 +246,10 @@
   // responsible for ensuring that the buffer has sufficient space.
   // Read a 32-bit little-endian integer.
   static const uint8_t* ReadLittleEndian32FromArray(const uint8_t* buffer,
-                                                  uint32_t* value);
+                                                    uint32_t* value);
   // Read a 64-bit little-endian integer.
   static const uint8_t* ReadLittleEndian64FromArray(const uint8_t* buffer,
-                                                  uint64_t* value);
+                                                    uint64_t* value);
 
   // Read an unsigned integer with Varint encoding, truncating to 32 bits.
   // Reading a 32-bit value is equivalent to reading a 64-bit one and casting
@@ -314,7 +319,7 @@
   // was not.
   PROTOBUF_ALWAYS_INLINE
   static const uint8_t* ExpectTagFromArray(const uint8_t* buffer,
-                                         uint32_t expected);
+                                           uint32_t expected);
 
   // Usually returns true if no more bytes can be read.  Always returns false
   // if more bytes can be read.  If ExpectAtEnd() returns true, a subsequent
@@ -687,7 +692,7 @@
   // After this it's guaranteed you can safely write kSlopBytes to ptr. This
   // will never fail! The underlying stream can produce an error. Use HadError
   // to check for errors.
-  PROTOBUF_MUST_USE_RESULT uint8_t* EnsureSpace(uint8_t* ptr) {
+  PROTOBUF_NODISCARD uint8_t* EnsureSpace(uint8_t* ptr) {
     if (PROTOBUF_PREDICT_FALSE(ptr >= end_)) {
       return EnsureSpaceFallback(ptr);
     }
@@ -705,6 +710,9 @@
   // aliasing the buffer (ie. not copying the data). The caller is responsible
   // to make sure the buffer is alive for the duration of the
   // ZeroCopyOutputStream.
+#ifndef NDEBUG
+  PROTOBUF_NOINLINE
+#endif
   uint8_t* WriteRawMaybeAliased(const void* data, int size, uint8_t* ptr) {
     if (aliasing_enabled_) {
       return WriteAliasedRaw(data, size, ptr);
@@ -714,7 +722,11 @@
   }
 
 
-  uint8_t* WriteStringMaybeAliased(uint32_t num, const std::string& s, uint8_t* ptr) {
+#ifndef NDEBUG
+  PROTOBUF_NOINLINE
+#endif
+  uint8_t* WriteStringMaybeAliased(uint32_t num, const std::string& s,
+                                   uint8_t* ptr) {
     std::ptrdiff_t size = s.size();
     if (PROTOBUF_PREDICT_FALSE(
             size >= 128 || end_ - ptr + 16 - TagSize(num << 3) - 1 < size)) {
@@ -725,13 +737,14 @@
     std::memcpy(ptr, s.data(), size);
     return ptr + size;
   }
-  uint8_t* WriteBytesMaybeAliased(uint32_t num, const std::string& s, uint8_t* ptr) {
+  uint8_t* WriteBytesMaybeAliased(uint32_t num, const std::string& s,
+                                  uint8_t* ptr) {
     return WriteStringMaybeAliased(num, s, ptr);
   }
 
   template <typename T>
   PROTOBUF_ALWAYS_INLINE uint8_t* WriteString(uint32_t num, const T& s,
-                                            uint8_t* ptr) {
+                                              uint8_t* ptr) {
     std::ptrdiff_t size = s.size();
     if (PROTOBUF_PREDICT_FALSE(
             size >= 128 || end_ - ptr + 16 - TagSize(num << 3) - 1 < size)) {
@@ -743,49 +756,52 @@
     return ptr + size;
   }
   template <typename T>
+#ifndef NDEBUG
+  PROTOBUF_NOINLINE
+#endif
   uint8_t* WriteBytes(uint32_t num, const T& s, uint8_t* ptr) {
     return WriteString(num, s, ptr);
   }
 
   template <typename T>
-  PROTOBUF_ALWAYS_INLINE uint8_t* WriteInt32Packed(int num, const T& r, int size,
-                                                 uint8_t* ptr) {
+  PROTOBUF_ALWAYS_INLINE uint8_t* WriteInt32Packed(int num, const T& r,
+                                                   int size, uint8_t* ptr) {
     return WriteVarintPacked(num, r, size, ptr, Encode64);
   }
   template <typename T>
-  PROTOBUF_ALWAYS_INLINE uint8_t* WriteUInt32Packed(int num, const T& r, int size,
-                                                  uint8_t* ptr) {
+  PROTOBUF_ALWAYS_INLINE uint8_t* WriteUInt32Packed(int num, const T& r,
+                                                    int size, uint8_t* ptr) {
     return WriteVarintPacked(num, r, size, ptr, Encode32);
   }
   template <typename T>
-  PROTOBUF_ALWAYS_INLINE uint8_t* WriteSInt32Packed(int num, const T& r, int size,
-                                                  uint8_t* ptr) {
+  PROTOBUF_ALWAYS_INLINE uint8_t* WriteSInt32Packed(int num, const T& r,
+                                                    int size, uint8_t* ptr) {
     return WriteVarintPacked(num, r, size, ptr, ZigZagEncode32);
   }
   template <typename T>
-  PROTOBUF_ALWAYS_INLINE uint8_t* WriteInt64Packed(int num, const T& r, int size,
-                                                 uint8_t* ptr) {
+  PROTOBUF_ALWAYS_INLINE uint8_t* WriteInt64Packed(int num, const T& r,
+                                                   int size, uint8_t* ptr) {
     return WriteVarintPacked(num, r, size, ptr, Encode64);
   }
   template <typename T>
-  PROTOBUF_ALWAYS_INLINE uint8_t* WriteUInt64Packed(int num, const T& r, int size,
-                                                  uint8_t* ptr) {
+  PROTOBUF_ALWAYS_INLINE uint8_t* WriteUInt64Packed(int num, const T& r,
+                                                    int size, uint8_t* ptr) {
     return WriteVarintPacked(num, r, size, ptr, Encode64);
   }
   template <typename T>
-  PROTOBUF_ALWAYS_INLINE uint8_t* WriteSInt64Packed(int num, const T& r, int size,
-                                                  uint8_t* ptr) {
+  PROTOBUF_ALWAYS_INLINE uint8_t* WriteSInt64Packed(int num, const T& r,
+                                                    int size, uint8_t* ptr) {
     return WriteVarintPacked(num, r, size, ptr, ZigZagEncode64);
   }
   template <typename T>
   PROTOBUF_ALWAYS_INLINE uint8_t* WriteEnumPacked(int num, const T& r, int size,
-                                                uint8_t* ptr) {
+                                                  uint8_t* ptr) {
     return WriteVarintPacked(num, r, size, ptr, Encode64);
   }
 
   template <typename T>
   PROTOBUF_ALWAYS_INLINE uint8_t* WriteFixedPacked(int num, const T& r,
-                                                 uint8_t* ptr) {
+                                                   uint8_t* ptr) {
     ptr = EnsureSpace(ptr);
     constexpr auto element_size = sizeof(typename T::value_type);
     auto size = r.size() * element_size;
@@ -856,13 +872,14 @@
                                : 5;
   }
 
-  PROTOBUF_ALWAYS_INLINE uint8_t* WriteTag(uint32_t num, uint32_t wt, uint8_t* ptr) {
+  PROTOBUF_ALWAYS_INLINE uint8_t* WriteTag(uint32_t num, uint32_t wt,
+                                           uint8_t* ptr) {
     GOOGLE_DCHECK(ptr < end_);  // NOLINT
     return UnsafeVarint((num << 3) | wt, ptr);
   }
 
   PROTOBUF_ALWAYS_INLINE uint8_t* WriteLengthDelim(int num, uint32_t size,
-                                                 uint8_t* ptr) {
+                                                   uint8_t* ptr) {
     ptr = WriteTag(num, 2, ptr);
     return UnsafeWriteSize(size, ptr);
   }
@@ -872,12 +889,13 @@
   uint8_t* WriteAliasedRaw(const void* data, int size, uint8_t* ptr);
 
   uint8_t* WriteStringMaybeAliasedOutline(uint32_t num, const std::string& s,
-                                        uint8_t* ptr);
+                                          uint8_t* ptr);
   uint8_t* WriteStringOutline(uint32_t num, const std::string& s, uint8_t* ptr);
 
   template <typename T, typename E>
-  PROTOBUF_ALWAYS_INLINE uint8_t* WriteVarintPacked(int num, const T& r, int size,
-                                                  uint8_t* ptr, const E& encode) {
+  PROTOBUF_ALWAYS_INLINE uint8_t* WriteVarintPacked(int num, const T& r,
+                                                    int size, uint8_t* ptr,
+                                                    const E& encode) {
     ptr = EnsureSpace(ptr);
     ptr = WriteLengthDelim(num, size, ptr);
     auto it = r.data();
@@ -925,7 +943,7 @@
   }
 
   PROTOBUF_ALWAYS_INLINE static uint8_t* UnsafeWriteSize(uint32_t value,
-                                                       uint8_t* ptr) {
+                                                         uint8_t* ptr) {
     while (PROTOBUF_PREDICT_FALSE(value >= 0x80)) {
       *ptr = static_cast<uint8_t>(value | 0x80);
       value >>= 7;
@@ -976,14 +994,14 @@
 
 template <>
 inline uint8_t* EpsCopyOutputStream::WriteRawLittleEndian<1>(const void* data,
-                                                           int size,
-                                                           uint8_t* ptr) {
+                                                             int size,
+                                                             uint8_t* ptr) {
   return WriteRaw(data, size, ptr);
 }
 template <>
 inline uint8_t* EpsCopyOutputStream::WriteRawLittleEndian<4>(const void* data,
-                                                           int size,
-                                                           uint8_t* ptr) {
+                                                             int size,
+                                                             uint8_t* ptr) {
 #ifdef PROTOBUF_LITTLE_ENDIAN
   return WriteRaw(data, size, ptr);
 #else
@@ -992,8 +1010,8 @@
 }
 template <>
 inline uint8_t* EpsCopyOutputStream::WriteRawLittleEndian<8>(const void* data,
-                                                           int size,
-                                                           uint8_t* ptr) {
+                                                             int size,
+                                                             uint8_t* ptr) {
 #ifdef PROTOBUF_LITTLE_ENDIAN
   return WriteRaw(data, size, ptr);
 #else
@@ -1117,7 +1135,8 @@
   // copy loops. Since this gets called by every field with string or bytes
   // type, inlining may lead to a significant amount of code bloat, with only a
   // minor performance gain.
-  static uint8_t* WriteRawToArray(const void* buffer, int size, uint8_t* target);
+  static uint8_t* WriteRawToArray(const void* buffer, int size,
+                                  uint8_t* target);
 
   // Equivalent to WriteRaw(str.data(), str.size()).
   void WriteString(const std::string& str);
@@ -1125,7 +1144,7 @@
   static uint8_t* WriteStringToArray(const std::string& str, uint8_t* target);
   // Write the varint-encoded size of str followed by str.
   static uint8_t* WriteStringWithSizeToArray(const std::string& str,
-                                           uint8_t* target);
+                                             uint8_t* target);
 
 
   // Write a 32-bit little-endian integer.
@@ -1149,9 +1168,10 @@
   void WriteVarint32(uint32_t value);
   // Like WriteVarint32()  but writing directly to the target array.
   static uint8_t* WriteVarint32ToArray(uint32_t value, uint8_t* target);
-  // Like WriteVarint32()  but writing directly to the target array, and with the
-  // less common-case paths being out of line rather than inlined.
-  static uint8_t* WriteVarint32ToArrayOutOfLine(uint32_t value, uint8_t* target);
+  // Like WriteVarint32()  but writing directly to the target array, and with
+  // the less common-case paths being out of line rather than inlined.
+  static uint8_t* WriteVarint32ToArrayOutOfLine(uint32_t value,
+                                                uint8_t* target);
   // Write an unsigned integer with Varint encoding.
   void WriteVarint64(uint64_t value);
   // Like WriteVarint64()  but writing directly to the target array.
@@ -1161,7 +1181,8 @@
   // in which case it must be sign-extended to a full 10 bytes.
   void WriteVarint32SignExtended(int32_t value);
   // Like WriteVarint32SignExtended()  but writing directly to the target array.
-  static uint8_t* WriteVarint32SignExtendedToArray(int32_t value, uint8_t* target);
+  static uint8_t* WriteVarint32SignExtendedToArray(int32_t value,
+                                                   uint8_t* target);
 
   // This is identical to WriteVarint32(), but optimized for writing tags.
   // In particular, if the input is a compile-time constant, this method
@@ -1272,7 +1293,8 @@
     default_serialization_deterministic_.store(true, std::memory_order_relaxed);
   }
   // REQUIRES: value >= 0x80, and that (value & 7f) has been written to *target.
-  static uint8_t* WriteVarint32ToArrayOutOfLineHelper(uint32_t value, uint8_t* target);
+  static uint8_t* WriteVarint32ToArrayOutOfLineHelper(uint32_t value,
+                                                      uint8_t* target);
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(CodedOutputStream);
 };
 
@@ -1341,13 +1363,13 @@
   return buffer + sizeof(*value);
 #else
   uint32_t part0 = (static_cast<uint32_t>(buffer[0])) |
-                 (static_cast<uint32_t>(buffer[1]) << 8) |
-                 (static_cast<uint32_t>(buffer[2]) << 16) |
-                 (static_cast<uint32_t>(buffer[3]) << 24);
+                   (static_cast<uint32_t>(buffer[1]) << 8) |
+                   (static_cast<uint32_t>(buffer[2]) << 16) |
+                   (static_cast<uint32_t>(buffer[3]) << 24);
   uint32_t part1 = (static_cast<uint32_t>(buffer[4])) |
-                 (static_cast<uint32_t>(buffer[5]) << 8) |
-                 (static_cast<uint32_t>(buffer[6]) << 16) |
-                 (static_cast<uint32_t>(buffer[7]) << 24);
+                   (static_cast<uint32_t>(buffer[5]) << 8) |
+                   (static_cast<uint32_t>(buffer[6]) << 16) |
+                   (static_cast<uint32_t>(buffer[7]) << 24);
   *value = static_cast<uint64_t>(part0) | (static_cast<uint64_t>(part1) << 32);
   return buffer + sizeof(*value);
 #endif
@@ -1464,8 +1486,8 @@
   }
 }
 
-inline const uint8_t* CodedInputStream::ExpectTagFromArray(const uint8_t* buffer,
-                                                         uint32_t expected) {
+inline const uint8_t* CodedInputStream::ExpectTagFromArray(
+    const uint8_t* buffer, uint32_t expected) {
   if (expected < (1 << 7)) {
     if (buffer[0] == expected) {
       return buffer + 1;
@@ -1551,7 +1573,7 @@
       last_tag_(0),
       legitimate_message_end_(false),
       aliasing_enabled_(false),
-      current_limit_(kint32max),
+      current_limit_(std::numeric_limits<int32_t>::max()),
       buffer_size_after_limit_(0),
       total_bytes_limit_(kDefaultTotalBytesLimit),
       recursion_budget_(default_recursion_limit_),
@@ -1599,7 +1621,7 @@
 }
 
 inline uint8_t* CodedOutputStream::WriteVarint32ToArray(uint32_t value,
-                                                      uint8_t* target) {
+                                                        uint8_t* target) {
   return EpsCopyOutputStream::UnsafeVarint(value, target);
 }
 
@@ -1614,7 +1636,7 @@
 }
 
 inline uint8_t* CodedOutputStream::WriteVarint64ToArray(uint64_t value,
-                                                      uint8_t* target) {
+                                                        uint8_t* target) {
   return EpsCopyOutputStream::UnsafeVarint(value, target);
 }
 
@@ -1628,7 +1650,7 @@
 }
 
 inline uint8_t* CodedOutputStream::WriteLittleEndian32ToArray(uint32_t value,
-                                                            uint8_t* target) {
+                                                              uint8_t* target) {
 #if defined(PROTOBUF_LITTLE_ENDIAN)
   memcpy(target, &value, sizeof(value));
 #else
@@ -1641,7 +1663,7 @@
 }
 
 inline uint8_t* CodedOutputStream::WriteLittleEndian64ToArray(uint64_t value,
-                                                            uint8_t* target) {
+                                                              uint8_t* target) {
 #if defined(PROTOBUF_LITTLE_ENDIAN)
   memcpy(target, &value, sizeof(value));
 #else
@@ -1715,7 +1737,8 @@
   return VarintSize64(static_cast<uint64_t>(int64_t{value}));
 }
 
-inline size_t CodedOutputStream::VarintSize32SignExtendedPlusOne(int32_t value) {
+inline size_t CodedOutputStream::VarintSize32SignExtendedPlusOne(
+    int32_t value) {
   return VarintSize64PlusOne(static_cast<uint64_t>(int64_t{value}));
 }
 
@@ -1729,13 +1752,13 @@
 }
 
 inline uint8_t* CodedOutputStream::WriteRawToArray(const void* data, int size,
-                                                 uint8_t* target) {
+                                                   uint8_t* target) {
   memcpy(target, data, size);
   return target + size;
 }
 
 inline uint8_t* CodedOutputStream::WriteStringToArray(const std::string& str,
-                                                    uint8_t* target) {
+                                                      uint8_t* target) {
   return WriteRawToArray(str.data(), static_cast<int>(str.size()), target);
 }
 
diff --git a/src/google/protobuf/io/io_win32.cc b/src/google/protobuf/io/io_win32.cc
index d22ceac..ed8ab19 100644
--- a/src/google/protobuf/io/io_win32.cc
+++ b/src/google/protobuf/io/io_win32.cc
@@ -266,7 +266,7 @@
 #endif
 }
 
-int mkdir(const char* path, int _mode) {
+int mkdir(const char* path, int /*_mode*/) {
 #ifdef SUPPORT_LONGPATHS
   wstring wpath;
   if (!as_windows_path(path, &wpath)) {
diff --git a/src/google/protobuf/io/printer.h b/src/google/protobuf/io/printer.h
index d4051e2..e857cf0 100644
--- a/src/google/protobuf/io/printer.h
+++ b/src/google/protobuf/io/printer.h
@@ -82,9 +82,9 @@
       : annotation_proto_(annotation_proto) {}
 
   // Override for AnnotationCollector::AddAnnotation.
-  virtual void AddAnnotation(size_t begin_offset, size_t end_offset,
-                             const std::string& file_path,
-                             const std::vector<int>& path) override {
+  void AddAnnotation(size_t begin_offset, size_t end_offset,
+                     const std::string& file_path,
+                     const std::vector<int>& path) override {
     typename AnnotationProto::Annotation* annotation =
         annotation_proto_->add_annotation();
     for (int i = 0; i < path.size(); ++i) {
@@ -95,7 +95,7 @@
     annotation->set_end(end_offset);
   }
   // Override for AnnotationCollector::AddAnnotation.
-  virtual void AddAnnotationNew(Annotation& a) override {
+  void AddAnnotationNew(Annotation& a) override {
     auto* annotation = annotation_proto_->add_annotation();
     annotation->ParseFromString(a.second);
     annotation->set_begin(a.first.first);
diff --git a/src/google/protobuf/io/tokenizer.cc b/src/google/protobuf/io/tokenizer.cc
index 6a48673..d6456bc 100644
--- a/src/google/protobuf/io/tokenizer.cc
+++ b/src/google/protobuf/io/tokenizer.cc
@@ -224,6 +224,21 @@
   }
 }
 
+bool Tokenizer::report_whitespace() const { return report_whitespace_; }
+// Note: `set_report_whitespace(false)` implies `set_report_newlines(false)`.
+void Tokenizer::set_report_whitespace(bool report) {
+  report_whitespace_ = report;
+  report_newlines_ &= report;
+}
+
+// If true, newline tokens are reported by Next().
+bool Tokenizer::report_newlines() const { return report_newlines_; }
+// Note: `set_report_newlines(true)` implies `set_report_whitespace(true)`.
+void Tokenizer::set_report_newlines(bool report) {
+  report_newlines_ = report;
+  report_whitespace_ |= report;  // enable report_whitespace if necessary
+}
+
 // -------------------------------------------------------------------
 // Internal helpers.
 
@@ -560,13 +575,46 @@
   }
 }
 
+bool Tokenizer::TryConsumeWhitespace() {
+  if (report_newlines_) {
+    if (TryConsumeOne<WhitespaceNoNewline>()) {
+      ConsumeZeroOrMore<WhitespaceNoNewline>();
+      current_.type = TYPE_WHITESPACE;
+      return true;
+    }
+    return false;
+  }
+  if (TryConsumeOne<Whitespace>()) {
+    ConsumeZeroOrMore<Whitespace>();
+    current_.type = TYPE_WHITESPACE;
+    return report_whitespace_;
+  }
+  return false;
+}
+
+bool Tokenizer::TryConsumeNewline() {
+  if (!report_whitespace_ || !report_newlines_) {
+    return false;
+  }
+  if (TryConsume('\n')) {
+    current_.type = TYPE_NEWLINE;
+    return true;
+  }
+  return false;
+}
+
 // -------------------------------------------------------------------
 
 bool Tokenizer::Next() {
   previous_ = current_;
 
   while (!read_error_) {
-    ConsumeZeroOrMore<Whitespace>();
+    StartToken();
+    bool report_token = TryConsumeWhitespace() || TryConsumeNewline();
+    EndToken();
+    if (report_token) {
+      return true;
+    }
 
     switch (TryConsumeCommentStart()) {
       case LINE_COMMENT:
@@ -768,8 +816,9 @@
   if (current_.type == TYPE_START) {
     // Ignore unicode byte order mark(BOM) if it appears at the file
     // beginning. Only UTF-8 BOM (0xEF 0xBB 0xBF) is accepted.
-    if (TryConsume((char)0xEF)) {
-      if (!TryConsume((char)0xBB) || !TryConsume((char)0xBF)) {
+    if (TryConsume(static_cast<char>(0xEF))) {
+      if (!TryConsume(static_cast<char>(0xBB)) ||
+          !TryConsume(static_cast<char>(0xBF))) {
         AddError(
             "Proto file starts with 0xEF but not UTF-8 BOM. "
             "Only UTF-8 is accepted for proto file.");
@@ -990,7 +1039,8 @@
 }
 
 // Combine a head and trail surrogate into a single Unicode code point.
-static uint32_t AssembleUTF16(uint32_t head_surrogate, uint32_t trail_surrogate) {
+static uint32_t AssembleUTF16(uint32_t head_surrogate,
+                              uint32_t trail_surrogate) {
   GOOGLE_DCHECK(IsHeadSurrogate(head_surrogate));
   GOOGLE_DCHECK(IsTrailSurrogate(trail_surrogate));
   return 0x10000 + (((head_surrogate - kMinHeadSurrogate) << 10) |
diff --git a/src/google/protobuf/io/tokenizer.h b/src/google/protobuf/io/tokenizer.h
index ac23c2e..f7b693e 100644
--- a/src/google/protobuf/io/tokenizer.h
+++ b/src/google/protobuf/io/tokenizer.h
@@ -122,6 +122,13 @@
     TYPE_SYMBOL,      // Any other printable character, like '!' or '+'.
                       // Symbols are always a single character, so "!+$%" is
                       // four tokens.
+    TYPE_WHITESPACE,  // A sequence of whitespace.  This token type is only
+                      // produced if report_whitespace() is true.  It is not
+                      // reported for whitespace within comments or strings.
+    TYPE_NEWLINE,     // A newline (\n).  This token type is only
+                      // produced if report_whitespace() is true and
+                      // report_newlines() is true.  It is not reported for
+                      // newlines in comments or strings.
   };
 
   // Structure representing a token read from the token stream.
@@ -252,6 +259,16 @@
     allow_multiline_strings_ = allow;
   }
 
+  // If true, whitespace tokens are reported by Next().
+  // Note: `set_report_whitespace(false)` implies `set_report_newlines(false)`.
+  bool report_whitespace() const;
+  void set_report_whitespace(bool report);
+
+  // If true, newline tokens are reported by Next().
+  // Note: `set_report_newlines(true)` implies `set_report_whitespace(true)`.
+  bool report_newlines() const;
+  void set_report_newlines(bool report);
+
   // External helper: validate an identifier.
   static bool IsIdentifier(const std::string& text);
 
@@ -287,6 +304,8 @@
   CommentStyle comment_style_;
   bool require_space_after_number_;
   bool allow_multiline_strings_;
+  bool report_whitespace_ = false;
+  bool report_newlines_ = false;
 
   // Since we count columns we need to interpret tabs somehow.  We'll take
   // the standard 8-character definition for lack of any way to do better.
@@ -360,6 +379,14 @@
   // of comment it is.
   NextCommentStatus TryConsumeCommentStart();
 
+  // If we're looking at a TYPE_WHITESPACE token and `report_whitespace_` is
+  // true, consume it and return true.
+  bool TryConsumeWhitespace();
+
+  // If we're looking at a TYPE_NEWLINE token and `report_newlines_` is true,
+  // consume it and return true.
+  bool TryConsumeNewline();
+
   // -----------------------------------------------------------------
   // These helper methods make the parsing code more readable.  The
   // "character classes" referred to are defined at the top of the .cc file.
diff --git a/src/google/protobuf/io/tokenizer_unittest.cc b/src/google/protobuf/io/tokenizer_unittest.cc
index 2233eb9..0b2e76c 100644
--- a/src/google/protobuf/io/tokenizer_unittest.cc
+++ b/src/google/protobuf/io/tokenizer_unittest.cc
@@ -317,6 +317,45 @@
   EXPECT_TRUE(error_collector.text_.empty());
 }
 
+SimpleTokenCase kWhitespaceTokenCases[] = {
+    {" ", Tokenizer::TYPE_WHITESPACE},
+    {"    ", Tokenizer::TYPE_WHITESPACE},
+    {"\t", Tokenizer::TYPE_WHITESPACE},
+    {"\v", Tokenizer::TYPE_WHITESPACE},
+    {"\t ", Tokenizer::TYPE_WHITESPACE},
+    {"\v\t", Tokenizer::TYPE_WHITESPACE},
+    {"   \t\r", Tokenizer::TYPE_WHITESPACE},
+    // Newlines:
+    {"\n", Tokenizer::TYPE_NEWLINE},
+};
+
+TEST_2D(TokenizerTest, Whitespace, kWhitespaceTokenCases, kBlockSizes) {
+  {
+    TestInputStream input(kWhitespaceTokenCases_case.input.data(),
+                          kWhitespaceTokenCases_case.input.size(),
+                          kBlockSizes_case);
+    TestErrorCollector error_collector;
+    Tokenizer tokenizer(&input, &error_collector);
+
+    EXPECT_FALSE(tokenizer.Next());
+  }
+  {
+    TestInputStream input(kWhitespaceTokenCases_case.input.data(),
+                          kWhitespaceTokenCases_case.input.size(),
+                          kBlockSizes_case);
+    TestErrorCollector error_collector;
+    Tokenizer tokenizer(&input, &error_collector);
+    tokenizer.set_report_whitespace(true);
+    tokenizer.set_report_newlines(true);
+
+    ASSERT_TRUE(tokenizer.Next());
+    EXPECT_EQ(tokenizer.current().text, kWhitespaceTokenCases_case.input);
+    EXPECT_EQ(tokenizer.current().type, kWhitespaceTokenCases_case.type);
+
+    EXPECT_FALSE(tokenizer.Next());
+  }
+}
+
 #endif
 
 // -------------------------------------------------------------------
@@ -476,6 +515,81 @@
   EXPECT_TRUE(error_collector.text_.empty());
 }
 
+MultiTokenCase kMultiWhitespaceTokenCases[] = {
+    // Test all token types at the same time.
+    {"foo 1 \t1.2  \n   +\v'bar'",
+     {
+         {Tokenizer::TYPE_IDENTIFIER, "foo", 0, 0, 3},
+         {Tokenizer::TYPE_WHITESPACE, " ", 0, 3, 4},
+         {Tokenizer::TYPE_INTEGER, "1", 0, 4, 5},
+         {Tokenizer::TYPE_WHITESPACE, " \t", 0, 5, 8},
+         {Tokenizer::TYPE_FLOAT, "1.2", 0, 8, 11},
+         {Tokenizer::TYPE_WHITESPACE, "  ", 0, 11, 13},
+         {Tokenizer::TYPE_NEWLINE, "\n", 0, 13, 0},
+         {Tokenizer::TYPE_WHITESPACE, "   ", 1, 0, 3},
+         {Tokenizer::TYPE_SYMBOL, "+", 1, 3, 4},
+         {Tokenizer::TYPE_WHITESPACE, "\v", 1, 4, 5},
+         {Tokenizer::TYPE_STRING, "'bar'", 1, 5, 10},
+         {Tokenizer::TYPE_END, "", 1, 10, 10},
+     }},
+
+};
+
+TEST_2D(TokenizerTest, MultipleWhitespaceTokens, kMultiWhitespaceTokenCases,
+        kBlockSizes) {
+  // Set up the tokenizer.
+  TestInputStream input(kMultiWhitespaceTokenCases_case.input.data(),
+                        kMultiWhitespaceTokenCases_case.input.size(),
+                        kBlockSizes_case);
+  TestErrorCollector error_collector;
+  Tokenizer tokenizer(&input, &error_collector);
+  tokenizer.set_report_whitespace(true);
+  tokenizer.set_report_newlines(true);
+
+  // Before Next() is called, the initial token should always be TYPE_START.
+  EXPECT_EQ(Tokenizer::TYPE_START, tokenizer.current().type);
+  EXPECT_EQ("", tokenizer.current().text);
+  EXPECT_EQ(0, tokenizer.current().line);
+  EXPECT_EQ(0, tokenizer.current().column);
+  EXPECT_EQ(0, tokenizer.current().end_column);
+
+  // Loop through all expected tokens.
+  int i = 0;
+  Tokenizer::Token token;
+  do {
+    token = kMultiWhitespaceTokenCases_case.output[i++];
+
+    SCOPED_TRACE(testing::Message() << "Token #" << i << ": " << token.text);
+
+    Tokenizer::Token previous = tokenizer.current();
+
+    // Next() should only return false when it hits the end token.
+    if (token.type != Tokenizer::TYPE_END) {
+      ASSERT_TRUE(tokenizer.Next());
+    } else {
+      ASSERT_FALSE(tokenizer.Next());
+    }
+
+    // Check that the previous token is set correctly.
+    EXPECT_EQ(previous.type, tokenizer.previous().type);
+    EXPECT_EQ(previous.text, tokenizer.previous().text);
+    EXPECT_EQ(previous.line, tokenizer.previous().line);
+    EXPECT_EQ(previous.column, tokenizer.previous().column);
+    EXPECT_EQ(previous.end_column, tokenizer.previous().end_column);
+
+    // Check that the token matches the expected one.
+    EXPECT_EQ(token.type, tokenizer.current().type);
+    EXPECT_EQ(token.text, tokenizer.current().text);
+    EXPECT_EQ(token.line, tokenizer.current().line);
+    EXPECT_EQ(token.column, tokenizer.current().column);
+    EXPECT_EQ(token.end_column, tokenizer.current().end_column);
+
+  } while (token.type != Tokenizer::TYPE_END);
+
+  // There should be no errors.
+  EXPECT_TRUE(error_collector.text_.empty());
+}
+
 // This test causes gcc 3.3.5 (and earlier?) to give the cryptic error:
 //   "sorry, unimplemented: `method_call_expr' not supported by dump_expr"
 #if !defined(__GNUC__) || __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3)
diff --git a/src/google/protobuf/io/zero_copy_stream_impl.cc b/src/google/protobuf/io/zero_copy_stream_impl.cc
index 0986ea2..c66bc86 100644
--- a/src/google/protobuf/io/zero_copy_stream_impl.cc
+++ b/src/google/protobuf/io/zero_copy_stream_impl.cc
@@ -104,7 +104,7 @@
       is_closed_(false),
       errno_(0),
       previous_seek_failed_(false) {
-#ifndef _MSC_VER
+#ifndef _WIN32
   int flags = fcntl(file_, F_GETFL);
   flags &= ~O_NONBLOCK;
   fcntl(file_, F_SETFL, flags);
@@ -170,7 +170,7 @@
 
 // ===================================================================
 
-FileOutputStream::FileOutputStream(int file_descriptor, int block_size)
+FileOutputStream::FileOutputStream(int file_descriptor, int /*block_size*/)
     : CopyingOutputStreamAdaptor(&copying_output_),
       copying_output_(file_descriptor) {}
 
diff --git a/src/google/protobuf/map.h b/src/google/protobuf/map.h
index 1bd0d93..0708366 100644
--- a/src/google/protobuf/map.h
+++ b/src/google/protobuf/map.h
@@ -50,6 +50,10 @@
 #include <string_view>
 #endif  // defined(__cpp_lib_string_view)
 
+#if !defined(GOOGLE_PROTOBUF_NO_RDTSC) && defined(__APPLE__)
+#include <mach/mach_time.h>
+#endif
+
 #include <google/protobuf/stubs/common.h>
 #include <google/protobuf/arena.h>
 #include <google/protobuf/generated_enum_util.h>
@@ -1080,12 +1084,24 @@
       // lower bits are not very random, due to alignment, so we discard them
       // and shift the higher bits into their place.
       size_type s = reinterpret_cast<uintptr_t>(this) >> 4;
-#if defined(__x86_64__) && defined(__GNUC__) && \
-    !defined(GOOGLE_PROTOBUF_NO_RDTSC)
+#if !defined(GOOGLE_PROTOBUF_NO_RDTSC)
+#if defined(__APPLE__)
+      // Use a commpage-based fast time function on Apple environments (MacOS,
+      // iOS, tvOS, watchOS, etc).
+      s += mach_absolute_time();
+#elif defined(__x86_64__) && defined(__GNUC__)
       uint32_t hi, lo;
       asm volatile("rdtsc" : "=a"(lo), "=d"(hi));
       s += ((static_cast<uint64_t>(hi) << 32) | lo);
+#elif defined(__aarch64__) && defined(__GNUC__)
+      // There is no rdtsc on ARMv8. CNTVCT_EL0 is the virtual counter of the
+      // system timer. It runs at a different frequency than the CPU's, but is
+      // the best source of time-based entropy we get.
+      uint64_t virtual_timer_value;
+      asm volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value));
+      s += virtual_timer_value;
 #endif
+#endif  // !defined(GOOGLE_PROTOBUF_NO_RDTSC)
       return s;
     }
 
diff --git a/src/google/protobuf/map_entry_lite.h b/src/google/protobuf/map_entry_lite.h
index 7dd50e2..34b185b 100644
--- a/src/google/protobuf/map_entry_lite.h
+++ b/src/google/protobuf/map_entry_lite.h
@@ -194,7 +194,7 @@
         _has_bits_{} {}
 
   ~MapEntryImpl() {
-    if (Base::GetArenaForAllocation() != NULL) return;
+    if (Base::GetArenaForAllocation() != nullptr) return;
     KeyTypeHandler::DeleteNoArena(key_);
     ValueTypeHandler::DeleteNoArena(value_);
   }
@@ -286,11 +286,6 @@
     return ValueTypeHandler::IsInitialized(value_);
   }
 
-  Base* New() const override {
-    Derived* entry = new Derived;
-    return entry;
-  }
-
   Base* New(Arena* arena) const override {
     Derived* entry = Arena::CreateMessage<Derived>(arena);
     return entry;
@@ -528,7 +523,9 @@
       SuperType;
   constexpr MapEntryLite() {}
   explicit MapEntryLite(Arena* arena) : SuperType(arena) {}
-  ~MapEntryLite() { MessageLite::_internal_metadata_.template Delete<std::string>(); }
+  ~MapEntryLite() {
+    MessageLite::_internal_metadata_.template Delete<std::string>();
+  }
   void MergeFrom(const MapEntryLite& other) { MergeFromInternal(other); }
 
  private:
diff --git a/src/google/protobuf/map_field.cc b/src/google/protobuf/map_field.cc
index 1581caf..367cc2a 100644
--- a/src/google/protobuf/map_field.cc
+++ b/src/google/protobuf/map_field.cc
@@ -40,7 +40,7 @@
 namespace internal {
 
 MapFieldBase::~MapFieldBase() {
-  if (repeated_field_ != NULL && arena_ == NULL) delete repeated_field_;
+  if (repeated_field_ != nullptr && arena_ == nullptr) delete repeated_field_;
 }
 
 const RepeatedPtrFieldBase& MapFieldBase::GetRepeatedField() const {
@@ -56,9 +56,44 @@
   return reinterpret_cast<RepeatedPtrFieldBase*>(repeated_field_);
 }
 
+void MapFieldBase::SwapState(MapFieldBase* other) {
+  // a relaxed swap of the atomic
+  auto other_state = other->state_.load(std::memory_order_relaxed);
+  auto this_state = state_.load(std::memory_order_relaxed);
+  other->state_.store(this_state, std::memory_order_relaxed);
+  state_.store(other_state, std::memory_order_relaxed);
+}
+
+void SwapRepeatedPtrToNull(RepeatedPtrField<Message>** from,
+                           RepeatedPtrField<Message>** to, Arena* from_arena,
+                           Arena* to_arena) {
+  GOOGLE_DCHECK(*from != nullptr);
+  GOOGLE_DCHECK(*to == nullptr);
+  *to = Arena::CreateMessage<RepeatedPtrField<Message> >(to_arena);
+  **to = std::move(**from);
+  if (from_arena == nullptr) {
+    delete *from;
+  }
+  *from = nullptr;
+}
+
 void MapFieldBase::Swap(MapFieldBase* other) {
-  // TODO(teboring): This is incorrect when on different arenas.
-  InternalSwap(other);
+  if (arena_ == other->arena_) {
+    InternalSwap(other);
+    return;
+  }
+  if (repeated_field_ != nullptr || other->repeated_field_ != nullptr) {
+    if (repeated_field_ == nullptr) {
+      SwapRepeatedPtrToNull(&other->repeated_field_, &repeated_field_,
+                            other->arena_, arena_);
+    } else if (other->repeated_field_ == nullptr) {
+      SwapRepeatedPtrToNull(&repeated_field_, &other->repeated_field_, arena_,
+                            other->arena_);
+    } else {
+      repeated_field_->Swap(other->repeated_field_);
+    }
+  }
+  SwapState(other);
 }
 
 void MapFieldBase::UnsafeShallowSwap(MapFieldBase* other) {
@@ -69,11 +104,7 @@
 void MapFieldBase::InternalSwap(MapFieldBase* other) {
   std::swap(arena_, other->arena_);
   std::swap(repeated_field_, other->repeated_field_);
-  // a relaxed swap of the atomic
-  auto other_state = other->state_.load(std::memory_order_relaxed);
-  auto this_state = state_.load(std::memory_order_relaxed);
-  other->state_.store(this_state, std::memory_order_relaxed);
-  state_.store(other_state, std::memory_order_relaxed);
+  SwapState(other);
 }
 
 size_t MapFieldBase::SpaceUsedExcludingSelfLong() const {
@@ -86,7 +117,7 @@
 }
 
 size_t MapFieldBase::SpaceUsedExcludingSelfNoLock() const {
-  if (repeated_field_ != NULL) {
+  if (repeated_field_ != nullptr) {
     return repeated_field_->SpaceUsedExcludingSelfLong();
   } else {
     return 0;
@@ -156,7 +187,7 @@
 }
 
 void MapFieldBase::SyncRepeatedFieldWithMapNoLock() const {
-  if (repeated_field_ == NULL) {
+  if (repeated_field_ == nullptr) {
     repeated_field_ = Arena::CreateMessage<RepeatedPtrField<Message> >(arena_);
   }
 }
@@ -403,7 +434,7 @@
   const Reflection* reflection = default_entry_->GetReflection();
   const FieldDescriptor* key_des = default_entry_->GetDescriptor()->map_key();
   const FieldDescriptor* val_des = default_entry_->GetDescriptor()->map_value();
-  if (MapFieldBase::repeated_field_ == NULL) {
+  if (MapFieldBase::repeated_field_ == nullptr) {
     MapFieldBase::repeated_field_ =
         Arena::CreateMessage<RepeatedPtrField<Message> >(MapFieldBase::arena_);
   }
@@ -566,7 +597,7 @@
 
 size_t DynamicMapField::SpaceUsedExcludingSelfNoLock() const {
   size_t size = 0;
-  if (MapFieldBase::repeated_field_ != NULL) {
+  if (MapFieldBase::repeated_field_ != nullptr) {
     size += MapFieldBase::repeated_field_->SpaceUsedExcludingSelfLong();
   }
   size += sizeof(map_);
diff --git a/src/google/protobuf/map_field.h b/src/google/protobuf/map_field.h
index 6668441..c87d44e 100644
--- a/src/google/protobuf/map_field.h
+++ b/src/google/protobuf/map_field.h
@@ -324,7 +324,7 @@
 class PROTOBUF_EXPORT MapFieldBase {
  public:
   MapFieldBase()
-      : arena_(NULL), repeated_field_(NULL), state_(STATE_MODIFIED_MAP) {}
+      : arena_(nullptr), repeated_field_(nullptr), state_(STATE_MODIFIED_MAP) {}
 
   // This constructor is for constant initialized global instances.
   // It uses a linker initialized mutex, so it is not compatible with regular
@@ -466,6 +466,10 @@
   // IncreaseIterator() is called by operator++() of MapIterator only.
   // It implements the ++ operator of MapIterator.
   virtual void IncreaseIterator(MapIterator* map_iter) const = 0;
+
+  // Swaps state_ with another MapFieldBase
+  void SwapState(MapFieldBase* other);
+
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MapFieldBase);
 };
 
@@ -573,15 +577,15 @@
   void InternalSwap(MapField* other);
 
   // Used in the implementation of parsing. Caller should take the ownership iff
-  // arena_ is NULL.
+  // arena_ is nullptr.
   EntryType* NewEntry() const { return impl_.NewEntry(); }
   // Used in the implementation of serializing enum value type. Caller should
-  // take the ownership iff arena_ is NULL.
+  // take the ownership iff arena_ is nullptr.
   EntryType* NewEnumEntryWrapper(const Key& key, const T t) const {
     return impl_.NewEnumEntryWrapper(key, t);
   }
   // Used in the implementation of serializing other value types. Caller should
-  // take the ownership iff arena_ is NULL.
+  // take the ownership iff arena_ is nullptr.
   EntryType* NewEntryWrapper(const Key& key, const T& t) const {
     return impl_.NewEntryWrapper(key, t);
   }
diff --git a/src/google/protobuf/map_field_inl.h b/src/google/protobuf/map_field_inl.h
index 35231b2..7c4c232 100644
--- a/src/google/protobuf/map_field_inl.h
+++ b/src/google/protobuf/map_field_inl.h
@@ -138,7 +138,7 @@
 void TypeDefinedMapFieldBase<Key, T>::InitializeIterator(
     MapIterator* map_iter) const {
   map_iter->iter_ = new typename Map<Key, T>::const_iterator;
-  GOOGLE_CHECK(map_iter->iter_ != NULL);
+  GOOGLE_CHECK(map_iter->iter_ != nullptr);
 }
 
 template <typename Key, typename T>
@@ -304,7 +304,7 @@
           WireFormatLite::FieldType kValueFieldType>
 void MapField<Derived, Key, T, kKeyFieldType,
               kValueFieldType>::SyncRepeatedFieldWithMapNoLock() const {
-  if (this->MapFieldBase::repeated_field_ == NULL) {
+  if (this->MapFieldBase::repeated_field_ == nullptr) {
     this->MapFieldBase::repeated_field_ =
         Arena::CreateMessage<RepeatedPtrField<Message> >(
             this->MapFieldBase::arena_);
@@ -341,7 +341,7 @@
   RepeatedPtrField<EntryType>* repeated_field =
       reinterpret_cast<RepeatedPtrField<EntryType>*>(
           this->MapFieldBase::repeated_field_);
-  GOOGLE_CHECK(this->MapFieldBase::repeated_field_ != NULL);
+  GOOGLE_CHECK(this->MapFieldBase::repeated_field_ != nullptr);
   map->clear();
   for (typename RepeatedPtrField<EntryType>::iterator it =
            repeated_field->begin();
@@ -361,7 +361,7 @@
 size_t MapField<Derived, Key, T, kKeyFieldType,
                 kValueFieldType>::SpaceUsedExcludingSelfNoLock() const {
   size_t size = 0;
-  if (this->MapFieldBase::repeated_field_ != NULL) {
+  if (this->MapFieldBase::repeated_field_ != nullptr) {
     size += this->MapFieldBase::repeated_field_->SpaceUsedExcludingSelfLong();
   }
   size += impl_.GetMap().SpaceUsedExcludingSelfLong();
diff --git a/src/google/protobuf/map_field_lite.h b/src/google/protobuf/map_field_lite.h
index 2a32106..255a0bc 100644
--- a/src/google/protobuf/map_field_lite.h
+++ b/src/google/protobuf/map_field_lite.h
@@ -84,17 +84,17 @@
   void InternalSwap(MapFieldLite* other) { map_.InternalSwap(other->map_); }
 
   // Used in the implementation of parsing. Caller should take the ownership iff
-  // arena_ is NULL.
+  // arena_ is nullptr.
   EntryType* NewEntry() const {
     return Arena::CreateMessage<EntryType>(map_.arena());
   }
   // Used in the implementation of serializing enum value type. Caller should
-  // take the ownership iff arena_ is NULL.
+  // take the ownership iff arena_ is nullptr.
   EntryType* NewEnumEntryWrapper(const Key& key, const T t) const {
     return EntryType::EnumWrap(key, t, map_.arena_);
   }
   // Used in the implementation of serializing other value types. Caller should
-  // take the ownership iff arena_ is NULL.
+  // take the ownership iff arena_ is nullptr.
   EntryType* NewEntryWrapper(const Key& key, const T& t) const {
     return EntryType::Wrap(key, t, map_.arena_);
   }
diff --git a/src/google/protobuf/map_field_test.cc b/src/google/protobuf/map_field_test.cc
index 982a34f..cfc08f4 100644
--- a/src/google/protobuf/map_field_test.cc
+++ b/src/google/protobuf/map_field_test.cc
@@ -209,7 +209,7 @@
         Arena::CreateMessage<MapFieldBaseStub>(&arena);
 
     // Trigger conversion to repeated field.
-    EXPECT_TRUE(map_field->MutableRepeatedField() != NULL);
+    EXPECT_TRUE(map_field->MutableRepeatedField() != nullptr);
 
     EXPECT_EQ(map_field->GetArenaForInternalRepeatedField(), &arena);
   }
@@ -308,7 +308,7 @@
 
     EXPECT_EQ(map_size, map->size());
     if (is_repeated_null) {
-      EXPECT_TRUE(repeated_field == NULL);
+      EXPECT_TRUE(repeated_field == nullptr);
     } else {
       if (repeated_field == nullptr) {
         EXPECT_EQ(repeated_size, 0);
diff --git a/src/google/protobuf/map_test.inc b/src/google/protobuf/map_test.inc
index 4e8304f..733f13b 100644
--- a/src/google/protobuf/map_test.inc
+++ b/src/google/protobuf/map_test.inc
@@ -884,7 +884,7 @@
 }
 
 TEST_F(MapImplTest, CopyConstructorWithoutArena) {
-  CopyConstructorHelper(NULL, &map_);
+  CopyConstructorHelper(nullptr, &map_);
 }
 
 TEST_F(MapImplTest, IterConstructor) {
@@ -1023,6 +1023,33 @@
   EXPECT_THAT(m2, testing::UnorderedElementsAre(testing::Pair(9398, 41999)));
 }
 
+TEST_F(MapImplTest, SwapFieldArenaReflection) {
+  MapReflectionTester reflection_tester(UNITTEST::TestMap::descriptor());
+  Arena arena;
+
+  {
+    // Tests filled lfs and empty rhs.
+    TestMap rhs;
+
+    {
+      // Use local_arena to allocate lhs to trigger use-after-free error.
+      Arena local_arena;
+      auto* lhs = Arena::CreateMessage<TestMap>(&local_arena);
+      const auto* reflection = lhs->GetReflection();
+      std::vector<const FieldDescriptor*> fields;
+
+      reflection_tester.SetMapFieldsViaReflection(lhs);
+      reflection->ListFields(*lhs, &fields);
+
+      reflection->SwapFields(lhs, &rhs, fields);
+
+      reflection_tester.ExpectClearViaReflection(*lhs);
+    }
+
+    reflection_tester.ExpectMapFieldsSetViaReflection(rhs);
+  }
+}
+
 TEST_F(MapImplTest, CopyAssignMapIterator) {
   TestMap message;
   MapReflectionTester reflection_tester(UNITTEST::TestMap::descriptor());
@@ -1091,11 +1118,7 @@
 }
 
 // This test verifies that the iteration order is reasonably random even for
-// small maps. Currently we only have sufficient randomness for debug builds and
-// builds where we can use the RDTSC instruction, so we only test for those
-// builds.
-#if defined(__x86_64__) && defined(__GNUC__) && \
-    !defined(GOOGLE_PROTOBUF_NO_RDTSC)
+// small maps.
 TEST_F(MapImplTest, RandomOrdering) {
   for (int i = 0; i < 10; ++i) {
     for (int j = i + 1; j < 10; ++j) {
@@ -1105,7 +1128,6 @@
     }
   }
 }
-#endif
 
 template <typename Key>
 void TestTransparent(const Key& key, const Key& miss_key) {
@@ -3018,8 +3040,8 @@
         std::string(UNITTEST_PACKAGE_NAME) + ".TestMap");
     recursive_map_descriptor_ = pool_->FindMessageTypeByName(
         std::string(UNITTEST_PACKAGE_NAME) + ".TestRecursiveMapMessage");
-    ASSERT_TRUE(map_descriptor_ != NULL);
-    ASSERT_TRUE(recursive_map_descriptor_ != NULL);
+    ASSERT_TRUE(map_descriptor_ != nullptr);
+    ASSERT_TRUE(recursive_map_descriptor_ != nullptr);
     map_prototype_ = factory_.GetPrototype(map_descriptor_);
   }
 };
@@ -3759,7 +3781,7 @@
   }
   (*message->mutable_map_string_string())[data] = data;
   // We rely on heap checkers to detect memory leak for us.
-  ASSERT_FALSE(message == NULL);
+  ASSERT_FALSE(message == nullptr);
 }
 
 TEST(ArenaTest, IsInitialized) {
diff --git a/src/google/protobuf/map_type_handler.h b/src/google/protobuf/map_type_handler.h
index 7f2892b..2857342 100644
--- a/src/google/protobuf/map_type_handler.h
+++ b/src/google/protobuf/map_type_handler.h
@@ -510,7 +510,7 @@
 template <typename Type>
 inline void MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Clear(
     Type** value, Arena* /* arena */) {
-  if (*value != NULL) (*value)->Clear();
+  if (*value != nullptr) (*value)->Clear();
 }
 template <typename Type>
 inline void MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::Merge(
@@ -533,7 +533,7 @@
 template <typename Type>
 inline Type* MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::EnsureMutable(
     Type** value, Arena* arena) {
-  if (*value == NULL) {
+  if (*value == nullptr) {
     *value = MapArenaMessageCreator<
         Type,
         Arena::is_arena_constructable<Type>::type::value>::CreateMessage(arena);
@@ -545,7 +545,7 @@
 inline const Type&
 MapTypeHandler<WireFormatLite::TYPE_MESSAGE, Type>::DefaultIfNotInitialized(
     const Type* value) {
-  return value != NULL ? *value : *Type::internal_default_instance();
+  return value != nullptr ? *value : *Type::internal_default_instance();
 }
 
 template <typename Type>
diff --git a/src/google/protobuf/message.cc b/src/google/protobuf/message.cc
index 6f40694..7e50ef1 100644
--- a/src/google/protobuf/message.cc
+++ b/src/google/protobuf/message.cc
@@ -275,35 +275,35 @@
   {
     ReaderMutexLock lock(&mutex_);
     const Message* result = FindPtrOrNull(type_map_, type);
-    if (result != NULL) return result;
+    if (result != nullptr) return result;
   }
 
   // If the type is not in the generated pool, then we can't possibly handle
   // it.
-  if (type->file()->pool() != DescriptorPool::generated_pool()) return NULL;
+  if (type->file()->pool() != DescriptorPool::generated_pool()) return nullptr;
 
   // Apparently the file hasn't been registered yet.  Let's do that now.
   const internal::DescriptorTable* registration_data =
       FindPtrOrNull(file_map_, type->file()->name().c_str());
-  if (registration_data == NULL) {
+  if (registration_data == nullptr) {
     GOOGLE_LOG(DFATAL) << "File appears to be in generated pool but wasn't "
                    "registered: "
                 << type->file()->name();
-    return NULL;
+    return nullptr;
   }
 
   WriterMutexLock lock(&mutex_);
 
   // Check if another thread preempted us.
   const Message* result = FindPtrOrNull(type_map_, type);
-  if (result == NULL) {
+  if (result == nullptr) {
     // Nope.  OK, register everything.
     internal::RegisterFileLevelMetadata(registration_data);
     // Should be here now.
     result = FindPtrOrNull(type_map_, type);
   }
 
-  if (result == NULL) {
+  if (result == nullptr) {
     GOOGLE_LOG(DFATAL) << "Type appears to be in generated pool but wasn't "
                 << "registered: " << type->full_name();
   }
@@ -367,7 +367,7 @@
       }
   }
   GOOGLE_LOG(FATAL) << "Should not reach here.";
-  return NULL;
+  return nullptr;
 }
 
 namespace internal {
diff --git a/src/google/protobuf/message.h b/src/google/protobuf/message.h
index c03ad4b..a086945 100644
--- a/src/google/protobuf/message.h
+++ b/src/google/protobuf/message.h
@@ -158,7 +158,7 @@
 class MapFieldBase;
 class SwapFieldHelper;
 class CachedSize;
-}
+}  // namespace internal
 class UnknownFieldSet;  // unknown_field_set.h
 namespace io {
 class ZeroCopyInputStream;   // zero_copy_stream.h
@@ -169,7 +169,7 @@
 namespace python {
 class MapReflectionFriend;  // scalar_map_container.h
 class MessageReflectionFriend;
-}
+}  // namespace python
 namespace expr {
 class CelMapReflectionFriend;  // field_backed_map_impl.cc
 }
@@ -244,18 +244,11 @@
   // Construct a new instance of the same type.  Ownership is passed to the
   // caller.  (This is also defined in MessageLite, but is defined again here
   // for return-type covariance.)
-  Message* New() const override = 0;
+  Message* New() const { return New(nullptr); }
 
   // Construct a new instance on the arena. Ownership is passed to the caller
-  // if arena is a nullptr. Default implementation allows for API compatibility
-  // during the Arena transition.
-  Message* New(Arena* arena) const override {
-    Message* message = New();
-    if (arena != nullptr) {
-      arena->Own(message);
-    }
-    return message;
-  }
+  // if arena is a nullptr.
+  Message* New(Arena* arena) const override = 0;
 
   // Make this message into a copy of the given message.  The given message
   // must have the same descriptor, but need not necessarily be the same class.
@@ -293,7 +286,7 @@
   // method after parsing.
   //
   // See Reflection::GetUnknownFields() for more on unknown fields.
-  virtual void DiscardUnknownFields();
+  void DiscardUnknownFields();
 
   // Computes (an estimate of) the total number of bytes currently used for
   // storing the message in memory.  The default implementation calls the
@@ -507,8 +500,8 @@
   void RemoveLast(Message* message, const FieldDescriptor* field) const;
   // Removes the last element of a repeated message field, and returns the
   // pointer to the caller.  Caller takes ownership of the returned pointer.
-  PROTOBUF_MUST_USE_RESULT Message* ReleaseLast(
-      Message* message, const FieldDescriptor* field) const;
+  PROTOBUF_NODISCARD Message* ReleaseLast(Message* message,
+                                          const FieldDescriptor* field) const;
 
   // Similar to ReleaseLast() without internal safety and ownershp checks. This
   // method should only be used when the objects are on the same arena or paired
@@ -662,7 +655,7 @@
   // If the field existed (HasField() is true), then the returned pointer will
   // be the same as the pointer returned by MutableMessage().
   // This function has the same effect as ClearField().
-  PROTOBUF_MUST_USE_RESULT Message* ReleaseMessage(
+  PROTOBUF_NODISCARD Message* ReleaseMessage(
       Message* message, const FieldDescriptor* field,
       MessageFactory* factory = nullptr) const;
 
@@ -1020,6 +1013,11 @@
            IsEagerlyVerifiedLazyField(field);
   }
 
+  // Returns true if the field is lazy extension. It is meant to allow python
+  // reparse lazy field until b/157559327 is fixed.
+  bool IsLazyExtension(const Message& message,
+                       const FieldDescriptor* field) const;
+
   bool IsLazilyVerifiedLazyField(const FieldDescriptor* field) const;
   bool IsEagerlyVerifiedLazyField(const FieldDescriptor* field) const;
 
diff --git a/src/google/protobuf/message_lite.cc b/src/google/protobuf/message_lite.cc
index 3dea09e..b4f8d40 100644
--- a/src/google/protobuf/message_lite.cc
+++ b/src/google/protobuf/message_lite.cc
@@ -121,6 +121,7 @@
 inline bool CheckFieldPresence(const internal::ParseContext& ctx,
                                const MessageLite& msg,
                                MessageLite::ParseFlags parse_flags) {
+  (void)ctx;  // Parameter is used by Google-internal code.
   if (PROTOBUF_PREDICT_FALSE((parse_flags & MessageLite::kMergePartial) != 0)) {
     return true;
   }
@@ -195,14 +196,6 @@
 
 }  // namespace internal
 
-MessageLite* MessageLite::New(Arena* arena) const {
-  MessageLite* message = New();
-  if (arena != NULL) {
-    arena->Own(message);
-  }
-  return message;
-}
-
 class ZeroCopyCodedInputStream : public io::ZeroCopyInputStream {
  public:
   ZeroCopyCodedInputStream(io::CodedInputStream* cis) : cis_(cis) {}
diff --git a/src/google/protobuf/message_lite.h b/src/google/protobuf/message_lite.h
index d813850..5e6fbdb 100644
--- a/src/google/protobuf/message_lite.h
+++ b/src/google/protobuf/message_lite.h
@@ -46,13 +46,16 @@
 #include <google/protobuf/stubs/logging.h>
 #include <google/protobuf/io/coded_stream.h>
 #include <google/protobuf/arena.h>
+#include <google/protobuf/explicitly_constructed.h>
 #include <google/protobuf/metadata_lite.h>
 #include <google/protobuf/stubs/once.h>
 #include <google/protobuf/port.h>
 #include <google/protobuf/stubs/strutil.h>
 
 
+// clang-format off
 #include <google/protobuf/port_def.inc>
+// clang-format on
 
 #ifdef SWIG
 #error "You cannot SWIG proto headers"
@@ -92,7 +95,7 @@
 class ExtensionSet;
 class LazyField;
 class RepeatedPtrFieldBase;
-class TcParserBase;
+class TcParser;
 class WireFormatLite;
 class WeakFieldMap;
 
@@ -126,43 +129,6 @@
   return static_cast<int>(size);
 }
 
-// This type wraps a variable whose constructor and destructor are explicitly
-// called. It is particularly useful for a global variable, without its
-// constructor and destructor run on start and end of the program lifetime.
-// This circumvents the initial construction order fiasco, while keeping
-// the address of the empty string a compile time constant.
-//
-// Pay special attention to the initialization state of the object.
-// 1. The object is "uninitialized" to begin with.
-// 2. Call Construct() or DefaultConstruct() only if the object is
-//    uninitialized. After the call, the object becomes "initialized".
-// 3. Call get() and get_mutable() only if the object is initialized.
-// 4. Call Destruct() only if the object is initialized.
-//    After the call, the object becomes uninitialized.
-template <typename T>
-class ExplicitlyConstructed {
- public:
-  void DefaultConstruct() { new (&union_) T(); }
-
-  template <typename... Args>
-  void Construct(Args&&... args) {
-    new (&union_) T(std::forward<Args>(args)...);
-  }
-
-  void Destruct() { get_mutable()->~T(); }
-
-  constexpr const T& get() const { return reinterpret_cast<const T&>(union_); }
-  T* get_mutable() { return reinterpret_cast<T*>(&union_); }
-
- private:
-  // Prefer c++14 aligned_storage, but for compatibility this will do.
-  union AlignedUnion {
-    alignas(T) char space[sizeof(T)];
-    int64_t align_to_int64;
-    void* align_to_ptr;
-  } union_;
-};
-
 // Default empty string object. Don't use this directly. Instead, call
 // GetEmptyString() to get the reference.
 PROTOBUF_EXPORT extern ExplicitlyConstructed<std::string>
@@ -215,28 +181,15 @@
 
   // Construct a new instance of the same type.  Ownership is passed to the
   // caller.
-  virtual MessageLite* New() const = 0;
+  MessageLite* New() const { return New(nullptr); }
 
   // Construct a new instance on the arena. Ownership is passed to the caller
-  // if arena is a NULL. Default implementation for backwards compatibility.
-  virtual MessageLite* New(Arena* arena) const;
+  // if arena is a nullptr.
+  virtual MessageLite* New(Arena* arena) const = 0;
 
   // Same as GetOwningArena.
   Arena* GetArena() const { return GetOwningArena(); }
 
-  // Get a pointer that may be equal to this message's arena, or may not be.
-  // If the value returned by this method is equal to some arena pointer, then
-  // this message is on that arena; however, if this message is on some arena,
-  // this method may or may not return that arena's pointer. As a tradeoff,
-  // this method may be more efficient than GetArena(). The intent is to allow
-  // underlying representations that use e.g. tagged pointers to sometimes
-  // store the arena pointer directly, and sometimes in a more indirect way,
-  // and allow a fastpath comparison against the arena pointer when it's easy
-  // to obtain.
-  void* GetMaybeArenaPointer() const {
-    return _internal_metadata_.raw_arena_ptr();
-  }
-
   // Clear all fields of the message and set them to their default values.
   // Clear() avoids freeing memory, assuming that any memory allocated
   // to hold parts of the message will be needed again to hold the next
@@ -520,7 +473,7 @@
 
  private:
   // TODO(gerbens) make this a pure abstract function
-  virtual const void* InternalGetTable() const { return NULL; }
+  virtual const void* InternalGetTable() const { return nullptr; }
 
   friend class FastReflectionMessageMutator;
   friend class FastReflectionStringSetter;
@@ -529,7 +482,7 @@
   friend class internal::ExtensionSet;
   friend class internal::LazyField;
   friend class internal::SwapFieldHelper;
-  friend class internal::TcParserBase;
+  friend class internal::TcParser;
   friend class internal::WeakFieldMap;
   friend class internal::WireFormatLite;
 
diff --git a/src/google/protobuf/message_unittest.cc b/src/google/protobuf/message_unittest.cc
index 0840e7b..f71f60c 100644
--- a/src/google/protobuf/message_unittest.cc
+++ b/src/google/protobuf/message_unittest.cc
@@ -41,5 +41,8 @@
 #define UNITTEST_IMPORT ::protobuf_unittest_import
 
 // Must include after the above macros.
+// clang-format off
 #include <google/protobuf/test_util.inc>
 #include <google/protobuf/message_unittest.inc>
+#include <google/protobuf/arena.h>
+// clang-format on
diff --git a/src/google/protobuf/message_unittest.inc b/src/google/protobuf/message_unittest.inc
index 408c233..f57fc8e 100644
--- a/src/google/protobuf/message_unittest.inc
+++ b/src/google/protobuf/message_unittest.inc
@@ -39,6 +39,9 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 
+#include <cmath>
+#include <limits>
+
 #include <google/protobuf/message.h>
 #ifndef _MSC_VER
 #include <unistd.h>
@@ -487,6 +490,8 @@
 }  // namespace
 
 TEST(MESSAGE_TEST_NAME, TestParseMessagesCloseTo2G) {
+  constexpr int32_t kint32max = std::numeric_limits<int32_t>::max();
+
   // Create a message with a large std::string field.
   std::string value = std::string(64 * 1024 * 1024, 'x');
   UNITTEST::TestAllTypes message;
@@ -872,5 +877,21 @@
   EXPECT_EQ(5, out_message.GetExtension(UNITTEST::TestExtensionRangeSerialize::bar_five));
 }
 
+TEST(MESSAGE_TEST_NAME, PreservesFloatingPointNegative0) {
+  UNITTEST::TestAllTypes in_message;
+  in_message.set_optional_float(-0.0f);
+  in_message.set_optional_double(-0.0);
+  std::string serialized;
+  EXPECT_TRUE(in_message.SerializeToString(&serialized));
+  UNITTEST::TestAllTypes out_message;
+  EXPECT_TRUE(out_message.ParseFromString(serialized));
+  EXPECT_EQ(in_message.optional_float(), out_message.optional_float());
+  EXPECT_EQ(std::signbit(in_message.optional_float()),
+            std::signbit(out_message.optional_float()));
+  EXPECT_EQ(in_message.optional_double(), out_message.optional_double());
+  EXPECT_EQ(std::signbit(in_message.optional_double()),
+            std::signbit(out_message.optional_double()));
+}
+
 }  // namespace protobuf
 }  // namespace google
diff --git a/src/google/protobuf/metadata_lite.h b/src/google/protobuf/metadata_lite.h
index 0b90f28..e6ecfb7 100644
--- a/src/google/protobuf/metadata_lite.h
+++ b/src/google/protobuf/metadata_lite.h
@@ -188,7 +188,7 @@
 
   template <typename T>
   PROTOBUF_NOINLINE void DeleteOutOfLineHelper() {
-    if (arena() == NULL) {
+    if (arena() == nullptr) {
       delete PtrValue<Container<T>>();
     }
   }
diff --git a/src/google/protobuf/parse_context.cc b/src/google/protobuf/parse_context.cc
index db7004f..1aec2ae 100644
--- a/src/google/protobuf/parse_context.cc
+++ b/src/google/protobuf/parse_context.cc
@@ -205,7 +205,7 @@
 }
 
 const char* EpsCopyInputStream::SkipFallback(const char* ptr, int size) {
-  return AppendSize(ptr, size, [](const char* p, int s) {});
+  return AppendSize(ptr, size, [](const char* /*p*/, int /*s*/) {});
 }
 
 const char* EpsCopyInputStream::ReadStringFallback(const char* ptr, int size,
@@ -237,7 +237,7 @@
 template <int>
 void byteswap(void* p);
 template <>
-void byteswap<1>(void* p) {}
+void byteswap<1>(void* /*p*/) {}
 template <>
 void byteswap<4>(void* p) {
   *static_cast<uint32_t*>(p) = bswap_32(*static_cast<uint32_t*>(p));
@@ -460,7 +460,6 @@
 template <typename T>
 const char* FixedParser(void* object, const char* ptr, ParseContext* ctx) {
   int size = ReadSize(&ptr);
-  GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
   return ctx->ReadPackedFixed(ptr, size,
                               static_cast<RepeatedField<T>*>(object));
 }
diff --git a/src/google/protobuf/parse_context.h b/src/google/protobuf/parse_context.h
index 488b062..62e25dc 100644
--- a/src/google/protobuf/parse_context.h
+++ b/src/google/protobuf/parse_context.h
@@ -125,7 +125,7 @@
   }
 
   // If return value is negative it's an error
-  PROTOBUF_MUST_USE_RESULT int PushLimit(const char* ptr, int limit) {
+  PROTOBUF_NODISCARD int PushLimit(const char* ptr, int limit) {
     GOOGLE_DCHECK(limit >= 0 && limit <= INT_MAX - kSlopBytes);
     // This add is safe due to the invariant above, because
     // ptr - buffer_end_ <= kSlopBytes.
@@ -136,7 +136,7 @@
     return old_limit - limit;
   }
 
-  PROTOBUF_MUST_USE_RESULT bool PopLimit(int delta) {
+  PROTOBUF_NODISCARD bool PopLimit(int delta) {
     if (PROTOBUF_PREDICT_FALSE(!EndedAtLimit())) return false;
     limit_ = limit_ + delta;
     // TODO(gerbens) We could remove this line and hoist the code to
@@ -145,22 +145,22 @@
     return true;
   }
 
-  PROTOBUF_MUST_USE_RESULT const char* Skip(const char* ptr, int size) {
+  PROTOBUF_NODISCARD const char* Skip(const char* ptr, int size) {
     if (size <= buffer_end_ + kSlopBytes - ptr) {
       return ptr + size;
     }
     return SkipFallback(ptr, size);
   }
-  PROTOBUF_MUST_USE_RESULT const char* ReadString(const char* ptr, int size,
-                                                  std::string* s) {
+  PROTOBUF_NODISCARD const char* ReadString(const char* ptr, int size,
+                                            std::string* s) {
     if (size <= buffer_end_ + kSlopBytes - ptr) {
       s->assign(ptr, size);
       return ptr + size;
     }
     return ReadStringFallback(ptr, size, s);
   }
-  PROTOBUF_MUST_USE_RESULT const char* AppendString(const char* ptr, int size,
-                                                    std::string* s) {
+  PROTOBUF_NODISCARD const char* AppendString(const char* ptr, int size,
+                                              std::string* s) {
     if (size <= buffer_end_ + kSlopBytes - ptr) {
       s->append(ptr, size);
       return ptr + size;
@@ -168,22 +168,20 @@
     return AppendStringFallback(ptr, size, s);
   }
   // Implemented in arenastring.cc
-  PROTOBUF_MUST_USE_RESULT const char* ReadArenaString(const char* ptr,
-                                                       ArenaStringPtr* s,
-                                                       Arena* arena);
+  PROTOBUF_NODISCARD const char* ReadArenaString(const char* ptr,
+                                                 ArenaStringPtr* s,
+                                                 Arena* arena);
 
   template <typename Tag, typename T>
-  PROTOBUF_MUST_USE_RESULT const char* ReadRepeatedFixed(const char* ptr,
-                                                         Tag expected_tag,
-                                                         RepeatedField<T>* out);
+  PROTOBUF_NODISCARD const char* ReadRepeatedFixed(const char* ptr,
+                                                   Tag expected_tag,
+                                                   RepeatedField<T>* out);
 
   template <typename T>
-  PROTOBUF_MUST_USE_RESULT const char* ReadPackedFixed(const char* ptr,
-                                                       int size,
-                                                       RepeatedField<T>* out);
+  PROTOBUF_NODISCARD const char* ReadPackedFixed(const char* ptr, int size,
+                                                 RepeatedField<T>* out);
   template <typename Add>
-  PROTOBUF_MUST_USE_RESULT const char* ReadPackedVarint(const char* ptr,
-                                                        Add add);
+  PROTOBUF_NODISCARD const char* ReadPackedVarint(const char* ptr, Add add);
 
   uint32_t LastTag() const { return last_tag_minus_1_ + 1; }
   bool ConsumeEndGroup(uint32_t start_tag) {
@@ -364,8 +362,8 @@
     return end;
   }
 
-  PROTOBUF_MUST_USE_RESULT const char* AppendString(const char* ptr,
-                                                    std::string* str) {
+  PROTOBUF_NODISCARD const char* AppendString(const char* ptr,
+                                              std::string* str) {
     return AppendUntilEnd(
         ptr, [str](const char* p, ptrdiff_t s) { str->append(p, s); });
   }
@@ -407,10 +405,10 @@
   template <typename T,
             typename std::enable_if<!std::is_base_of<MessageLite, T>::value,
                                     bool>::type = true>
-  PROTOBUF_MUST_USE_RESULT const char* ParseMessage(T* msg, const char* ptr);
+  PROTOBUF_NODISCARD const char* ParseMessage(T* msg, const char* ptr);
 
   template <typename T>
-  PROTOBUF_MUST_USE_RESULT PROTOBUF_NDEBUG_INLINE const char* ParseGroup(
+  PROTOBUF_NODISCARD PROTOBUF_NDEBUG_INLINE const char* ParseGroup(
       T* msg, const char* ptr, uint32_t tag) {
     if (--depth_ < 0) return nullptr;
     group_depth_++;
@@ -430,8 +428,8 @@
   //   if (!ptr) return nullptr;
   //   int old = PushLimit(ptr, size);
   //   if (--depth_ < 0) return nullptr;
-  PROTOBUF_MUST_USE_RESULT const char* ReadSizeAndPushLimitAndDepth(
-      const char* ptr, int* old_limit);
+  PROTOBUF_NODISCARD const char* ReadSizeAndPushLimitAndDepth(const char* ptr,
+                                                              int* old_limit);
 
   // The context keeps an internal stack to keep track of the recursive
   // part of the parse state.
@@ -526,7 +524,7 @@
 }
 
 template <typename T>
-PROTOBUF_MUST_USE_RESULT const char* VarintParse(const char* p, T* out) {
+PROTOBUF_NODISCARD const char* VarintParse(const char* p, T* out) {
   auto ptr = reinterpret_cast<const uint8_t*>(p);
   uint32_t res = ptr[0];
   if (!(res & 0x80)) {
@@ -660,8 +658,8 @@
 
 template <typename T, typename std::enable_if<
                           !std::is_base_of<MessageLite, T>::value, bool>::type>
-PROTOBUF_MUST_USE_RESULT const char* ParseContext::ParseMessage(
-    T* msg, const char* ptr) {
+PROTOBUF_NODISCARD const char* ParseContext::ParseMessage(T* msg,
+                                                          const char* ptr) {
   int old;
   ptr = ReadSizeAndPushLimitAndDepth(ptr, &old);
   ptr = ptr ? msg->_InternalParse(ptr, this) : nullptr;
@@ -682,9 +680,22 @@
   return ptr;
 }
 
+// Add any of the following lines to debug which parse function is failing.
+
+#define GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, ret) \
+  if (!(predicate)) {                                  \
+    /*  ::raise(SIGINT);  */                           \
+    /*  GOOGLE_LOG(ERROR) << "Parse failure";  */             \
+    return ret;                                        \
+  }
+
+#define GOOGLE_PROTOBUF_PARSER_ASSERT(predicate) \
+  GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, nullptr)
+
 template <typename T>
 const char* EpsCopyInputStream::ReadPackedFixed(const char* ptr, int size,
                                                 RepeatedField<T>* out) {
+  GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
   int nbytes = buffer_end_ + kSlopBytes - ptr;
   while (size > nbytes) {
     int num = nbytes / sizeof(T);
@@ -734,7 +745,7 @@
 template <typename Add>
 const char* EpsCopyInputStream::ReadPackedVarint(const char* ptr, Add add) {
   int size = ReadSize(&ptr);
-  if (ptr == nullptr) return nullptr;
+  GOOGLE_PROTOBUF_PARSER_ASSERT(ptr);
   int chunk_size = buffer_end_ - ptr;
   while (size > chunk_size) {
     ptr = ReadPackedVarintArray(ptr, buffer_end_, add);
@@ -776,26 +787,13 @@
 }
 
 // All the string parsers with or without UTF checking and for all CTypes.
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* InlineGreedyStringParser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* InlineGreedyStringParser(
     std::string* s, const char* ptr, ParseContext* ctx);
 
 
-// Add any of the following lines to debug which parse function is failing.
-
-#define GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, ret) \
-  if (!(predicate)) {                                  \
-    /*  ::raise(SIGINT);  */                           \
-    /*  GOOGLE_LOG(ERROR) << "Parse failure";  */             \
-    return ret;                                        \
-  }
-
-#define GOOGLE_PROTOBUF_PARSER_ASSERT(predicate) \
-  GOOGLE_PROTOBUF_ASSERT_RETURN(predicate, nullptr)
-
 template <typename T>
-PROTOBUF_MUST_USE_RESULT const char* FieldParser(uint64_t tag, T& field_parser,
-                                                 const char* ptr,
-                                                 ParseContext* ctx) {
+PROTOBUF_NODISCARD const char* FieldParser(uint64_t tag, T& field_parser,
+                                           const char* ptr, ParseContext* ctx) {
   uint32_t number = tag >> 3;
   GOOGLE_PROTOBUF_PARSER_ASSERT(number != 0);
   using WireType = internal::WireFormatLite::WireType;
@@ -840,9 +838,9 @@
 }
 
 template <typename T>
-PROTOBUF_MUST_USE_RESULT const char* WireFormatParser(T& field_parser,
-                                                      const char* ptr,
-                                                      ParseContext* ctx) {
+PROTOBUF_NODISCARD const char* WireFormatParser(T& field_parser,
+                                                const char* ptr,
+                                                ParseContext* ctx) {
   while (!ctx->Done(&ptr)) {
     uint32_t tag;
     ptr = ReadTag(ptr, &tag);
@@ -861,25 +859,27 @@
 // corresponding field
 
 // These are packed varints
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedInt32Parser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedInt32Parser(
     void* object, const char* ptr, ParseContext* ctx);
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedUInt32Parser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedUInt32Parser(
     void* object, const char* ptr, ParseContext* ctx);
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedInt64Parser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedInt64Parser(
     void* object, const char* ptr, ParseContext* ctx);
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedUInt64Parser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedUInt64Parser(
     void* object, const char* ptr, ParseContext* ctx);
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedSInt32Parser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedSInt32Parser(
     void* object, const char* ptr, ParseContext* ctx);
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedSInt64Parser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedSInt64Parser(
     void* object, const char* ptr, ParseContext* ctx);
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedEnumParser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedEnumParser(
     void* object, const char* ptr, ParseContext* ctx);
 
 template <typename T>
-PROTOBUF_MUST_USE_RESULT const char* PackedEnumParser(
-    void* object, const char* ptr, ParseContext* ctx, bool (*is_valid)(int),
-    InternalMetadata* metadata, int field_num) {
+PROTOBUF_NODISCARD const char* PackedEnumParser(void* object, const char* ptr,
+                                                ParseContext* ctx,
+                                                bool (*is_valid)(int),
+                                                InternalMetadata* metadata,
+                                                int field_num) {
   return ctx->ReadPackedVarint(
       ptr, [object, is_valid, metadata, field_num](uint64_t val) {
         if (is_valid(val)) {
@@ -891,7 +891,7 @@
 }
 
 template <typename T>
-PROTOBUF_MUST_USE_RESULT const char* PackedEnumParserArg(
+PROTOBUF_NODISCARD const char* PackedEnumParserArg(
     void* object, const char* ptr, ParseContext* ctx,
     bool (*is_valid)(const void*, int), const void* data,
     InternalMetadata* metadata, int field_num) {
@@ -905,28 +905,28 @@
       });
 }
 
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedBoolParser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedBoolParser(
     void* object, const char* ptr, ParseContext* ctx);
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedFixed32Parser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedFixed32Parser(
     void* object, const char* ptr, ParseContext* ctx);
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedSFixed32Parser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedSFixed32Parser(
     void* object, const char* ptr, ParseContext* ctx);
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedFixed64Parser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedFixed64Parser(
     void* object, const char* ptr, ParseContext* ctx);
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedSFixed64Parser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedSFixed64Parser(
     void* object, const char* ptr, ParseContext* ctx);
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedFloatParser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedFloatParser(
     void* object, const char* ptr, ParseContext* ctx);
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* PackedDoubleParser(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* PackedDoubleParser(
     void* object, const char* ptr, ParseContext* ctx);
 
 // This is the only recursive parser.
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* UnknownGroupLiteParse(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* UnknownGroupLiteParse(
     std::string* unknown, const char* ptr, ParseContext* ctx);
 // This is a helper to for the UnknownGroupLiteParse but is actually also
 // useful in the generated code. It uses overload on std::string* vs
 // UnknownFieldSet* to make the generated code isomorphic between full and lite.
-PROTOBUF_EXPORT PROTOBUF_MUST_USE_RESULT const char* UnknownFieldParse(
+PROTOBUF_EXPORT PROTOBUF_NODISCARD const char* UnknownFieldParse(
     uint32_t tag, std::string* unknown, const char* ptr, ParseContext* ctx);
 
 }  // namespace internal
diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
index 01384c8..37632cf 100644
--- a/src/google/protobuf/port_def.inc
+++ b/src/google/protobuf/port_def.inc
@@ -153,17 +153,17 @@
 #ifdef PROTOBUF_VERSION
 #error PROTOBUF_VERSION was previously defined
 #endif
-#define PROTOBUF_VERSION 3018001
+#define PROTOBUF_VERSION 3019004
 
 #ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC
 #error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined
 #endif
-#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3018000
+#define PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC 3019000
 
 #ifdef PROTOBUF_MIN_PROTOC_VERSION
 #error PROTOBUF_MIN_PROTOC_VERSION was previously defined
 #endif
-#define PROTOBUF_MIN_PROTOC_VERSION 3018000
+#define PROTOBUF_MIN_PROTOC_VERSION 3019000
 
 #ifdef PROTOBUF_VERSION_SUFFIX
 #error PROTOBUF_VERSION_SUFFIX was previously defined
@@ -293,7 +293,12 @@
 #ifdef PROTOBUF_SECTION_VARIABLE
 #error PROTOBUF_SECTION_VARIABLE was previously defined
 #endif
-#define PROTOBUF_SECTION_VARIABLE(x)
+#if (__has_attribute(section) || defined(__GNUC__)) && defined(__ELF__)
+// Place a variable in the given ELF section.
+# define PROTOBUF_SECTION_VARIABLE(x) __attribute__((section(#x)))
+#else
+# define PROTOBUF_SECTION_VARIABLE(x)
+#endif
 
 #if defined(PROTOBUF_DEPRECATED)
 #error PROTOBUF_DEPRECATED was previously defined
@@ -351,7 +356,7 @@
 
 // The minimum library version which works with the current version of the
 // headers.
-#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3018000
+#define GOOGLE_PROTOBUF_MIN_LIBRARY_VERSION 3019000
 
 #ifdef PROTOBUF_RTTI
 #error PROTOBUF_RTTI was previously defined
@@ -395,7 +400,7 @@
 // choose 16 rather than some other number just in case the compiler would
 // be confused by an unaligned pointer.
 #define PROTOBUF_FIELD_OFFSET(TYPE, FIELD)                                \
-  static_cast< ::google::protobuf::uint32>(reinterpret_cast<const char*>(                   \
+  static_cast< ::uint32_t>(reinterpret_cast<const char*>(                   \
                              &reinterpret_cast<const TYPE*>(16)->FIELD) - \
                          reinterpret_cast<const char*>(16))
 #endif
@@ -451,10 +456,16 @@
 # define PROTOBUF_PREDICT_FALSE(x) (x)
 #endif
 
-#ifdef PROTOBUF_MUST_USE_RESULT
-#error PROTOBUF_MUST_USE_RESULT was previously defined
+#ifdef PROTOBUF_NODISCARD
+#error PROTOBUF_NODISCARD was previously defined
 #endif
-# define PROTOBUF_MUST_USE_RESULT
+#if __has_cpp_attribute(nodiscard)
+#define PROTOBUF_NODISCARD [[nodiscard]]
+#elif __has_attribute(warn_unused_result) || PROTOBUF_GNUC_MIN(4, 8)
+#define PROTOBUF_NODISCARD __attribute__((warn_unused_result))
+#else
+#define PROTOBUF_NODISCARD
+#endif
 
 #ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
 #error PROTOBUF_FORCE_COPY_IN_RELEASE was previously defined
@@ -468,6 +479,12 @@
 #error PROTOBUF_FORCE_COPY_IN_MOVE was previously defined
 #endif
 
+// Force copy the default string to a string field so that non-optimized builds
+// have harder-to-rely-on address stability.
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+#error PROTOBUF_FORCE_COPY_DEFAULT_STRING was previously defined
+#endif
+
 #ifdef PROTOBUF_FALLTHROUGH_INTENDED
 #error PROTOBUF_FALLTHROUGH_INTENDED was previously defined
 #endif
@@ -562,7 +579,8 @@
 // https://github.com/protocolbuffers/protobuf/issues/8310
 // Does not work yet with Visual Studio 2019 Update 16.10
 #define PROTOBUF_CONSTINIT constinit
-#elif __has_cpp_attribute(clang::require_constant_initialization)
+#elif !defined(_MSC_VER) && \
+    __has_cpp_attribute(clang::require_constant_initialization)
 #define PROTOBUF_CONSTINIT [[clang::require_constant_initialization]]
 #else
 #define PROTOBUF_CONSTINIT
@@ -590,7 +608,7 @@
 #ifdef PROTOBUF_ATTRIBUTE_INIT_PRIORITY
 #error PROTOBUF_ATTRIBUTE_INIT_PRIORITY was previously defined
 #endif
-#if PROTOBUF_GNUC_MIN(3, 0) && (!defined(__APPLE__) || defined(__clang__))
+#if PROTOBUF_GNUC_MIN(3, 0) && (!defined(__APPLE__) || defined(__clang__)) && !((defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__)))
 #define PROTOBUF_ATTRIBUTE_INIT_PRIORITY __attribute__((init_priority((102))))
 #else
 #define PROTOBUF_ATTRIBUTE_INIT_PRIORITY
@@ -640,8 +658,17 @@
 #    define PROTOBUF_MSAN 1
 #  endif
 #elif PROTOBUF_GNUC_MIN(3, 0)
-#  define PROTOBUF_ASAN __SANITIZE_ADDRESS__
-#  define PROTOBUF_TSAN __SANITIZE_THREAD__
+// Double-guard is needed for -Wundef:
+#  ifdef __SANITIZE_ADDRESS__
+#  if    __SANITIZE_ADDRESS__
+#    define PROTOBUF_ASAN 1
+#  endif
+#  endif
+#  ifdef __SANITIZE_THREAD__
+#  if    __SANITIZE_THREAD__
+#    define PROTOBUF_TSAN 1
+#  endif
+#  endif
 #endif
 
 // Tail call table-driven parsing can be enabled by defining
@@ -670,7 +697,7 @@
 #define PROTOBUF_TC_PARAM_DECL                                 \
   ::google::protobuf::MessageLite *msg, const char *ptr,                 \
       ::google::protobuf::internal::ParseContext *ctx,                   \
-      const ::google::protobuf::internal::TailCallParseTableBase *table, \
+      const ::google::protobuf::internal::TcParseTableBase *table,       \
       uint64_t hasbits, ::google::protobuf::internal::TcFieldData data
 
 #ifdef PROTOBUF_UNUSED
@@ -766,6 +793,10 @@
 #pragma warning(disable : 4073)
 // To silence the fact that we will pop this push from another file
 #pragma warning(disable : 5031)
+// Conditional expression is constant
+#pragma warning(disable: 4127)
+// decimal digit terminates octal escape sequence
+#pragma warning(disable: 4125)
 #endif
 
 // We don't want code outside port_def doing complex testing, so
diff --git a/src/google/protobuf/port_undef.inc b/src/google/protobuf/port_undef.inc
index 5fef6e4..579eb41 100644
--- a/src/google/protobuf/port_undef.inc
+++ b/src/google/protobuf/port_undef.inc
@@ -63,10 +63,11 @@
 #undef PROTOBUF_FALLTHROUGH_INTENDED
 #undef PROTOBUF_EXPORT
 #undef PROTOC_EXPORT
-#undef PROTOBUF_MUST_USE_RESULT
+#undef PROTOBUF_NODISCARD
 #undef PROTOBUF_FORCE_COPY_IN_RELEASE
 #undef PROTOBUF_FORCE_COPY_IN_SWAP
 #undef PROTOBUF_FORCE_COPY_IN_MOVE
+#undef PROTOBUF_FORCE_COPY_DEFAULT_STRING
 #undef PROTOBUF_NAMESPACE_OPEN
 #undef PROTOBUF_NAMESPACE_CLOSE
 #undef PROTOBUF_UNUSED
diff --git a/src/google/protobuf/preserve_unknown_enum_test.cc b/src/google/protobuf/preserve_unknown_enum_test.cc
index ed21a88..7e6bbf1 100644
--- a/src/google/protobuf/preserve_unknown_enum_test.cc
+++ b/src/google/protobuf/preserve_unknown_enum_test.cc
@@ -245,7 +245,7 @@
   // SetRepeatedEnumValue.
   const EnumValueDescriptor* enum_value =
       repeated_field->enum_type()->FindValueByName("BAR");
-  EXPECT_TRUE(enum_value != NULL);
+  EXPECT_TRUE(enum_value != nullptr);
   r->AddEnum(&message, repeated_field, enum_value);
 
   const FieldDescriptor* singular_field =
diff --git a/src/google/protobuf/reflection.h b/src/google/protobuf/reflection.h
index 00be9c0..498ab71 100644
--- a/src/google/protobuf/reflection.h
+++ b/src/google/protobuf/reflection.h
@@ -92,7 +92,7 @@
     const Reflection* reflection = message.GetReflection();
     data_ = reflection->RepeatedFieldData(const_cast<Message*>(&message), field,
                                           internal::RefTypeTraits<T>::cpp_type,
-                                          NULL);
+                                          nullptr);
     accessor_ = reflection->RepeatedFieldAccessor(field);
   }
 
@@ -143,7 +143,7 @@
   MutableRepeatedFieldRef(Message* message, const FieldDescriptor* field) {
     const Reflection* reflection = message->GetReflection();
     data_ = reflection->RepeatedFieldData(
-        message, field, internal::RefTypeTraits<T>::cpp_type, NULL);
+        message, field, internal::RefTypeTraits<T>::cpp_type, nullptr);
     accessor_ = reflection->RepeatedFieldAccessor(field);
   }
 
@@ -504,7 +504,7 @@
   typedef T* IteratorPointerType;
   static constexpr FieldDescriptor::CppType cpp_type =
       PrimitiveTraits<T>::cpp_type;
-  static const Descriptor* GetMessageFieldDescriptor() { return NULL; }
+  static const Descriptor* GetMessageFieldDescriptor() { return nullptr; }
 };
 
 template <typename T>
@@ -518,7 +518,7 @@
   typedef int32_t* IteratorPointerType;
   static constexpr FieldDescriptor::CppType cpp_type =
       FieldDescriptor::CPPTYPE_ENUM;
-  static const Descriptor* GetMessageFieldDescriptor() { return NULL; }
+  static const Descriptor* GetMessageFieldDescriptor() { return nullptr; }
 };
 
 template <typename T>
@@ -531,7 +531,7 @@
   typedef const std::string* IteratorPointerType;
   static constexpr FieldDescriptor::CppType cpp_type =
       FieldDescriptor::CPPTYPE_STRING;
-  static const Descriptor* GetMessageFieldDescriptor() { return NULL; }
+  static const Descriptor* GetMessageFieldDescriptor() { return nullptr; }
 };
 
 template <typename T>
@@ -542,7 +542,7 @@
 };
 template <>
 struct MessageDescriptorGetter<Message> {
-  static const Descriptor* get() { return NULL; }
+  static const Descriptor* get() { return nullptr; }
 };
 
 template <typename T>
diff --git a/src/google/protobuf/reflection_internal.h b/src/google/protobuf/reflection_internal.h
index 3ccf4a0..f749c3e 100644
--- a/src/google/protobuf/reflection_internal.h
+++ b/src/google/protobuf/reflection_internal.h
@@ -43,25 +43,26 @@
 // corresponding random-access methods.
 class RandomAccessRepeatedFieldAccessor : public RepeatedFieldAccessor {
  public:
-  Iterator* BeginIterator(const Field* data) const override {
+  Iterator* BeginIterator(const Field* /*data*/) const override {
     return PositionToIterator(0);
   }
   Iterator* EndIterator(const Field* data) const override {
     return PositionToIterator(this->Size(data));
   }
-  Iterator* CopyIterator(const Field* data,
+  Iterator* CopyIterator(const Field* /*data*/,
                          const Iterator* iterator) const override {
     return const_cast<Iterator*>(iterator);
   }
-  Iterator* AdvanceIterator(const Field* data,
+  Iterator* AdvanceIterator(const Field* /*data*/,
                             Iterator* iterator) const override {
     return PositionToIterator(IteratorToPosition(iterator) + 1);
   }
-  bool EqualsIterator(const Field* data, const Iterator* a,
+  bool EqualsIterator(const Field* /*data*/, const Iterator* a,
                       const Iterator* b) const override {
     return a == b;
   }
-  void DeleteIterator(const Field* data, Iterator* iterator) const override {}
+  void DeleteIterator(const Field* /*data*/,
+                      Iterator* /*iterator*/) const override {}
   const Value* GetIteratorValue(const Field* data, const Iterator* iterator,
                                 Value* scratch_space) const override {
     return Get(data, static_cast<int>(IteratorToPosition(iterator)),
@@ -257,7 +258,7 @@
   // Convert a MapEntry message stored in the underlying MapFieldBase to an
   // object that will be returned by this accessor.
   virtual const Value* ConvertFromEntry(const Message& value,
-                                        Value* scratch_space) const {
+                                        Value* /*scratch_space*/) const {
     return static_cast<const Value*>(&value);
   }
 };
@@ -285,7 +286,7 @@
     return *static_cast<const T*>(value);
   }
   const Value* ConvertFromT(const T& value,
-                            Value* scratch_space) const override {
+                            Value* /*scratch_space*/) const override {
     return static_cast<const Value*>(&value);
   }
 };
@@ -325,7 +326,7 @@
     *result = *static_cast<const std::string*>(value);
   }
   const Value* ConvertFromT(const std::string& value,
-                            Value* scratch_space) const override {
+                            Value* /*scratch_space*/) const override {
     return static_cast<const Value*>(&value);
   }
 };
@@ -352,7 +353,7 @@
     result->CopyFrom(*static_cast<const Message*>(value));
   }
   const Value* ConvertFromT(const Message& value,
-                            Value* scratch_space) const override {
+                            Value* /*scratch_space*/) const override {
     return static_cast<const Value*>(&value);
   }
 };
diff --git a/src/google/protobuf/reflection_ops.cc b/src/google/protobuf/reflection_ops.cc
index 5380797..8f0cfb9 100644
--- a/src/google/protobuf/reflection_ops.cc
+++ b/src/google/protobuf/reflection_ops.cc
@@ -214,9 +214,9 @@
                   reflection->GetMapData(message, field);
               if (map_field->IsMapValid()) {
                 MapIterator it(const_cast<Message*>(&message), field);
-                MapIterator end(const_cast<Message*>(&message), field);
-                for (map_field->MapBegin(&it), map_field->MapEnd(&end);
-                     it != end; ++it) {
+                MapIterator end_map(const_cast<Message*>(&message), field);
+                for (map_field->MapBegin(&it), map_field->MapEnd(&end_map);
+                     it != end_map; ++it) {
                   if (!it.GetValueRef().GetMessageValue().IsInitialized()) {
                     return false;
                   }
diff --git a/src/google/protobuf/repeated_field.cc b/src/google/protobuf/repeated_field.cc
index 501575b..28a7bd3 100644
--- a/src/google/protobuf/repeated_field.cc
+++ b/src/google/protobuf/repeated_field.cc
@@ -38,101 +38,12 @@
 
 #include <google/protobuf/stubs/logging.h>
 #include <google/protobuf/stubs/common.h>
-#include <google/protobuf/implicit_weak_message.h>
 
 #include <google/protobuf/port_def.inc>
 
 namespace google {
 namespace protobuf {
 
-namespace internal {
-
-void** RepeatedPtrFieldBase::InternalExtend(int extend_amount) {
-  int new_size = current_size_ + extend_amount;
-  if (total_size_ >= new_size) {
-    // N.B.: rep_ is non-NULL because extend_amount is always > 0, hence
-    // total_size must be non-zero since it is lower-bounded by new_size.
-    return &rep_->elements[current_size_];
-  }
-  Rep* old_rep = rep_;
-  Arena* arena = GetArena();
-  new_size = std::max(internal::kRepeatedFieldLowerClampLimit,
-                      std::max(total_size_ * 2, new_size));
-  GOOGLE_CHECK_LE(static_cast<int64_t>(new_size),
-           static_cast<int64_t>(
-               (std::numeric_limits<size_t>::max() - kRepHeaderSize) /
-               sizeof(old_rep->elements[0])))
-      << "Requested size is too large to fit into size_t.";
-  size_t bytes = kRepHeaderSize + sizeof(old_rep->elements[0]) * new_size;
-  if (arena == NULL) {
-    rep_ = reinterpret_cast<Rep*>(::operator new(bytes));
-  } else {
-    rep_ = reinterpret_cast<Rep*>(Arena::CreateArray<char>(arena, bytes));
-  }
-#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
-  const int old_total_size = total_size_;
-#endif
-  total_size_ = new_size;
-  if (old_rep && old_rep->allocated_size > 0) {
-    memcpy(rep_->elements, old_rep->elements,
-           old_rep->allocated_size * sizeof(rep_->elements[0]));
-    rep_->allocated_size = old_rep->allocated_size;
-  } else {
-    rep_->allocated_size = 0;
-  }
-  if (arena == NULL) {
-#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
-    const size_t old_size =
-        old_total_size * sizeof(rep_->elements[0]) + kRepHeaderSize;
-    ::operator delete(static_cast<void*>(old_rep), old_size);
-#else
-    ::operator delete(static_cast<void*>(old_rep));
-#endif
-  }
-  return &rep_->elements[current_size_];
-}
-
-void RepeatedPtrFieldBase::Reserve(int new_size) {
-  if (new_size > current_size_) {
-    InternalExtend(new_size - current_size_);
-  }
-}
-
-void* RepeatedPtrFieldBase::AddOutOfLineHelper(void* obj) {
-  if (!rep_ || rep_->allocated_size == total_size_) {
-    InternalExtend(1);  // Equivalent to "Reserve(total_size_ + 1)"
-  }
-  ++rep_->allocated_size;
-  rep_->elements[current_size_++] = obj;
-  return obj;
-}
-
-void RepeatedPtrFieldBase::CloseGap(int start, int num) {
-  if (rep_ == NULL) return;
-  // Close up a gap of "num" elements starting at offset "start".
-  for (int i = start + num; i < rep_->allocated_size; ++i)
-    rep_->elements[i - num] = rep_->elements[i];
-  current_size_ -= num;
-  rep_->allocated_size -= num;
-}
-
-MessageLite* RepeatedPtrFieldBase::AddWeak(const MessageLite* prototype) {
-  if (rep_ != NULL && current_size_ < rep_->allocated_size) {
-    return reinterpret_cast<MessageLite*>(rep_->elements[current_size_++]);
-  }
-  if (!rep_ || rep_->allocated_size == total_size_) {
-    Reserve(total_size_ + 1);
-  }
-  ++rep_->allocated_size;
-  MessageLite* result = prototype
-                            ? prototype->New(arena_)
-                            : Arena::CreateMessage<ImplicitWeakMessage>(arena_);
-  rep_->elements[current_size_++] = result;
-  return result;
-}
-
-}  // namespace internal
-
 
 template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<bool>;
 template class PROTOBUF_EXPORT_TEMPLATE_DEFINE RepeatedField<int32_t>;
diff --git a/src/google/protobuf/repeated_field.h b/src/google/protobuf/repeated_field.h
index 68f6e43..3f362f9 100644
--- a/src/google/protobuf/repeated_field.h
+++ b/src/google/protobuf/repeated_field.h
@@ -42,6 +42,8 @@
 // Typically, clients should not need to access RepeatedField objects directly,
 // but should instead use the accessor functions generated automatically by the
 // protocol compiler.
+//
+// This header covers RepeatedField.
 
 #ifndef GOOGLE_PROTOBUF_REPEATED_FIELD_H__
 #define GOOGLE_PROTOBUF_REPEATED_FIELD_H__
@@ -59,11 +61,10 @@
 
 #include <google/protobuf/stubs/logging.h>
 #include <google/protobuf/stubs/common.h>
+#include <google/protobuf/repeated_ptr_field.h>
 #include <google/protobuf/arena.h>
 #include <google/protobuf/message_lite.h>
 #include <google/protobuf/port.h>
-#include <google/protobuf/stubs/casts.h>
-#include <type_traits>
 
 
 // Must be included last.
@@ -77,16 +78,9 @@
 namespace protobuf {
 
 class Message;
-class Reflection;
-
-template <typename T>
-struct WeakRepeatedPtrField;
 
 namespace internal {
 
-class MergePartialFromCodedStreamHelper;
-class SwapFieldHelper;
-
 // kRepeatedFieldLowerClampLimit is the smallest size that will be allocated
 // when growing a repeated field.
 constexpr int kRepeatedFieldLowerClampLimit = 4;
@@ -98,9 +92,6 @@
 constexpr int kRepeatedFieldUpperClampLimit =
     (std::numeric_limits<int>::max() / 2) + 1;
 
-// A utility function for logging that doesn't need any template types.
-void LogIndexOutOfBounds(int index, int size);
-
 template <typename Iter>
 inline int CalculateReserve(Iter begin, Iter end, std::forward_iterator_tag) {
   return static_cast<int>(std::distance(begin, end));
@@ -213,7 +204,7 @@
   void RemoveLast();
 
   // Extract elements with indices in "[start .. start+num-1]".
-  // Copy them into "elements[0 .. num-1]" if "elements" is not NULL.
+  // Copy them into "elements[0 .. num-1]" if "elements" is not nullptr.
   // Caution: implementation also moves elements with indices [start+num ..].
   // Calling this routine inside a loop can cause quadratic behavior.
   void ExtractSubrange(int start, int num, Element* elements);
@@ -391,7 +382,7 @@
 
   // Internal helper to delete all elements and deallocate the storage.
   void InternalDeallocate(Rep* rep, int size) {
-    if (rep != NULL) {
+    if (rep != nullptr) {
       Element* e = &rep->elements[0];
       if (!std::is_trivial<Element>::value) {
         Element* limit = &rep->elements[size];
@@ -399,7 +390,7 @@
           e->~Element();
         }
       }
-      if (rep->arena == NULL) {
+      if (rep->arena == nullptr) {
 #if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
         const size_t bytes = size * sizeof(*e) + kRepHeaderSize;
         ::operator delete(static_cast<void*>(rep), bytes);
@@ -497,13 +488,6 @@
 };
 
 namespace internal {
-template <typename It>
-class RepeatedPtrIterator;
-template <typename It, typename VoidPtr>
-class RepeatedPtrOverPtrsIterator;
-}  // namespace internal
-
-namespace internal {
 
 // This is a helper template to copy an array of elements efficiently when they
 // have a trivial copy constructor, and correctly otherwise. This really
@@ -517,689 +501,6 @@
 
 }  // namespace internal
 
-namespace internal {
-
-// type-traits helper for RepeatedPtrFieldBase: we only want to invoke
-// arena-related "copy if on different arena" behavior if the necessary methods
-// exist on the contained type. In particular, we rely on MergeFrom() existing
-// as a general proxy for the fact that a copy will work, and we also provide a
-// specific override for std::string*.
-template <typename T>
-struct TypeImplementsMergeBehaviorProbeForMergeFrom {
-  typedef char HasMerge;
-  typedef long HasNoMerge;
-
-  // We accept either of:
-  // - void MergeFrom(const T& other)
-  // - bool MergeFrom(const T& other)
-  //
-  // We mangle these names a bit to avoid compatibility issues in 'unclean'
-  // include environments that may have, e.g., "#define test ..." (yes, this
-  // exists).
-  template <typename U, typename RetType, RetType (U::*)(const U& arg)>
-  struct CheckType;
-  template <typename U>
-  static HasMerge Check(CheckType<U, void, &U::MergeFrom>*);
-  template <typename U>
-  static HasMerge Check(CheckType<U, bool, &U::MergeFrom>*);
-  template <typename U>
-  static HasNoMerge Check(...);
-
-  // Resolves to either std::true_type or std::false_type.
-  typedef std::integral_constant<bool,
-                                 (sizeof(Check<T>(0)) == sizeof(HasMerge))>
-      type;
-};
-
-template <typename T, typename = void>
-struct TypeImplementsMergeBehavior
-    : TypeImplementsMergeBehaviorProbeForMergeFrom<T> {};
-
-
-template <>
-struct TypeImplementsMergeBehavior<std::string> {
-  typedef std::true_type type;
-};
-
-template <typename T>
-struct IsMovable
-    : std::integral_constant<bool, std::is_move_constructible<T>::value &&
-                                       std::is_move_assignable<T>::value> {};
-
-// This is the common base class for RepeatedPtrFields.  It deals only in void*
-// pointers.  Users should not use this interface directly.
-//
-// The methods of this interface correspond to the methods of RepeatedPtrField,
-// but may have a template argument called TypeHandler.  Its signature is:
-//   class TypeHandler {
-//    public:
-//     typedef MyType Type;
-//     static Type* New();
-//     static Type* NewFromPrototype(const Type* prototype,
-//                                       Arena* arena);
-//     static void Delete(Type*);
-//     static void Clear(Type*);
-//     static void Merge(const Type& from, Type* to);
-//
-//     // Only needs to be implemented if SpaceUsedExcludingSelf() is called.
-//     static int SpaceUsedLong(const Type&);
-//   };
-class PROTOBUF_EXPORT RepeatedPtrFieldBase {
- protected:
-  constexpr RepeatedPtrFieldBase();
-  explicit RepeatedPtrFieldBase(Arena* arena);
-  ~RepeatedPtrFieldBase() {
-#ifndef NDEBUG
-    // Try to trigger segfault / asan failure in non-opt builds. If arena_
-    // lifetime has ended before the destructor.
-    if (arena_) (void)arena_->SpaceAllocated();
-#endif
-  }
-
-  // Must be called from destructor.
-  template <typename TypeHandler>
-  void Destroy();
-
-  bool empty() const;
-  int size() const;
-
-  template <typename TypeHandler>
-  const typename TypeHandler::Type& at(int index) const;
-  template <typename TypeHandler>
-  typename TypeHandler::Type& at(int index);
-
-  template <typename TypeHandler>
-  typename TypeHandler::Type* Mutable(int index);
-  template <typename TypeHandler>
-  void Delete(int index);
-  template <typename TypeHandler>
-  typename TypeHandler::Type* Add(typename TypeHandler::Type* prototype = NULL);
-
- public:
-  // The next few methods are public so that they can be called from generated
-  // code when implicit weak fields are used, but they should never be called by
-  // application code.
-
-  template <typename TypeHandler>
-  const typename TypeHandler::Type& Get(int index) const;
-
-  // Creates and adds an element using the given prototype, without introducing
-  // a link-time dependency on the concrete message type. This method is used to
-  // implement implicit weak fields. The prototype may be NULL, in which case an
-  // ImplicitWeakMessage will be used as a placeholder.
-  MessageLite* AddWeak(const MessageLite* prototype);
-
-  template <typename TypeHandler>
-  void Clear();
-
-  template <typename TypeHandler>
-  void MergeFrom(const RepeatedPtrFieldBase& other);
-
-  inline void InternalSwap(RepeatedPtrFieldBase* other);
-
- protected:
-  template <
-      typename TypeHandler,
-      typename std::enable_if<TypeHandler::Movable::value>::type* = nullptr>
-  void Add(typename TypeHandler::Type&& value);
-
-  template <typename TypeHandler>
-  void RemoveLast();
-  template <typename TypeHandler>
-  void CopyFrom(const RepeatedPtrFieldBase& other);
-
-  void CloseGap(int start, int num);
-
-  void Reserve(int new_size);
-
-  int Capacity() const;
-
-  template <typename TypeHandler>
-  static inline typename TypeHandler::Type* copy(
-      typename TypeHandler::Type* value) {
-    auto* new_value = TypeHandler::NewFromPrototype(value, nullptr);
-    TypeHandler::Merge(*value, new_value);
-    return new_value;
-  }
-
-  // Used for constructing iterators.
-  void* const* raw_data() const;
-  void** raw_mutable_data() const;
-
-  template <typename TypeHandler>
-  typename TypeHandler::Type** mutable_data();
-  template <typename TypeHandler>
-  const typename TypeHandler::Type* const* data() const;
-
-  template <typename TypeHandler>
-  PROTOBUF_NDEBUG_INLINE void Swap(RepeatedPtrFieldBase* other);
-
-  void SwapElements(int index1, int index2);
-
-  template <typename TypeHandler>
-  size_t SpaceUsedExcludingSelfLong() const;
-
-  // Advanced memory management --------------------------------------
-
-  // Like Add(), but if there are no cleared objects to use, returns NULL.
-  template <typename TypeHandler>
-  typename TypeHandler::Type* AddFromCleared();
-
-  template <typename TypeHandler>
-  void AddAllocated(typename TypeHandler::Type* value) {
-    typename TypeImplementsMergeBehavior<typename TypeHandler::Type>::type t;
-    AddAllocatedInternal<TypeHandler>(value, t);
-  }
-
-  template <typename TypeHandler>
-  void UnsafeArenaAddAllocated(typename TypeHandler::Type* value);
-
-  template <typename TypeHandler>
-  PROTOBUF_MUST_USE_RESULT typename TypeHandler::Type* ReleaseLast() {
-    typename TypeImplementsMergeBehavior<typename TypeHandler::Type>::type t;
-    return ReleaseLastInternal<TypeHandler>(t);
-  }
-
-  // Releases last element and returns it, but does not do out-of-arena copy.
-  // And just returns the raw pointer to the contained element in the arena.
-  template <typename TypeHandler>
-  typename TypeHandler::Type* UnsafeArenaReleaseLast();
-
-  int ClearedCount() const;
-  template <typename TypeHandler>
-  void AddCleared(typename TypeHandler::Type* value);
-  template <typename TypeHandler>
-  PROTOBUF_MUST_USE_RESULT typename TypeHandler::Type* ReleaseCleared();
-
-  template <typename TypeHandler>
-  void AddAllocatedInternal(typename TypeHandler::Type* value, std::true_type);
-  template <typename TypeHandler>
-  void AddAllocatedInternal(typename TypeHandler::Type* value, std::false_type);
-
-  template <typename TypeHandler>
-  PROTOBUF_NOINLINE void AddAllocatedSlowWithCopy(
-      typename TypeHandler::Type* value, Arena* value_arena, Arena* my_arena);
-  template <typename TypeHandler>
-  PROTOBUF_NOINLINE void AddAllocatedSlowWithoutCopy(
-      typename TypeHandler::Type* value);
-
-  template <typename TypeHandler>
-  typename TypeHandler::Type* ReleaseLastInternal(std::true_type);
-  template <typename TypeHandler>
-  typename TypeHandler::Type* ReleaseLastInternal(std::false_type);
-
-  template <typename TypeHandler>
-  PROTOBUF_NOINLINE void SwapFallback(RepeatedPtrFieldBase* other);
-
-  inline Arena* GetArena() const { return arena_; }
-
- private:
-  static constexpr int kInitialSize = 0;
-  // A few notes on internal representation:
-  //
-  // We use an indirected approach, with struct Rep, to keep
-  // sizeof(RepeatedPtrFieldBase) equivalent to what it was before arena support
-  // was added, namely, 3 8-byte machine words on x86-64. An instance of Rep is
-  // allocated only when the repeated field is non-empty, and it is a
-  // dynamically-sized struct (the header is directly followed by elements[]).
-  // We place arena_ and current_size_ directly in the object to avoid cache
-  // misses due to the indirection, because these fields are checked frequently.
-  // Placing all fields directly in the RepeatedPtrFieldBase instance costs
-  // significant performance for memory-sensitive workloads.
-  Arena* arena_;
-  int current_size_;
-  int total_size_;
-  struct Rep {
-    int allocated_size;
-    // Here we declare a huge array as a way of approximating C's "flexible
-    // array member" feature without relying on undefined behavior.
-    void* elements[(std::numeric_limits<int>::max() - 2 * sizeof(int)) /
-                   sizeof(void*)];
-  };
-  static constexpr size_t kRepHeaderSize = offsetof(Rep, elements);
-  Rep* rep_;
-
-  template <typename TypeHandler>
-  static inline typename TypeHandler::Type* cast(void* element) {
-    return reinterpret_cast<typename TypeHandler::Type*>(element);
-  }
-  template <typename TypeHandler>
-  static inline const typename TypeHandler::Type* cast(const void* element) {
-    return reinterpret_cast<const typename TypeHandler::Type*>(element);
-  }
-
-  // Non-templated inner function to avoid code duplication. Takes a function
-  // pointer to the type-specific (templated) inner allocate/merge loop.
-  void MergeFromInternal(const RepeatedPtrFieldBase& other,
-                         void (RepeatedPtrFieldBase::*inner_loop)(void**,
-                                                                  void**, int,
-                                                                  int));
-
-  template <typename TypeHandler>
-  PROTOBUF_NOINLINE void MergeFromInnerLoop(void** our_elems,
-                                            void** other_elems, int length,
-                                            int already_allocated);
-
-  // Internal helper: extend array space if necessary to contain |extend_amount|
-  // more elements, and return a pointer to the element immediately following
-  // the old list of elements.  This interface factors out common behavior from
-  // Reserve() and MergeFrom() to reduce code size. |extend_amount| must be > 0.
-  void** InternalExtend(int extend_amount);
-
-  // Internal helper for Add: add "obj" as the next element in the
-  // array, including potentially resizing the array with Reserve if
-  // needed
-  void* AddOutOfLineHelper(void* obj);
-
-  // The reflection implementation needs to call protected methods directly,
-  // reinterpreting pointers as being to Message instead of a specific Message
-  // subclass.
-  friend class ::PROTOBUF_NAMESPACE_ID::Reflection;
-  friend class ::PROTOBUF_NAMESPACE_ID::internal::SwapFieldHelper;
-
-  // ExtensionSet stores repeated message extensions as
-  // RepeatedPtrField<MessageLite>, but non-lite ExtensionSets need to implement
-  // SpaceUsedLong(), and thus need to call SpaceUsedExcludingSelfLong()
-  // reinterpreting MessageLite as Message.  ExtensionSet also needs to make use
-  // of AddFromCleared(), which is not part of the public interface.
-  friend class ExtensionSet;
-
-  // The MapFieldBase implementation needs to call protected methods directly,
-  // reinterpreting pointers as being to Message instead of a specific Message
-  // subclass.
-  friend class MapFieldBase;
-  friend class MapFieldBaseStub;
-
-  // The table-driven MergePartialFromCodedStream implementation needs to
-  // operate on RepeatedPtrField<MessageLite>.
-  friend class MergePartialFromCodedStreamHelper;
-  friend class AccessorHelper;
-  template <typename T>
-  friend struct google::protobuf::WeakRepeatedPtrField;
-
-  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPtrFieldBase);
-};
-
-template <typename GenericType>
-class GenericTypeHandler {
- public:
-  typedef GenericType Type;
-  using Movable = IsMovable<GenericType>;
-
-  static inline GenericType* New(Arena* arena) {
-    return Arena::CreateMaybeMessage<Type>(arena);
-  }
-  static inline GenericType* New(Arena* arena, GenericType&& value) {
-    return Arena::Create<GenericType>(arena, std::move(value));
-  }
-  static inline GenericType* NewFromPrototype(const GenericType* prototype,
-                                              Arena* arena = NULL);
-  static inline void Delete(GenericType* value, Arena* arena) {
-    if (arena == NULL) {
-      delete value;
-    }
-  }
-  static inline Arena* GetOwningArena(GenericType* value) {
-    return Arena::GetOwningArena<Type>(value);
-  }
-
-  static inline void Clear(GenericType* value) { value->Clear(); }
-  PROTOBUF_NOINLINE
-  static void Merge(const GenericType& from, GenericType* to);
-  static inline size_t SpaceUsedLong(const GenericType& value) {
-    return value.SpaceUsedLong();
-  }
-};
-
-template <typename GenericType>
-GenericType* GenericTypeHandler<GenericType>::NewFromPrototype(
-    const GenericType* /* prototype */, Arena* arena) {
-  return New(arena);
-}
-template <typename GenericType>
-void GenericTypeHandler<GenericType>::Merge(const GenericType& from,
-                                            GenericType* to) {
-  to->MergeFrom(from);
-}
-
-// NewFromPrototype() and Merge() are not defined inline here, as we will need
-// to do a virtual function dispatch anyways to go from Message* to call
-// New/Merge.
-template <>
-MessageLite* GenericTypeHandler<MessageLite>::NewFromPrototype(
-    const MessageLite* prototype, Arena* arena);
-template <>
-inline Arena* GenericTypeHandler<MessageLite>::GetOwningArena(
-    MessageLite* value) {
-  return value->GetOwningArena();
-}
-template <>
-void GenericTypeHandler<MessageLite>::Merge(const MessageLite& from,
-                                            MessageLite* to);
-template <>
-inline void GenericTypeHandler<std::string>::Clear(std::string* value) {
-  value->clear();
-}
-template <>
-void GenericTypeHandler<std::string>::Merge(const std::string& from,
-                                            std::string* to);
-
-// Message specialization bodies defined in message.cc. This split is necessary
-// to allow proto2-lite (which includes this header) to be independent of
-// Message.
-template <>
-PROTOBUF_EXPORT Message* GenericTypeHandler<Message>::NewFromPrototype(
-    const Message* prototype, Arena* arena);
-template <>
-PROTOBUF_EXPORT Arena* GenericTypeHandler<Message>::GetOwningArena(
-    Message* value);
-
-class StringTypeHandler {
- public:
-  typedef std::string Type;
-  using Movable = IsMovable<Type>;
-
-  static inline std::string* New(Arena* arena) {
-    return Arena::Create<std::string>(arena);
-  }
-  static inline std::string* New(Arena* arena, std::string&& value) {
-    return Arena::Create<std::string>(arena, std::move(value));
-  }
-  static inline std::string* NewFromPrototype(const std::string*,
-                                              Arena* arena) {
-    return New(arena);
-  }
-  static inline Arena* GetOwningArena(std::string*) { return nullptr; }
-  static inline void Delete(std::string* value, Arena* arena) {
-    if (arena == NULL) {
-      delete value;
-    }
-  }
-  static inline void Clear(std::string* value) { value->clear(); }
-  static inline void Merge(const std::string& from, std::string* to) {
-    *to = from;
-  }
-  static size_t SpaceUsedLong(const std::string& value) {
-    return sizeof(value) + StringSpaceUsedExcludingSelfLong(value);
-  }
-};
-
-}  // namespace internal
-
-// RepeatedPtrField is like RepeatedField, but used for repeated strings or
-// Messages.
-template <typename Element>
-class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
- public:
-  constexpr RepeatedPtrField();
-  explicit RepeatedPtrField(Arena* arena);
-
-  RepeatedPtrField(const RepeatedPtrField& other);
-
-  template <typename Iter,
-            typename = typename std::enable_if<std::is_constructible<
-                Element, decltype(*std::declval<Iter>())>::value>::type>
-  RepeatedPtrField(Iter begin, Iter end);
-
-  ~RepeatedPtrField();
-
-  RepeatedPtrField& operator=(const RepeatedPtrField& other);
-
-  RepeatedPtrField(RepeatedPtrField&& other) noexcept;
-  RepeatedPtrField& operator=(RepeatedPtrField&& other) noexcept;
-
-  bool empty() const;
-  int size() const;
-
-  const Element& Get(int index) const;
-  Element* Mutable(int index);
-  Element* Add();
-  void Add(Element&& value);
-  // Append elements in the range [begin, end) after reserving
-  // the appropriate number of elements.
-  template <typename Iter>
-  void Add(Iter begin, Iter end);
-
-  const Element& operator[](int index) const { return Get(index); }
-  Element& operator[](int index) { return *Mutable(index); }
-
-  const Element& at(int index) const;
-  Element& at(int index);
-
-  // Remove the last element in the array.
-  // Ownership of the element is retained by the array.
-  void RemoveLast();
-
-  // Delete elements with indices in the range [start .. start+num-1].
-  // Caution: implementation moves all elements with indices [start+num .. ].
-  // Calling this routine inside a loop can cause quadratic behavior.
-  void DeleteSubrange(int start, int num);
-
-  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear();
-  void MergeFrom(const RepeatedPtrField& other);
-  PROTOBUF_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedPtrField& other);
-
-  // Replaces the contents with RepeatedPtrField(begin, end).
-  template <typename Iter>
-  PROTOBUF_ATTRIBUTE_REINITIALIZES void Assign(Iter begin, Iter end);
-
-  // Reserve space to expand the field to at least the given size.  This only
-  // resizes the pointer array; it doesn't allocate any objects.  If the
-  // array is grown, it will always be at least doubled in size.
-  void Reserve(int new_size);
-
-  int Capacity() const;
-
-  // Gets the underlying array.  This pointer is possibly invalidated by
-  // any add or remove operation.
-  Element** mutable_data();
-  const Element* const* data() const;
-
-  // Swap entire contents with "other". If they are on separate arenas, then
-  // copies data.
-  void Swap(RepeatedPtrField* other);
-
-  // Swap entire contents with "other". Caller should guarantee that either both
-  // fields are on the same arena or both are on the heap. Swapping between
-  // different arenas with this function is disallowed and is caught via
-  // GOOGLE_DCHECK.
-  void UnsafeArenaSwap(RepeatedPtrField* other);
-
-  // Swap two elements.
-  void SwapElements(int index1, int index2);
-
-  // STL-like iterator support
-  typedef internal::RepeatedPtrIterator<Element> iterator;
-  typedef internal::RepeatedPtrIterator<const Element> const_iterator;
-  typedef Element value_type;
-  typedef value_type& reference;
-  typedef const value_type& const_reference;
-  typedef value_type* pointer;
-  typedef const value_type* const_pointer;
-  typedef int size_type;
-  typedef ptrdiff_t difference_type;
-
-  iterator begin();
-  const_iterator begin() const;
-  const_iterator cbegin() const;
-  iterator end();
-  const_iterator end() const;
-  const_iterator cend() const;
-
-  // Reverse iterator support
-  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
-  typedef std::reverse_iterator<iterator> reverse_iterator;
-  reverse_iterator rbegin() { return reverse_iterator(end()); }
-  const_reverse_iterator rbegin() const {
-    return const_reverse_iterator(end());
-  }
-  reverse_iterator rend() { return reverse_iterator(begin()); }
-  const_reverse_iterator rend() const {
-    return const_reverse_iterator(begin());
-  }
-
-  // Custom STL-like iterator that iterates over and returns the underlying
-  // pointers to Element rather than Element itself.
-  typedef internal::RepeatedPtrOverPtrsIterator<Element*, void*>
-      pointer_iterator;
-  typedef internal::RepeatedPtrOverPtrsIterator<const Element* const,
-                                                const void* const>
-      const_pointer_iterator;
-  pointer_iterator pointer_begin();
-  const_pointer_iterator pointer_begin() const;
-  pointer_iterator pointer_end();
-  const_pointer_iterator pointer_end() const;
-
-  // Returns (an estimate of) the number of bytes used by the repeated field,
-  // excluding sizeof(*this).
-  size_t SpaceUsedExcludingSelfLong() const;
-
-  int SpaceUsedExcludingSelf() const {
-    return internal::ToIntSize(SpaceUsedExcludingSelfLong());
-  }
-
-  // Advanced memory management --------------------------------------
-  // When hardcore memory management becomes necessary -- as it sometimes
-  // does here at Google -- the following methods may be useful.
-
-  // Add an already-allocated object, passing ownership to the
-  // RepeatedPtrField.
-  //
-  // Note that some special behavior occurs with respect to arenas:
-  //
-  //   (i) if this field holds submessages, the new submessage will be copied if
-  //   the original is in an arena and this RepeatedPtrField is either in a
-  //   different arena, or on the heap.
-  //   (ii) if this field holds strings, the passed-in string *must* be
-  //   heap-allocated, not arena-allocated. There is no way to dynamically check
-  //   this at runtime, so User Beware.
-  void AddAllocated(Element* value);
-
-  // Remove the last element and return it, passing ownership to the caller.
-  // Requires:  size() > 0
-  //
-  // If this RepeatedPtrField is on an arena, an object copy is required to pass
-  // ownership back to the user (for compatible semantics). Use
-  // UnsafeArenaReleaseLast() if this behavior is undesired.
-  PROTOBUF_MUST_USE_RESULT Element* ReleaseLast();
-
-  // Add an already-allocated object, skipping arena-ownership checks. The user
-  // must guarantee that the given object is in the same arena as this
-  // RepeatedPtrField.
-  // It is also useful in legacy code that uses temporary ownership to avoid
-  // copies. Example:
-  //   RepeatedPtrField<T> temp_field;
-  //   temp_field.UnsafeArenaAddAllocated(new T);
-  //   ... // Do something with temp_field
-  //   temp_field.UnsafeArenaExtractSubrange(0, temp_field.size(), nullptr);
-  // If you put temp_field on the arena this fails, because the ownership
-  // transfers to the arena at the "AddAllocated" call and is not released
-  // anymore causing a double delete. UnsafeArenaAddAllocated prevents this.
-  void UnsafeArenaAddAllocated(Element* value);
-
-  // Remove the last element and return it.  Unlike ReleaseLast, the returned
-  // pointer is always to the original object.  This may be in an arena, and
-  // therefore have the arena's lifetime.
-  // Requires: current_size_ > 0
-  Element* UnsafeArenaReleaseLast();
-
-  // Extract elements with indices in the range "[start .. start+num-1]".
-  // The caller assumes ownership of the extracted elements and is responsible
-  // for deleting them when they are no longer needed.
-  // If "elements" is non-NULL, then pointers to the extracted elements
-  // are stored in "elements[0 .. num-1]" for the convenience of the caller.
-  // If "elements" is NULL, then the caller must use some other mechanism
-  // to perform any further operations (like deletion) on these elements.
-  // Caution: implementation also moves elements with indices [start+num ..].
-  // Calling this routine inside a loop can cause quadratic behavior.
-  //
-  // Memory copying behavior is identical to ReleaseLast(), described above: if
-  // this RepeatedPtrField is on an arena, an object copy is performed for each
-  // returned element, so that all returned element pointers are to
-  // heap-allocated copies. If this copy is not desired, the user should call
-  // UnsafeArenaExtractSubrange().
-  void ExtractSubrange(int start, int num, Element** elements);
-
-  // Identical to ExtractSubrange() described above, except that no object
-  // copies are ever performed. Instead, the raw object pointers are returned.
-  // Thus, if on an arena, the returned objects must not be freed, because they
-  // will not be heap-allocated objects.
-  void UnsafeArenaExtractSubrange(int start, int num, Element** elements);
-
-  // When elements are removed by calls to RemoveLast() or Clear(), they
-  // are not actually freed.  Instead, they are cleared and kept so that
-  // they can be reused later.  This can save lots of CPU time when
-  // repeatedly reusing a protocol message for similar purposes.
-  //
-  // Hardcore programs may choose to manipulate these cleared objects
-  // to better optimize memory management using the following routines.
-
-  // Get the number of cleared objects that are currently being kept
-  // around for reuse.
-  int ClearedCount() const;
-  // Add an element to the pool of cleared objects, passing ownership to
-  // the RepeatedPtrField.  The element must be cleared prior to calling
-  // this method.
-  //
-  // This method cannot be called when the repeated field is on an arena or when
-  // |value| is; both cases will trigger a GOOGLE_DCHECK-failure.
-  void AddCleared(Element* value);
-  // Remove a single element from the cleared pool and return it, passing
-  // ownership to the caller.  The element is guaranteed to be cleared.
-  // Requires:  ClearedCount() > 0
-  //
-  //
-  // This method cannot be called when the repeated field is on an arena; doing
-  // so will trigger a GOOGLE_DCHECK-failure.
-  PROTOBUF_MUST_USE_RESULT Element* ReleaseCleared();
-
-  // Removes the element referenced by position.
-  //
-  // Returns an iterator to the element immediately following the removed
-  // element.
-  //
-  // Invalidates all iterators at or after the removed element, including end().
-  iterator erase(const_iterator position);
-
-  // Removes the elements in the range [first, last).
-  //
-  // Returns an iterator to the element immediately following the removed range.
-  //
-  // Invalidates all iterators at or after the removed range, including end().
-  iterator erase(const_iterator first, const_iterator last);
-
-  // Gets the arena on which this RepeatedPtrField stores its elements.
-  inline Arena* GetArena() const;
-
-  // For internal use only.
-  //
-  // This is public due to it being called by generated code.
-  void InternalSwap(RepeatedPtrField* other) {
-    internal::RepeatedPtrFieldBase::InternalSwap(other);
-  }
-
- private:
-  // Note:  RepeatedPtrField SHOULD NOT be subclassed by users.
-  class TypeHandler;
-
-  // Implementations for ExtractSubrange(). The copying behavior must be
-  // included only if the type supports the necessary operations (e.g.,
-  // MergeFrom()), so we must resolve this at compile time. ExtractSubrange()
-  // uses SFINAE to choose one of the below implementations.
-  void ExtractSubrangeInternal(int start, int num, Element** elements,
-                               std::true_type);
-  void ExtractSubrangeInternal(int start, int num, Element** elements,
-                               std::false_type);
-
-  friend class Arena;
-
-  template <typename T>
-  friend struct WeakRepeatedPtrField;
-
-  typedef void InternalArenaConstructable_;
-
-};
-
 // implementation ====================================================
 
 template <typename Element>
@@ -1430,7 +731,7 @@
   GOOGLE_DCHECK_LE(start + num, this->current_size_);
 
   // Save the values of the removed elements if requested.
-  if (elements != NULL) {
+  if (elements != nullptr) {
     for (int i = 0; i < num; ++i) elements[i] = this->Get(i + start);
   }
 
@@ -1605,7 +906,7 @@
 template <typename Element>
 void RepeatedField<Element>::Reserve(int new_size) {
   if (total_size_ >= new_size) return;
-  Rep* old_rep = total_size_ > 0 ? rep() : NULL;
+  Rep* old_rep = total_size_ > 0 ? rep() : nullptr;
   Rep* new_rep;
   Arena* arena = GetArena();
   new_size = internal::CalculateReserveSize(total_size_, new_size);
@@ -1615,7 +916,7 @@
       << "Requested size is too large to fit into size_t.";
   size_t bytes =
       kRepHeaderSize + sizeof(Element) * static_cast<size_t>(new_size);
-  if (arena == NULL) {
+  if (arena == nullptr) {
     new_rep = static_cast<Rep*>(::operator new(bytes));
   } else {
     new_rep = reinterpret_cast<Rep*>(Arena::CreateArray<char>(arena, bytes));
@@ -1692,1053 +993,6 @@
 
 // -------------------------------------------------------------------
 
-namespace internal {
-
-constexpr RepeatedPtrFieldBase::RepeatedPtrFieldBase()
-    : arena_(NULL), current_size_(0), total_size_(0), rep_(NULL) {}
-
-inline RepeatedPtrFieldBase::RepeatedPtrFieldBase(Arena* arena)
-    : arena_(arena), current_size_(0), total_size_(0), rep_(NULL) {}
-
-template <typename TypeHandler>
-void RepeatedPtrFieldBase::Destroy() {
-  if (rep_ != NULL && arena_ == NULL) {
-    int n = rep_->allocated_size;
-    void* const* elements = rep_->elements;
-    for (int i = 0; i < n; i++) {
-      TypeHandler::Delete(cast<TypeHandler>(elements[i]), NULL);
-    }
-#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
-    const size_t size = total_size_ * sizeof(elements[0]) + kRepHeaderSize;
-    ::operator delete(static_cast<void*>(rep_), size);
-#else
-    ::operator delete(static_cast<void*>(rep_));
-#endif
-  }
-  rep_ = NULL;
-}
-
-template <typename TypeHandler>
-inline void RepeatedPtrFieldBase::Swap(RepeatedPtrFieldBase* other) {
-#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
-  if (GetArena() != nullptr && GetArena() == other->GetArena()) {
-#else   // PROTOBUF_FORCE_COPY_IN_SWAP
-  if (GetArena() == other->GetArena()) {
-#endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
-    InternalSwap(other);
-  } else {
-    SwapFallback<TypeHandler>(other);
-  }
-}
-
-template <typename TypeHandler>
-void RepeatedPtrFieldBase::SwapFallback(RepeatedPtrFieldBase* other) {
-#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
-  GOOGLE_DCHECK(GetArena() == nullptr || other->GetArena() != GetArena());
-#else   // PROTOBUF_FORCE_COPY_IN_SWAP
-  GOOGLE_DCHECK(other->GetArena() != GetArena());
-#endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
-
-  // Copy semantics in this case. We try to improve efficiency by placing the
-  // temporary on |other|'s arena so that messages are copied twice rather than
-  // three times.
-  RepeatedPtrFieldBase temp(other->GetArena());
-  temp.MergeFrom<TypeHandler>(*this);
-  this->Clear<TypeHandler>();
-  this->MergeFrom<TypeHandler>(*other);
-  other->InternalSwap(&temp);
-  temp.Destroy<TypeHandler>();  // Frees rep_ if `other` had no arena.
-}
-
-inline bool RepeatedPtrFieldBase::empty() const { return current_size_ == 0; }
-
-inline int RepeatedPtrFieldBase::size() const { return current_size_; }
-
-template <typename TypeHandler>
-inline const typename TypeHandler::Type& RepeatedPtrFieldBase::Get(
-    int index) const {
-  GOOGLE_DCHECK_GE(index, 0);
-  GOOGLE_DCHECK_LT(index, current_size_);
-  return *cast<TypeHandler>(rep_->elements[index]);
-}
-
-template <typename TypeHandler>
-inline const typename TypeHandler::Type& RepeatedPtrFieldBase::at(
-    int index) const {
-  GOOGLE_CHECK_GE(index, 0);
-  GOOGLE_CHECK_LT(index, current_size_);
-  return *cast<TypeHandler>(rep_->elements[index]);
-}
-
-template <typename TypeHandler>
-inline typename TypeHandler::Type& RepeatedPtrFieldBase::at(int index) {
-  GOOGLE_CHECK_GE(index, 0);
-  GOOGLE_CHECK_LT(index, current_size_);
-  return *cast<TypeHandler>(rep_->elements[index]);
-}
-
-template <typename TypeHandler>
-inline typename TypeHandler::Type* RepeatedPtrFieldBase::Mutable(int index) {
-  GOOGLE_DCHECK_GE(index, 0);
-  GOOGLE_DCHECK_LT(index, current_size_);
-  return cast<TypeHandler>(rep_->elements[index]);
-}
-
-template <typename TypeHandler>
-inline void RepeatedPtrFieldBase::Delete(int index) {
-  GOOGLE_DCHECK_GE(index, 0);
-  GOOGLE_DCHECK_LT(index, current_size_);
-  TypeHandler::Delete(cast<TypeHandler>(rep_->elements[index]), arena_);
-}
-
-template <typename TypeHandler>
-inline typename TypeHandler::Type* RepeatedPtrFieldBase::Add(
-    typename TypeHandler::Type* prototype) {
-  if (rep_ != NULL && current_size_ < rep_->allocated_size) {
-    return cast<TypeHandler>(rep_->elements[current_size_++]);
-  }
-  typename TypeHandler::Type* result =
-      TypeHandler::NewFromPrototype(prototype, arena_);
-  return reinterpret_cast<typename TypeHandler::Type*>(
-      AddOutOfLineHelper(result));
-}
-
-template <typename TypeHandler,
-          typename std::enable_if<TypeHandler::Movable::value>::type*>
-inline void RepeatedPtrFieldBase::Add(typename TypeHandler::Type&& value) {
-  if (rep_ != NULL && current_size_ < rep_->allocated_size) {
-    *cast<TypeHandler>(rep_->elements[current_size_++]) = std::move(value);
-    return;
-  }
-  if (!rep_ || rep_->allocated_size == total_size_) {
-    Reserve(total_size_ + 1);
-  }
-  ++rep_->allocated_size;
-  typename TypeHandler::Type* result =
-      TypeHandler::New(arena_, std::move(value));
-  rep_->elements[current_size_++] = result;
-}
-
-template <typename TypeHandler>
-inline void RepeatedPtrFieldBase::RemoveLast() {
-  GOOGLE_DCHECK_GT(current_size_, 0);
-  TypeHandler::Clear(cast<TypeHandler>(rep_->elements[--current_size_]));
-}
-
-template <typename TypeHandler>
-void RepeatedPtrFieldBase::Clear() {
-  const int n = current_size_;
-  GOOGLE_DCHECK_GE(n, 0);
-  if (n > 0) {
-    void* const* elements = rep_->elements;
-    int i = 0;
-    do {
-      TypeHandler::Clear(cast<TypeHandler>(elements[i++]));
-    } while (i < n);
-    current_size_ = 0;
-  }
-}
-
-// To avoid unnecessary code duplication and reduce binary size, we use a
-// layered approach to implementing MergeFrom(). The toplevel method is
-// templated, so we get a small thunk per concrete message type in the binary.
-// This calls a shared implementation with most of the logic, passing a function
-// pointer to another type-specific piece of code that calls the object-allocate
-// and merge handlers.
-template <typename TypeHandler>
-inline void RepeatedPtrFieldBase::MergeFrom(const RepeatedPtrFieldBase& other) {
-  GOOGLE_DCHECK_NE(&other, this);
-  if (other.current_size_ == 0) return;
-  MergeFromInternal(other,
-                    &RepeatedPtrFieldBase::MergeFromInnerLoop<TypeHandler>);
-}
-
-inline void RepeatedPtrFieldBase::MergeFromInternal(
-    const RepeatedPtrFieldBase& other,
-    void (RepeatedPtrFieldBase::*inner_loop)(void**, void**, int, int)) {
-  // Note: wrapper has already guaranteed that other.rep_ != NULL here.
-  int other_size = other.current_size_;
-  void** other_elements = other.rep_->elements;
-  void** new_elements = InternalExtend(other_size);
-  int allocated_elems = rep_->allocated_size - current_size_;
-  (this->*inner_loop)(new_elements, other_elements, other_size,
-                      allocated_elems);
-  current_size_ += other_size;
-  if (rep_->allocated_size < current_size_) {
-    rep_->allocated_size = current_size_;
-  }
-}
-
-// Merges other_elems to our_elems.
-template <typename TypeHandler>
-void RepeatedPtrFieldBase::MergeFromInnerLoop(void** our_elems,
-                                              void** other_elems, int length,
-                                              int already_allocated) {
-  if (already_allocated < length) {
-    Arena* arena = GetArena();
-    typename TypeHandler::Type* elem_prototype =
-        reinterpret_cast<typename TypeHandler::Type*>(other_elems[0]);
-    for (int i = already_allocated; i < length; i++) {
-      // Allocate a new empty element that we'll merge into below
-      typename TypeHandler::Type* new_elem =
-          TypeHandler::NewFromPrototype(elem_prototype, arena);
-      our_elems[i] = new_elem;
-    }
-  }
-  // Main loop that does the actual merging
-  for (int i = 0; i < length; i++) {
-    // Already allocated: use existing element.
-    typename TypeHandler::Type* other_elem =
-        reinterpret_cast<typename TypeHandler::Type*>(other_elems[i]);
-    typename TypeHandler::Type* new_elem =
-        reinterpret_cast<typename TypeHandler::Type*>(our_elems[i]);
-    TypeHandler::Merge(*other_elem, new_elem);
-  }
-}
-
-template <typename TypeHandler>
-inline void RepeatedPtrFieldBase::CopyFrom(const RepeatedPtrFieldBase& other) {
-  if (&other == this) return;
-  RepeatedPtrFieldBase::Clear<TypeHandler>();
-  RepeatedPtrFieldBase::MergeFrom<TypeHandler>(other);
-}
-
-inline int RepeatedPtrFieldBase::Capacity() const { return total_size_; }
-
-inline void* const* RepeatedPtrFieldBase::raw_data() const {
-  return rep_ ? rep_->elements : NULL;
-}
-
-inline void** RepeatedPtrFieldBase::raw_mutable_data() const {
-  return rep_ ? const_cast<void**>(rep_->elements) : NULL;
-}
-
-template <typename TypeHandler>
-inline typename TypeHandler::Type** RepeatedPtrFieldBase::mutable_data() {
-  // TODO(kenton):  Breaks C++ aliasing rules.  We should probably remove this
-  //   method entirely.
-  return reinterpret_cast<typename TypeHandler::Type**>(raw_mutable_data());
-}
-
-template <typename TypeHandler>
-inline const typename TypeHandler::Type* const* RepeatedPtrFieldBase::data()
-    const {
-  // TODO(kenton):  Breaks C++ aliasing rules.  We should probably remove this
-  //   method entirely.
-  return reinterpret_cast<const typename TypeHandler::Type* const*>(raw_data());
-}
-
-inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) {
-  using std::swap;  // enable ADL with fallback
-  swap(rep_->elements[index1], rep_->elements[index2]);
-}
-
-template <typename TypeHandler>
-inline size_t RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong() const {
-  size_t allocated_bytes = static_cast<size_t>(total_size_) * sizeof(void*);
-  if (rep_ != NULL) {
-    for (int i = 0; i < rep_->allocated_size; ++i) {
-      allocated_bytes +=
-          TypeHandler::SpaceUsedLong(*cast<TypeHandler>(rep_->elements[i]));
-    }
-    allocated_bytes += kRepHeaderSize;
-  }
-  return allocated_bytes;
-}
-
-template <typename TypeHandler>
-inline typename TypeHandler::Type* RepeatedPtrFieldBase::AddFromCleared() {
-  if (rep_ != NULL && current_size_ < rep_->allocated_size) {
-    return cast<TypeHandler>(rep_->elements[current_size_++]);
-  } else {
-    return NULL;
-  }
-}
-
-// AddAllocated version that implements arena-safe copying behavior.
-template <typename TypeHandler>
-void RepeatedPtrFieldBase::AddAllocatedInternal(
-    typename TypeHandler::Type* value, std::true_type) {
-  Arena* element_arena =
-      reinterpret_cast<Arena*>(TypeHandler::GetOwningArena(value));
-  Arena* arena = GetArena();
-  if (arena == element_arena && rep_ && rep_->allocated_size < total_size_) {
-    // Fast path: underlying arena representation (tagged pointer) is equal to
-    // our arena pointer, and we can add to array without resizing it (at least
-    // one slot that is not allocated).
-    void** elems = rep_->elements;
-    if (current_size_ < rep_->allocated_size) {
-      // Make space at [current] by moving first allocated element to end of
-      // allocated list.
-      elems[rep_->allocated_size] = elems[current_size_];
-    }
-    elems[current_size_] = value;
-    current_size_ = current_size_ + 1;
-    rep_->allocated_size = rep_->allocated_size + 1;
-  } else {
-    AddAllocatedSlowWithCopy<TypeHandler>(value, element_arena, arena);
-  }
-}
-
-// Slowpath handles all cases, copying if necessary.
-template <typename TypeHandler>
-void RepeatedPtrFieldBase::AddAllocatedSlowWithCopy(
-    // Pass value_arena and my_arena to avoid duplicate virtual call (value) or
-    // load (mine).
-    typename TypeHandler::Type* value, Arena* value_arena, Arena* my_arena) {
-  // Ensure that either the value is in the same arena, or if not, we do the
-  // appropriate thing: Own() it (if it's on heap and we're in an arena) or copy
-  // it to our arena/heap (otherwise).
-  if (my_arena != NULL && value_arena == NULL) {
-    my_arena->Own(value);
-  } else if (my_arena != value_arena) {
-    typename TypeHandler::Type* new_value =
-        TypeHandler::NewFromPrototype(value, my_arena);
-    TypeHandler::Merge(*value, new_value);
-    TypeHandler::Delete(value, value_arena);
-    value = new_value;
-  }
-
-  UnsafeArenaAddAllocated<TypeHandler>(value);
-}
-
-// AddAllocated version that does not implement arena-safe copying behavior.
-template <typename TypeHandler>
-void RepeatedPtrFieldBase::AddAllocatedInternal(
-    typename TypeHandler::Type* value, std::false_type) {
-  if (rep_ && rep_->allocated_size < total_size_) {
-    // Fast path: underlying arena representation (tagged pointer) is equal to
-    // our arena pointer, and we can add to array without resizing it (at least
-    // one slot that is not allocated).
-    void** elems = rep_->elements;
-    if (current_size_ < rep_->allocated_size) {
-      // Make space at [current] by moving first allocated element to end of
-      // allocated list.
-      elems[rep_->allocated_size] = elems[current_size_];
-    }
-    elems[current_size_] = value;
-    current_size_ = current_size_ + 1;
-    ++rep_->allocated_size;
-  } else {
-    UnsafeArenaAddAllocated<TypeHandler>(value);
-  }
-}
-
-template <typename TypeHandler>
-void RepeatedPtrFieldBase::UnsafeArenaAddAllocated(
-    typename TypeHandler::Type* value) {
-  // Make room for the new pointer.
-  if (!rep_ || current_size_ == total_size_) {
-    // The array is completely full with no cleared objects, so grow it.
-    Reserve(total_size_ + 1);
-    ++rep_->allocated_size;
-  } else if (rep_->allocated_size == total_size_) {
-    // There is no more space in the pointer array because it contains some
-    // cleared objects awaiting reuse.  We don't want to grow the array in this
-    // case because otherwise a loop calling AddAllocated() followed by Clear()
-    // would leak memory.
-    TypeHandler::Delete(cast<TypeHandler>(rep_->elements[current_size_]),
-                        arena_);
-  } else if (current_size_ < rep_->allocated_size) {
-    // We have some cleared objects.  We don't care about their order, so we
-    // can just move the first one to the end to make space.
-    rep_->elements[rep_->allocated_size] = rep_->elements[current_size_];
-    ++rep_->allocated_size;
-  } else {
-    // There are no cleared objects.
-    ++rep_->allocated_size;
-  }
-
-  rep_->elements[current_size_++] = value;
-}
-
-// ReleaseLast() for types that implement merge/copy behavior.
-template <typename TypeHandler>
-inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseLastInternal(
-    std::true_type) {
-  // First, release an element.
-  typename TypeHandler::Type* result = UnsafeArenaReleaseLast<TypeHandler>();
-  // Now perform a copy if we're on an arena.
-  Arena* arena = GetArena();
-
-  typename TypeHandler::Type* new_result;
-#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
-  new_result = copy<TypeHandler>(result);
-  if (arena == nullptr) delete result;
-#else   // PROTOBUF_FORCE_COPY_IN_RELEASE
-  new_result = (arena == nullptr) ? result : copy<TypeHandler>(result);
-#endif  // !PROTOBUF_FORCE_COPY_IN_RELEASE
-  return new_result;
-}
-
-// ReleaseLast() for types that *do not* implement merge/copy behavior -- this
-// is the same as UnsafeArenaReleaseLast(). Note that we GOOGLE_DCHECK-fail if we're on
-// an arena, since the user really should implement the copy operation in this
-// case.
-template <typename TypeHandler>
-inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseLastInternal(
-    std::false_type) {
-  GOOGLE_DCHECK(GetArena() == nullptr)
-      << "ReleaseLast() called on a RepeatedPtrField that is on an arena, "
-      << "with a type that does not implement MergeFrom. This is unsafe; "
-      << "please implement MergeFrom for your type.";
-  return UnsafeArenaReleaseLast<TypeHandler>();
-}
-
-template <typename TypeHandler>
-inline typename TypeHandler::Type*
-RepeatedPtrFieldBase::UnsafeArenaReleaseLast() {
-  GOOGLE_DCHECK_GT(current_size_, 0);
-  typename TypeHandler::Type* result =
-      cast<TypeHandler>(rep_->elements[--current_size_]);
-  --rep_->allocated_size;
-  if (current_size_ < rep_->allocated_size) {
-    // There are cleared elements on the end; replace the removed element
-    // with the last allocated element.
-    rep_->elements[current_size_] = rep_->elements[rep_->allocated_size];
-  }
-  return result;
-}
-
-inline int RepeatedPtrFieldBase::ClearedCount() const {
-  return rep_ ? (rep_->allocated_size - current_size_) : 0;
-}
-
-template <typename TypeHandler>
-inline void RepeatedPtrFieldBase::AddCleared(
-    typename TypeHandler::Type* value) {
-  GOOGLE_DCHECK(GetArena() == NULL)
-      << "AddCleared() can only be used on a RepeatedPtrField not on an arena.";
-  GOOGLE_DCHECK(TypeHandler::GetOwningArena(value) == nullptr)
-      << "AddCleared() can only accept values not on an arena.";
-  if (!rep_ || rep_->allocated_size == total_size_) {
-    Reserve(total_size_ + 1);
-  }
-  rep_->elements[rep_->allocated_size++] = value;
-}
-
-template <typename TypeHandler>
-inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseCleared() {
-  GOOGLE_DCHECK(GetArena() == NULL)
-      << "ReleaseCleared() can only be used on a RepeatedPtrField not on "
-      << "an arena.";
-  GOOGLE_DCHECK(GetArena() == NULL);
-  GOOGLE_DCHECK(rep_ != NULL);
-  GOOGLE_DCHECK_GT(rep_->allocated_size, current_size_);
-  return cast<TypeHandler>(rep_->elements[--rep_->allocated_size]);
-}
-
-}  // namespace internal
-
-// -------------------------------------------------------------------
-
-template <typename Element>
-class RepeatedPtrField<Element>::TypeHandler
-    : public internal::GenericTypeHandler<Element> {};
-
-template <>
-class RepeatedPtrField<std::string>::TypeHandler
-    : public internal::StringTypeHandler {};
-
-template <typename Element>
-constexpr RepeatedPtrField<Element>::RepeatedPtrField()
-    : RepeatedPtrFieldBase() {}
-
-template <typename Element>
-inline RepeatedPtrField<Element>::RepeatedPtrField(Arena* arena)
-    : RepeatedPtrFieldBase(arena) {}
-
-template <typename Element>
-inline RepeatedPtrField<Element>::RepeatedPtrField(
-    const RepeatedPtrField& other)
-    : RepeatedPtrFieldBase() {
-  MergeFrom(other);
-}
-
-template <typename Element>
-template <typename Iter, typename>
-inline RepeatedPtrField<Element>::RepeatedPtrField(Iter begin, Iter end) {
-  Add(begin, end);
-}
-
-template <typename Element>
-RepeatedPtrField<Element>::~RepeatedPtrField() {
-  Destroy<TypeHandler>();
-}
-
-template <typename Element>
-inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=(
-    const RepeatedPtrField& other) {
-  if (this != &other) CopyFrom(other);
-  return *this;
-}
-
-template <typename Element>
-inline RepeatedPtrField<Element>::RepeatedPtrField(
-    RepeatedPtrField&& other) noexcept
-    : RepeatedPtrField() {
-#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
-  CopyFrom(other);
-#else   // PROTOBUF_FORCE_COPY_IN_MOVE
-  // We don't just call Swap(&other) here because it would perform 3 copies if
-  // other is on an arena. This field can't be on an arena because arena
-  // construction always uses the Arena* accepting constructor.
-  if (other.GetArena()) {
-    CopyFrom(other);
-  } else {
-    InternalSwap(&other);
-  }
-#endif  // !PROTOBUF_FORCE_COPY_IN_MOVE
-}
-
-template <typename Element>
-inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=(
-    RepeatedPtrField&& other) noexcept {
-  // We don't just call Swap(&other) here because it would perform 3 copies if
-  // the two fields are on different arenas.
-  if (this != &other) {
-    if (GetArena() != other.GetArena()
-#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
-        || GetArena() == nullptr
-#endif  // !PROTOBUF_FORCE_COPY_IN_MOVE
-    ) {
-      CopyFrom(other);
-    } else {
-      InternalSwap(&other);
-    }
-  }
-  return *this;
-}
-
-template <typename Element>
-inline bool RepeatedPtrField<Element>::empty() const {
-  return RepeatedPtrFieldBase::empty();
-}
-
-template <typename Element>
-inline int RepeatedPtrField<Element>::size() const {
-  return RepeatedPtrFieldBase::size();
-}
-
-template <typename Element>
-inline const Element& RepeatedPtrField<Element>::Get(int index) const {
-  return RepeatedPtrFieldBase::Get<TypeHandler>(index);
-}
-
-template <typename Element>
-inline const Element& RepeatedPtrField<Element>::at(int index) const {
-  return RepeatedPtrFieldBase::at<TypeHandler>(index);
-}
-
-template <typename Element>
-inline Element& RepeatedPtrField<Element>::at(int index) {
-  return RepeatedPtrFieldBase::at<TypeHandler>(index);
-}
-
-
-template <typename Element>
-inline Element* RepeatedPtrField<Element>::Mutable(int index) {
-  return RepeatedPtrFieldBase::Mutable<TypeHandler>(index);
-}
-
-template <typename Element>
-inline Element* RepeatedPtrField<Element>::Add() {
-  return RepeatedPtrFieldBase::Add<TypeHandler>();
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::Add(Element&& value) {
-  RepeatedPtrFieldBase::Add<TypeHandler>(std::move(value));
-}
-
-template <typename Element>
-template <typename Iter>
-inline void RepeatedPtrField<Element>::Add(Iter begin, Iter end) {
-  int reserve = internal::CalculateReserve(begin, end);
-  if (reserve != -1) {
-    Reserve(size() + reserve);
-  }
-  for (; begin != end; ++begin) {
-    *Add() = *begin;
-  }
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::RemoveLast() {
-  RepeatedPtrFieldBase::RemoveLast<TypeHandler>();
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::DeleteSubrange(int start, int num) {
-  GOOGLE_DCHECK_GE(start, 0);
-  GOOGLE_DCHECK_GE(num, 0);
-  GOOGLE_DCHECK_LE(start + num, size());
-  for (int i = 0; i < num; ++i) {
-    RepeatedPtrFieldBase::Delete<TypeHandler>(start + i);
-  }
-  UnsafeArenaExtractSubrange(start, num, nullptr);
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::ExtractSubrange(int start, int num,
-                                                       Element** elements) {
-  typename internal::TypeImplementsMergeBehavior<
-      typename TypeHandler::Type>::type t;
-  ExtractSubrangeInternal(start, num, elements, t);
-}
-
-// ExtractSubrange() implementation for types that implement merge/copy
-// behavior.
-template <typename Element>
-inline void RepeatedPtrField<Element>::ExtractSubrangeInternal(
-    int start, int num, Element** elements, std::true_type) {
-  GOOGLE_DCHECK_GE(start, 0);
-  GOOGLE_DCHECK_GE(num, 0);
-  GOOGLE_DCHECK_LE(start + num, size());
-
-  if (num == 0) return;
-
-  GOOGLE_DCHECK_NE(elements, nullptr)
-      << "Releasing elements without transferring ownership is an unsafe "
-         "operation.  Use UnsafeArenaExtractSubrange.";
-  if (elements == nullptr) {
-    CloseGap(start, num);
-    return;
-  }
-
-  Arena* arena = GetArena();
-#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
-  // Always copy.
-  for (int i = 0; i < num; ++i) {
-    elements[i] = copy<TypeHandler>(
-        RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start));
-  }
-  if (arena == nullptr) {
-    for (int i = 0; i < num; ++i) {
-      delete RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start);
-    }
-  }
-#else   // PROTOBUF_FORCE_COPY_IN_RELEASE
-  // If we're on an arena, we perform a copy for each element so that the
-  // returned elements are heap-allocated. Otherwise, just forward it.
-  if (arena != nullptr) {
-    for (int i = 0; i < num; ++i) {
-      elements[i] = copy<TypeHandler>(
-          RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start));
-    }
-  } else {
-    for (int i = 0; i < num; ++i) {
-      elements[i] = RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start);
-    }
-  }
-#endif  // !PROTOBUF_FORCE_COPY_IN_RELEASE
-  CloseGap(start, num);
-}
-
-// ExtractSubrange() implementation for types that do not implement merge/copy
-// behavior.
-template <typename Element>
-inline void RepeatedPtrField<Element>::ExtractSubrangeInternal(
-    int start, int num, Element** elements, std::false_type) {
-  // This case is identical to UnsafeArenaExtractSubrange(). However, since
-  // ExtractSubrange() must return heap-allocated objects by contract, and we
-  // cannot fulfill this contract if we are an on arena, we must GOOGLE_DCHECK() that
-  // we are not on an arena.
-  GOOGLE_DCHECK(GetArena() == NULL)
-      << "ExtractSubrange() when arena is non-NULL is only supported when "
-      << "the Element type supplies a MergeFrom() operation to make copies.";
-  UnsafeArenaExtractSubrange(start, num, elements);
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::UnsafeArenaExtractSubrange(
-    int start, int num, Element** elements) {
-  GOOGLE_DCHECK_GE(start, 0);
-  GOOGLE_DCHECK_GE(num, 0);
-  GOOGLE_DCHECK_LE(start + num, size());
-
-  if (num > 0) {
-    // Save the values of the removed elements if requested.
-    if (elements != NULL) {
-      for (int i = 0; i < num; ++i) {
-        elements[i] = RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start);
-      }
-    }
-    CloseGap(start, num);
-  }
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::Clear() {
-  RepeatedPtrFieldBase::Clear<TypeHandler>();
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::MergeFrom(
-    const RepeatedPtrField& other) {
-  RepeatedPtrFieldBase::MergeFrom<TypeHandler>(other);
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::CopyFrom(const RepeatedPtrField& other) {
-  RepeatedPtrFieldBase::CopyFrom<TypeHandler>(other);
-}
-
-template <typename Element>
-template <typename Iter>
-inline void RepeatedPtrField<Element>::Assign(Iter begin, Iter end) {
-  Clear();
-  Add(begin, end);
-}
-
-template <typename Element>
-inline typename RepeatedPtrField<Element>::iterator
-RepeatedPtrField<Element>::erase(const_iterator position) {
-  return erase(position, position + 1);
-}
-
-template <typename Element>
-inline typename RepeatedPtrField<Element>::iterator
-RepeatedPtrField<Element>::erase(const_iterator first, const_iterator last) {
-  size_type pos_offset = std::distance(cbegin(), first);
-  size_type last_offset = std::distance(cbegin(), last);
-  DeleteSubrange(pos_offset, last_offset - pos_offset);
-  return begin() + pos_offset;
-}
-
-template <typename Element>
-inline Element** RepeatedPtrField<Element>::mutable_data() {
-  return RepeatedPtrFieldBase::mutable_data<TypeHandler>();
-}
-
-template <typename Element>
-inline const Element* const* RepeatedPtrField<Element>::data() const {
-  return RepeatedPtrFieldBase::data<TypeHandler>();
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::Swap(RepeatedPtrField* other) {
-  if (this == other) return;
-  RepeatedPtrFieldBase::Swap<TypeHandler>(other);
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::UnsafeArenaSwap(
-    RepeatedPtrField* other) {
-  if (this == other) return;
-  RepeatedPtrFieldBase::InternalSwap(other);
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::SwapElements(int index1, int index2) {
-  RepeatedPtrFieldBase::SwapElements(index1, index2);
-}
-
-template <typename Element>
-inline Arena* RepeatedPtrField<Element>::GetArena() const {
-  return RepeatedPtrFieldBase::GetArena();
-}
-
-template <typename Element>
-inline size_t RepeatedPtrField<Element>::SpaceUsedExcludingSelfLong() const {
-  return RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong<TypeHandler>();
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::AddAllocated(Element* value) {
-  RepeatedPtrFieldBase::AddAllocated<TypeHandler>(value);
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::UnsafeArenaAddAllocated(Element* value) {
-  RepeatedPtrFieldBase::UnsafeArenaAddAllocated<TypeHandler>(value);
-}
-
-template <typename Element>
-inline Element* RepeatedPtrField<Element>::ReleaseLast() {
-  return RepeatedPtrFieldBase::ReleaseLast<TypeHandler>();
-}
-
-template <typename Element>
-inline Element* RepeatedPtrField<Element>::UnsafeArenaReleaseLast() {
-  return RepeatedPtrFieldBase::UnsafeArenaReleaseLast<TypeHandler>();
-}
-
-template <typename Element>
-inline int RepeatedPtrField<Element>::ClearedCount() const {
-  return RepeatedPtrFieldBase::ClearedCount();
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::AddCleared(Element* value) {
-  return RepeatedPtrFieldBase::AddCleared<TypeHandler>(value);
-}
-
-template <typename Element>
-inline Element* RepeatedPtrField<Element>::ReleaseCleared() {
-  return RepeatedPtrFieldBase::ReleaseCleared<TypeHandler>();
-}
-
-template <typename Element>
-inline void RepeatedPtrField<Element>::Reserve(int new_size) {
-  return RepeatedPtrFieldBase::Reserve(new_size);
-}
-
-template <typename Element>
-inline int RepeatedPtrField<Element>::Capacity() const {
-  return RepeatedPtrFieldBase::Capacity();
-}
-
-// -------------------------------------------------------------------
-
-namespace internal {
-
-// STL-like iterator implementation for RepeatedPtrField.  You should not
-// refer to this class directly; use RepeatedPtrField<T>::iterator instead.
-//
-// The iterator for RepeatedPtrField<T>, RepeatedPtrIterator<T>, is
-// very similar to iterator_ptr<T**> in util/gtl/iterator_adaptors.h,
-// but adds random-access operators and is modified to wrap a void** base
-// iterator (since RepeatedPtrField stores its array as a void* array and
-// casting void** to T** would violate C++ aliasing rules).
-//
-// This code based on net/proto/proto-array-internal.h by Jeffrey Yasskin
-// (jyasskin@google.com).
-template <typename Element>
-class RepeatedPtrIterator {
- public:
-  using iterator = RepeatedPtrIterator<Element>;
-  using iterator_category = std::random_access_iterator_tag;
-  using value_type = typename std::remove_const<Element>::type;
-  using difference_type = std::ptrdiff_t;
-  using pointer = Element*;
-  using reference = Element&;
-
-  RepeatedPtrIterator() : it_(NULL) {}
-  explicit RepeatedPtrIterator(void* const* it) : it_(it) {}
-
-  // Allow "upcasting" from RepeatedPtrIterator<T**> to
-  // RepeatedPtrIterator<const T*const*>.
-  template <typename OtherElement>
-  RepeatedPtrIterator(const RepeatedPtrIterator<OtherElement>& other)
-      : it_(other.it_) {
-    // Force a compiler error if the other type is not convertible to ours.
-    if (false) {
-      implicit_cast<Element*>(static_cast<OtherElement*>(nullptr));
-    }
-  }
-
-  // dereferenceable
-  reference operator*() const { return *reinterpret_cast<Element*>(*it_); }
-  pointer operator->() const { return &(operator*()); }
-
-  // {inc,dec}rementable
-  iterator& operator++() {
-    ++it_;
-    return *this;
-  }
-  iterator operator++(int) { return iterator(it_++); }
-  iterator& operator--() {
-    --it_;
-    return *this;
-  }
-  iterator operator--(int) { return iterator(it_--); }
-
-  // equality_comparable
-  bool operator==(const iterator& x) const { return it_ == x.it_; }
-  bool operator!=(const iterator& x) const { return it_ != x.it_; }
-
-  // less_than_comparable
-  bool operator<(const iterator& x) const { return it_ < x.it_; }
-  bool operator<=(const iterator& x) const { return it_ <= x.it_; }
-  bool operator>(const iterator& x) const { return it_ > x.it_; }
-  bool operator>=(const iterator& x) const { return it_ >= x.it_; }
-
-  // addable, subtractable
-  iterator& operator+=(difference_type d) {
-    it_ += d;
-    return *this;
-  }
-  friend iterator operator+(iterator it, const difference_type d) {
-    it += d;
-    return it;
-  }
-  friend iterator operator+(const difference_type d, iterator it) {
-    it += d;
-    return it;
-  }
-  iterator& operator-=(difference_type d) {
-    it_ -= d;
-    return *this;
-  }
-  friend iterator operator-(iterator it, difference_type d) {
-    it -= d;
-    return it;
-  }
-
-  // indexable
-  reference operator[](difference_type d) const { return *(*this + d); }
-
-  // random access iterator
-  difference_type operator-(const iterator& x) const { return it_ - x.it_; }
-
- private:
-  template <typename OtherElement>
-  friend class RepeatedPtrIterator;
-
-  // The internal iterator.
-  void* const* it_;
-};
-
-// Provide an iterator that operates on pointers to the underlying objects
-// rather than the objects themselves as RepeatedPtrIterator does.
-// Consider using this when working with stl algorithms that change
-// the array.
-// The VoidPtr template parameter holds the type-agnostic pointer value
-// referenced by the iterator.  It should either be "void *" for a mutable
-// iterator, or "const void* const" for a constant iterator.
-template <typename Element, typename VoidPtr>
-class RepeatedPtrOverPtrsIterator {
- public:
-  using iterator = RepeatedPtrOverPtrsIterator<Element, VoidPtr>;
-  using iterator_category = std::random_access_iterator_tag;
-  using value_type = typename std::remove_const<Element>::type;
-  using difference_type = std::ptrdiff_t;
-  using pointer = Element*;
-  using reference = Element&;
-
-  RepeatedPtrOverPtrsIterator() : it_(NULL) {}
-  explicit RepeatedPtrOverPtrsIterator(VoidPtr* it) : it_(it) {}
-
-  // dereferenceable
-  reference operator*() const { return *reinterpret_cast<Element*>(it_); }
-  pointer operator->() const { return &(operator*()); }
-
-  // {inc,dec}rementable
-  iterator& operator++() {
-    ++it_;
-    return *this;
-  }
-  iterator operator++(int) { return iterator(it_++); }
-  iterator& operator--() {
-    --it_;
-    return *this;
-  }
-  iterator operator--(int) { return iterator(it_--); }
-
-  // equality_comparable
-  bool operator==(const iterator& x) const { return it_ == x.it_; }
-  bool operator!=(const iterator& x) const { return it_ != x.it_; }
-
-  // less_than_comparable
-  bool operator<(const iterator& x) const { return it_ < x.it_; }
-  bool operator<=(const iterator& x) const { return it_ <= x.it_; }
-  bool operator>(const iterator& x) const { return it_ > x.it_; }
-  bool operator>=(const iterator& x) const { return it_ >= x.it_; }
-
-  // addable, subtractable
-  iterator& operator+=(difference_type d) {
-    it_ += d;
-    return *this;
-  }
-  friend iterator operator+(iterator it, difference_type d) {
-    it += d;
-    return it;
-  }
-  friend iterator operator+(difference_type d, iterator it) {
-    it += d;
-    return it;
-  }
-  iterator& operator-=(difference_type d) {
-    it_ -= d;
-    return *this;
-  }
-  friend iterator operator-(iterator it, difference_type d) {
-    it -= d;
-    return it;
-  }
-
-  // indexable
-  reference operator[](difference_type d) const { return *(*this + d); }
-
-  // random access iterator
-  difference_type operator-(const iterator& x) const { return it_ - x.it_; }
-
- private:
-  template <typename OtherElement>
-  friend class RepeatedPtrIterator;
-
-  // The internal iterator.
-  VoidPtr* it_;
-};
-
-void RepeatedPtrFieldBase::InternalSwap(RepeatedPtrFieldBase* other) {
-  GOOGLE_DCHECK(this != other);
-
-  // Swap all fields at once.
-  static_assert(std::is_standard_layout<RepeatedPtrFieldBase>::value,
-                "offsetof() requires standard layout before c++17");
-  internal::memswap<offsetof(RepeatedPtrFieldBase, rep_) + sizeof(this->rep_) -
-                    offsetof(RepeatedPtrFieldBase, arena_)>(
-      reinterpret_cast<char*>(this) + offsetof(RepeatedPtrFieldBase, arena_),
-      reinterpret_cast<char*>(other) + offsetof(RepeatedPtrFieldBase, arena_));
-}
-
-}  // namespace internal
-
-template <typename Element>
-inline typename RepeatedPtrField<Element>::iterator
-RepeatedPtrField<Element>::begin() {
-  return iterator(raw_data());
-}
-template <typename Element>
-inline typename RepeatedPtrField<Element>::const_iterator
-RepeatedPtrField<Element>::begin() const {
-  return iterator(raw_data());
-}
-template <typename Element>
-inline typename RepeatedPtrField<Element>::const_iterator
-RepeatedPtrField<Element>::cbegin() const {
-  return begin();
-}
-template <typename Element>
-inline typename RepeatedPtrField<Element>::iterator
-RepeatedPtrField<Element>::end() {
-  return iterator(raw_data() + size());
-}
-template <typename Element>
-inline typename RepeatedPtrField<Element>::const_iterator
-RepeatedPtrField<Element>::end() const {
-  return iterator(raw_data() + size());
-}
-template <typename Element>
-inline typename RepeatedPtrField<Element>::const_iterator
-RepeatedPtrField<Element>::cend() const {
-  return end();
-}
-
-template <typename Element>
-inline typename RepeatedPtrField<Element>::pointer_iterator
-RepeatedPtrField<Element>::pointer_begin() {
-  return pointer_iterator(raw_mutable_data());
-}
-template <typename Element>
-inline typename RepeatedPtrField<Element>::const_pointer_iterator
-RepeatedPtrField<Element>::pointer_begin() const {
-  return const_pointer_iterator(const_cast<const void* const*>(raw_data()));
-}
-template <typename Element>
-inline typename RepeatedPtrField<Element>::pointer_iterator
-RepeatedPtrField<Element>::pointer_end() {
-  return pointer_iterator(raw_mutable_data() + size());
-}
-template <typename Element>
-inline typename RepeatedPtrField<Element>::const_pointer_iterator
-RepeatedPtrField<Element>::pointer_end() const {
-  return const_pointer_iterator(
-      const_cast<const void* const*>(raw_data() + size()));
-}
-
 // Iterators and helper functions that follow the spirit of the STL
 // std::back_insert_iterator and std::back_inserter but are tailor-made
 // for RepeatedField and RepeatedPtrField. Typical usage would be:
@@ -2776,104 +1030,6 @@
   RepeatedField<T>* field_;
 };
 
-// A back inserter for RepeatedPtrField objects.
-template <typename T>
-class RepeatedPtrFieldBackInsertIterator {
- public:
-  using iterator_category = std::output_iterator_tag;
-  using value_type = T;
-  using pointer = void;
-  using reference = void;
-  using difference_type = std::ptrdiff_t;
-
-  RepeatedPtrFieldBackInsertIterator(RepeatedPtrField<T>* const mutable_field)
-      : field_(mutable_field) {}
-  RepeatedPtrFieldBackInsertIterator<T>& operator=(const T& value) {
-    *field_->Add() = value;
-    return *this;
-  }
-  RepeatedPtrFieldBackInsertIterator<T>& operator=(
-      const T* const ptr_to_value) {
-    *field_->Add() = *ptr_to_value;
-    return *this;
-  }
-  RepeatedPtrFieldBackInsertIterator<T>& operator=(T&& value) {
-    *field_->Add() = std::move(value);
-    return *this;
-  }
-  RepeatedPtrFieldBackInsertIterator<T>& operator*() { return *this; }
-  RepeatedPtrFieldBackInsertIterator<T>& operator++() { return *this; }
-  RepeatedPtrFieldBackInsertIterator<T>& operator++(int /* unused */) {
-    return *this;
-  }
-
- private:
-  RepeatedPtrField<T>* field_;
-};
-
-// A back inserter for RepeatedPtrFields that inserts by transferring ownership
-// of a pointer.
-template <typename T>
-class AllocatedRepeatedPtrFieldBackInsertIterator {
- public:
-  using iterator_category = std::output_iterator_tag;
-  using value_type = T;
-  using pointer = void;
-  using reference = void;
-  using difference_type = std::ptrdiff_t;
-
-  explicit AllocatedRepeatedPtrFieldBackInsertIterator(
-      RepeatedPtrField<T>* const mutable_field)
-      : field_(mutable_field) {}
-  AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator=(
-      T* const ptr_to_value) {
-    field_->AddAllocated(ptr_to_value);
-    return *this;
-  }
-  AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator*() { return *this; }
-  AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++() { return *this; }
-  AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++(int /* unused */) {
-    return *this;
-  }
-
- private:
-  RepeatedPtrField<T>* field_;
-};
-
-// Almost identical to AllocatedRepeatedPtrFieldBackInsertIterator. This one
-// uses the UnsafeArenaAddAllocated instead.
-template <typename T>
-class UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator {
- public:
-  using iterator_category = std::output_iterator_tag;
-  using value_type = T;
-  using pointer = void;
-  using reference = void;
-  using difference_type = std::ptrdiff_t;
-
-  explicit UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator(
-      RepeatedPtrField<T>* const mutable_field)
-      : field_(mutable_field) {}
-  UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator=(
-      T const* const ptr_to_value) {
-    field_->UnsafeArenaAddAllocated(const_cast<T*>(ptr_to_value));
-    return *this;
-  }
-  UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator*() {
-    return *this;
-  }
-  UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++() {
-    return *this;
-  }
-  UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++(
-      int /* unused */) {
-    return *this;
-  }
-
- private:
-  RepeatedPtrField<T>* field_;
-};
-
 }  // namespace internal
 
 // Provides a back insert iterator for RepeatedField instances,
@@ -2884,53 +1040,6 @@
   return internal::RepeatedFieldBackInsertIterator<T>(mutable_field);
 }
 
-// Provides a back insert iterator for RepeatedPtrField instances,
-// similar to std::back_inserter().
-template <typename T>
-internal::RepeatedPtrFieldBackInsertIterator<T> RepeatedPtrFieldBackInserter(
-    RepeatedPtrField<T>* const mutable_field) {
-  return internal::RepeatedPtrFieldBackInsertIterator<T>(mutable_field);
-}
-
-// Special back insert iterator for RepeatedPtrField instances, just in
-// case someone wants to write generic template code that can access both
-// RepeatedFields and RepeatedPtrFields using a common name.
-template <typename T>
-internal::RepeatedPtrFieldBackInsertIterator<T> RepeatedFieldBackInserter(
-    RepeatedPtrField<T>* const mutable_field) {
-  return internal::RepeatedPtrFieldBackInsertIterator<T>(mutable_field);
-}
-
-// Provides a back insert iterator for RepeatedPtrField instances
-// similar to std::back_inserter() which transfers the ownership while
-// copying elements.
-template <typename T>
-internal::AllocatedRepeatedPtrFieldBackInsertIterator<T>
-AllocatedRepeatedPtrFieldBackInserter(
-    RepeatedPtrField<T>* const mutable_field) {
-  return internal::AllocatedRepeatedPtrFieldBackInsertIterator<T>(
-      mutable_field);
-}
-
-// Similar to AllocatedRepeatedPtrFieldBackInserter, using
-// UnsafeArenaAddAllocated instead of AddAllocated.
-// This is slightly faster if that matters. It is also useful in legacy code
-// that uses temporary ownership to avoid copies. Example:
-//   RepeatedPtrField<T> temp_field;
-//   temp_field.UnsafeArenaAddAllocated(new T);
-//   ... // Do something with temp_field
-//   temp_field.UnsafeArenaExtractSubrange(0, temp_field.size(), nullptr);
-// If you put temp_field on the arena this fails, because the ownership
-// transfers to the arena at the "AddAllocated" call and is not released anymore
-// causing a double delete. Using UnsafeArenaAddAllocated prevents this.
-template <typename T>
-internal::UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>
-UnsafeArenaAllocatedRepeatedPtrFieldBackInserter(
-    RepeatedPtrField<T>* const mutable_field) {
-  return internal::UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>(
-      mutable_field);
-}
-
 // Extern declarations of common instantiations to reduce library bloat.
 extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<bool>;
 extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<int32_t>;
@@ -2939,8 +1048,6 @@
 extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<uint64_t>;
 extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<float>;
 extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE RepeatedField<double>;
-extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE
-    RepeatedPtrField<std::string>;
 
 }  // namespace protobuf
 }  // namespace google
diff --git a/src/google/protobuf/repeated_field_reflection_unittest.cc b/src/google/protobuf/repeated_field_reflection_unittest.cc
index 384d32f..63b2349 100644
--- a/src/google/protobuf/repeated_field_reflection_unittest.cc
+++ b/src/google/protobuf/repeated_field_reflection_unittest.cc
@@ -165,7 +165,7 @@
 
   const FieldDescriptor* fd_repeated_int64_extension =
       desc->file()->FindExtensionByName("repeated_int64_extension");
-  GOOGLE_CHECK(fd_repeated_int64_extension != NULL);
+  GOOGLE_CHECK(fd_repeated_int64_extension != nullptr);
 
   const RepeatedField<int64>& rf_int64_extension =
       refl->GetRepeatedField<int64>(extended_message,
@@ -538,7 +538,7 @@
 
   const FieldDescriptor* fd_repeated_int64_extension =
       desc->file()->FindExtensionByName("repeated_int64_extension");
-  GOOGLE_CHECK(fd_repeated_int64_extension != NULL);
+  GOOGLE_CHECK(fd_repeated_int64_extension != nullptr);
 
   const RepeatedFieldRef<int64> rf_int64_extension =
       refl->GetRepeatedFieldRef<int64>(extended_message,
diff --git a/src/google/protobuf/repeated_field_unittest.cc b/src/google/protobuf/repeated_field_unittest.cc
index 5db0b6c..297baee 100644
--- a/src/google/protobuf/repeated_field_unittest.cc
+++ b/src/google/protobuf/repeated_field_unittest.cc
@@ -1140,6 +1140,7 @@
 
   field.Clear();
   EXPECT_EQ(field.ClearedCount(), 2);
+#ifndef PROTOBUF_FUTURE_BREAKING_CHANGES
   EXPECT_EQ(field.ReleaseCleared(), original);  // Take ownership again.
   EXPECT_EQ(field.ClearedCount(), 1);
   EXPECT_NE(field.Add(), original);
@@ -1151,6 +1152,7 @@
   EXPECT_EQ(field.ClearedCount(), 1);
   EXPECT_EQ(field.Add(), original);
   EXPECT_EQ(field.ClearedCount(), 0);
+#endif  // !PROTOBUF_FUTURE_BREAKING_CHANGES
 }
 
 // Test all code paths in AddAllocated().
@@ -1534,7 +1536,7 @@
 
           // Create a catcher array and call ExtractSubrange.
           std::string* catcher[10];
-          for (int i = 0; i < 10; ++i) catcher[i] = NULL;
+          for (int i = 0; i < 10; ++i) catcher[i] = nullptr;
           field.ExtractSubrange(start, num, catcher);
 
           // Does the resulting array have the right size?
@@ -1543,7 +1545,7 @@
           // Were the removed elements extracted into the catcher array?
           for (int i = 0; i < num; ++i)
             EXPECT_EQ(*catcher[i], *subject[start + i]);
-          EXPECT_EQ(NULL, catcher[num]);
+          EXPECT_EQ(nullptr, catcher[num]);
 
           // Does the resulting array contain the right values?
           for (int i = 0; i < start; ++i)
@@ -1908,7 +1910,7 @@
         std::lower_bound(proto_array_.pointer_begin(),
                          proto_array_.pointer_end(), &v, StringLessThan());
 
-    GOOGLE_CHECK(*it != NULL);
+    GOOGLE_CHECK(*it != nullptr);
 
     EXPECT_EQ(**it, "n");
     EXPECT_TRUE(it == proto_array_.pointer_begin() + 3);
@@ -1919,7 +1921,7 @@
         const_proto_array_->pointer_begin(), const_proto_array_->pointer_end(),
         &v, StringLessThan());
 
-    GOOGLE_CHECK(*it != NULL);
+    GOOGLE_CHECK(*it != nullptr);
 
     EXPECT_EQ(**it, "n");
     EXPECT_TRUE(it == const_proto_array_->pointer_begin() + 3);
diff --git a/src/google/protobuf/repeated_ptr_field.cc b/src/google/protobuf/repeated_ptr_field.cc
new file mode 100644
index 0000000..0f0b3e2
--- /dev/null
+++ b/src/google/protobuf/repeated_ptr_field.cc
@@ -0,0 +1,157 @@
+// 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.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+
+#include <google/protobuf/repeated_field.h>
+
+#include <algorithm>
+
+#include <google/protobuf/stubs/logging.h>
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/implicit_weak_message.h>
+
+#include <google/protobuf/port_def.inc>
+
+namespace google {
+namespace protobuf {
+
+namespace internal {
+
+void** RepeatedPtrFieldBase::InternalExtend(int extend_amount) {
+  int new_size = current_size_ + extend_amount;
+  if (total_size_ >= new_size) {
+    // N.B.: rep_ is non-nullptr because extend_amount is always > 0, hence
+    // total_size must be non-zero since it is lower-bounded by new_size.
+    return &rep_->elements[current_size_];
+  }
+  Rep* old_rep = rep_;
+  Arena* arena = GetArena();
+  new_size = std::max(internal::kRepeatedFieldLowerClampLimit,
+                      std::max(total_size_ * 2, new_size));
+  GOOGLE_CHECK_LE(static_cast<int64_t>(new_size),
+           static_cast<int64_t>(
+               (std::numeric_limits<size_t>::max() - kRepHeaderSize) /
+               sizeof(old_rep->elements[0])))
+      << "Requested size is too large to fit into size_t.";
+  size_t bytes = kRepHeaderSize + sizeof(old_rep->elements[0]) * new_size;
+  if (arena == nullptr) {
+    rep_ = reinterpret_cast<Rep*>(::operator new(bytes));
+  } else {
+    rep_ = reinterpret_cast<Rep*>(Arena::CreateArray<char>(arena, bytes));
+  }
+#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
+  const int old_total_size = total_size_;
+#endif
+  total_size_ = new_size;
+  if (old_rep && old_rep->allocated_size > 0) {
+    memcpy(rep_->elements, old_rep->elements,
+           old_rep->allocated_size * sizeof(rep_->elements[0]));
+    rep_->allocated_size = old_rep->allocated_size;
+  } else {
+    rep_->allocated_size = 0;
+  }
+  if (arena == nullptr) {
+#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
+    const size_t old_size =
+        old_total_size * sizeof(rep_->elements[0]) + kRepHeaderSize;
+    ::operator delete(static_cast<void*>(old_rep), old_size);
+#else
+    ::operator delete(static_cast<void*>(old_rep));
+#endif
+  }
+  return &rep_->elements[current_size_];
+}
+
+void RepeatedPtrFieldBase::Reserve(int new_size) {
+  if (new_size > current_size_) {
+    InternalExtend(new_size - current_size_);
+  }
+}
+
+void RepeatedPtrFieldBase::DestroyProtos() {
+  GOOGLE_DCHECK(rep_);
+  GOOGLE_DCHECK(arena_ == nullptr);
+  int n = rep_->allocated_size;
+  void* const* elements = rep_->elements;
+  for (int i = 0; i < n; i++) {
+    delete static_cast<MessageLite*>(elements[i]);
+  }
+#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
+  const size_t size = total_size_ * sizeof(elements[0]) + kRepHeaderSize;
+  ::operator delete(static_cast<void*>(rep_), size);
+  rep_ = nullptr;
+#else
+  ::operator delete(static_cast<void*>(rep_));
+  rep_ = nullptr;
+#endif
+}
+
+void* RepeatedPtrFieldBase::AddOutOfLineHelper(void* obj) {
+  if (!rep_ || rep_->allocated_size == total_size_) {
+    InternalExtend(1);  // Equivalent to "Reserve(total_size_ + 1)"
+  }
+  ++rep_->allocated_size;
+  rep_->elements[current_size_++] = obj;
+  return obj;
+}
+
+void RepeatedPtrFieldBase::CloseGap(int start, int num) {
+  if (rep_ == nullptr) return;
+  // Close up a gap of "num" elements starting at offset "start".
+  for (int i = start + num; i < rep_->allocated_size; ++i)
+    rep_->elements[i - num] = rep_->elements[i];
+  current_size_ -= num;
+  rep_->allocated_size -= num;
+}
+
+MessageLite* RepeatedPtrFieldBase::AddWeak(const MessageLite* prototype) {
+  if (rep_ != nullptr && current_size_ < rep_->allocated_size) {
+    return reinterpret_cast<MessageLite*>(rep_->elements[current_size_++]);
+  }
+  if (!rep_ || rep_->allocated_size == total_size_) {
+    Reserve(total_size_ + 1);
+  }
+  ++rep_->allocated_size;
+  MessageLite* result = prototype
+                            ? prototype->New(arena_)
+                            : Arena::CreateMessage<ImplicitWeakMessage>(arena_);
+  rep_->elements[current_size_++] = result;
+  return result;
+}
+
+}  // namespace internal
+
+}  // namespace protobuf
+}  // namespace google
+
+#include <google/protobuf/port_undef.inc>
diff --git a/src/google/protobuf/repeated_ptr_field.h b/src/google/protobuf/repeated_ptr_field.h
new file mode 100644
index 0000000..7d635e3
--- /dev/null
+++ b/src/google/protobuf/repeated_ptr_field.h
@@ -0,0 +1,2014 @@
+// 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.
+
+// Author: kenton@google.com (Kenton Varda)
+//  Based on original Protocol Buffers design by
+//  Sanjay Ghemawat, Jeff Dean, and others.
+//
+// RepeatedField and RepeatedPtrField are used by generated protocol message
+// classes to manipulate repeated fields.  These classes are very similar to
+// STL's vector, but include a number of optimizations found to be useful
+// specifically in the case of Protocol Buffers.  RepeatedPtrField is
+// particularly different from STL vector as it manages ownership of the
+// pointers that it contains.
+//
+// Typically, clients should not need to access RepeatedField objects directly,
+// but should instead use the accessor functions generated automatically by the
+// protocol compiler.
+//
+// This header covers RepeatedPtrField.
+
+#ifndef GOOGLE_PROTOBUF_REPEATED_PTR_FIELD_H__
+#define GOOGLE_PROTOBUF_REPEATED_PTR_FIELD_H__
+
+#include <utility>
+#ifdef _MSC_VER
+// This is required for min/max on VS2013 only.
+#include <algorithm>
+#endif
+
+#include <iterator>
+#include <limits>
+#include <string>
+#include <type_traits>
+
+#include <google/protobuf/stubs/logging.h>
+#include <google/protobuf/stubs/common.h>
+#include <google/protobuf/arena.h>
+#include <google/protobuf/message_lite.h>
+#include <google/protobuf/port.h>
+
+
+// Must be included last.
+#include <google/protobuf/port_def.inc>
+
+#ifdef SWIG
+#error "You cannot SWIG proto headers"
+#endif
+
+namespace google {
+namespace protobuf {
+
+class Message;
+class Reflection;
+
+template <typename T>
+struct WeakRepeatedPtrField;
+
+namespace internal {
+
+class MergePartialFromCodedStreamHelper;
+class SwapFieldHelper;
+
+
+}  // namespace internal
+
+namespace internal {
+template <typename It>
+class RepeatedPtrIterator;
+template <typename It, typename VoidPtr>
+class RepeatedPtrOverPtrsIterator;
+}  // namespace internal
+
+namespace internal {
+
+// type-traits helper for RepeatedPtrFieldBase: we only want to invoke
+// arena-related "copy if on different arena" behavior if the necessary methods
+// exist on the contained type. In particular, we rely on MergeFrom() existing
+// as a general proxy for the fact that a copy will work, and we also provide a
+// specific override for std::string*.
+template <typename T>
+struct TypeImplementsMergeBehaviorProbeForMergeFrom {
+  typedef char HasMerge;
+  typedef long HasNoMerge;
+
+  // We accept either of:
+  // - void MergeFrom(const T& other)
+  // - bool MergeFrom(const T& other)
+  //
+  // We mangle these names a bit to avoid compatibility issues in 'unclean'
+  // include environments that may have, e.g., "#define test ..." (yes, this
+  // exists).
+  template <typename U, typename RetType, RetType (U::*)(const U& arg)>
+  struct CheckType;
+  template <typename U>
+  static HasMerge Check(CheckType<U, void, &U::MergeFrom>*);
+  template <typename U>
+  static HasMerge Check(CheckType<U, bool, &U::MergeFrom>*);
+  template <typename U>
+  static HasNoMerge Check(...);
+
+  // Resolves to either std::true_type or std::false_type.
+  typedef std::integral_constant<bool,
+                                 (sizeof(Check<T>(0)) == sizeof(HasMerge))>
+      type;
+};
+
+template <typename T, typename = void>
+struct TypeImplementsMergeBehavior
+    : TypeImplementsMergeBehaviorProbeForMergeFrom<T> {};
+
+
+template <>
+struct TypeImplementsMergeBehavior<std::string> {
+  typedef std::true_type type;
+};
+
+template <typename T>
+struct IsMovable
+    : std::integral_constant<bool, std::is_move_constructible<T>::value &&
+                                       std::is_move_assignable<T>::value> {};
+
+// This is the common base class for RepeatedPtrFields.  It deals only in void*
+// pointers.  Users should not use this interface directly.
+//
+// The methods of this interface correspond to the methods of RepeatedPtrField,
+// but may have a template argument called TypeHandler.  Its signature is:
+//   class TypeHandler {
+//    public:
+//     typedef MyType Type;
+//     static Type* New();
+//     static Type* NewFromPrototype(const Type* prototype,
+//                                       Arena* arena);
+//     static void Delete(Type*);
+//     static void Clear(Type*);
+//     static void Merge(const Type& from, Type* to);
+//
+//     // Only needs to be implemented if SpaceUsedExcludingSelf() is called.
+//     static int SpaceUsedLong(const Type&);
+//   };
+class PROTOBUF_EXPORT RepeatedPtrFieldBase {
+ protected:
+  constexpr RepeatedPtrFieldBase();
+  explicit RepeatedPtrFieldBase(Arena* arena);
+  ~RepeatedPtrFieldBase() {
+#ifndef NDEBUG
+    // Try to trigger segfault / asan failure in non-opt builds. If arena_
+    // lifetime has ended before the destructor.
+    if (arena_) (void)arena_->SpaceAllocated();
+#endif
+  }
+
+  // Must be called from destructor.
+  template <typename TypeHandler>
+  void Destroy();
+  bool NeedsDestroy() const { return rep_ != nullptr && arena_ == nullptr; }
+  void DestroyProtos();
+
+  bool empty() const;
+  int size() const;
+
+  template <typename TypeHandler>
+  const typename TypeHandler::Type& at(int index) const;
+  template <typename TypeHandler>
+  typename TypeHandler::Type& at(int index);
+
+  template <typename TypeHandler>
+  typename TypeHandler::Type* Mutable(int index);
+  template <typename TypeHandler>
+  void Delete(int index);
+  template <typename TypeHandler>
+  typename TypeHandler::Type* Add(
+      typename TypeHandler::Type* prototype = nullptr);
+
+ public:
+  // The next few methods are public so that they can be called from generated
+  // code when implicit weak fields are used, but they should never be called by
+  // application code.
+
+  template <typename TypeHandler>
+  const typename TypeHandler::Type& Get(int index) const;
+
+  // Creates and adds an element using the given prototype, without introducing
+  // a link-time dependency on the concrete message type. This method is used to
+  // implement implicit weak fields. The prototype may be nullptr, in which case
+  // an ImplicitWeakMessage will be used as a placeholder.
+  MessageLite* AddWeak(const MessageLite* prototype);
+
+  template <typename TypeHandler>
+  void Clear();
+
+  template <typename TypeHandler>
+  void MergeFrom(const RepeatedPtrFieldBase& other);
+
+  inline void InternalSwap(RepeatedPtrFieldBase*);
+
+ protected:
+  template <
+      typename TypeHandler,
+      typename std::enable_if<TypeHandler::Movable::value>::type* = nullptr>
+  void Add(typename TypeHandler::Type&& value);
+
+  template <typename TypeHandler>
+  void RemoveLast();
+  template <typename TypeHandler>
+  void CopyFrom(const RepeatedPtrFieldBase& other);
+
+  void CloseGap(int start, int num);
+
+  void Reserve(int new_size);
+
+  int Capacity() const;
+
+  template <typename TypeHandler>
+  static inline typename TypeHandler::Type* copy(
+      typename TypeHandler::Type* value) {
+    auto* new_value = TypeHandler::NewFromPrototype(value, nullptr);
+    TypeHandler::Merge(*value, new_value);
+    return new_value;
+  }
+
+  // Used for constructing iterators.
+  void* const* raw_data() const;
+  void** raw_mutable_data() const;
+
+  template <typename TypeHandler>
+  typename TypeHandler::Type** mutable_data();
+  template <typename TypeHandler>
+  const typename TypeHandler::Type* const* data() const;
+
+  template <typename TypeHandler>
+  PROTOBUF_NDEBUG_INLINE void Swap(RepeatedPtrFieldBase* other);
+
+  void SwapElements(int index1, int index2);
+
+  template <typename TypeHandler>
+  size_t SpaceUsedExcludingSelfLong() const;
+
+  // Advanced memory management --------------------------------------
+
+  // Like Add(), but if there are no cleared objects to use, returns nullptr.
+  template <typename TypeHandler>
+  typename TypeHandler::Type* AddFromCleared();
+
+  template <typename TypeHandler>
+  void AddAllocated(typename TypeHandler::Type* value) {
+    typename TypeImplementsMergeBehavior<typename TypeHandler::Type>::type t;
+    AddAllocatedInternal<TypeHandler>(value, t);
+  }
+
+  template <typename TypeHandler>
+  void UnsafeArenaAddAllocated(typename TypeHandler::Type* value);
+
+  template <typename TypeHandler>
+  PROTOBUF_NODISCARD typename TypeHandler::Type* ReleaseLast() {
+    typename TypeImplementsMergeBehavior<typename TypeHandler::Type>::type t;
+    return ReleaseLastInternal<TypeHandler>(t);
+  }
+
+  // Releases last element and returns it, but does not do out-of-arena copy.
+  // And just returns the raw pointer to the contained element in the arena.
+  template <typename TypeHandler>
+  typename TypeHandler::Type* UnsafeArenaReleaseLast();
+
+  int ClearedCount() const;
+  template <typename TypeHandler>
+  void AddCleared(typename TypeHandler::Type* value);
+  template <typename TypeHandler>
+  PROTOBUF_NODISCARD typename TypeHandler::Type* ReleaseCleared();
+
+  template <typename TypeHandler>
+  void AddAllocatedInternal(typename TypeHandler::Type* value, std::true_type);
+  template <typename TypeHandler>
+  void AddAllocatedInternal(typename TypeHandler::Type* value, std::false_type);
+
+  template <typename TypeHandler>
+  PROTOBUF_NOINLINE void AddAllocatedSlowWithCopy(
+      typename TypeHandler::Type* value, Arena* value_arena, Arena* my_arena);
+  template <typename TypeHandler>
+  PROTOBUF_NOINLINE void AddAllocatedSlowWithoutCopy(
+      typename TypeHandler::Type* value);
+
+  template <typename TypeHandler>
+  typename TypeHandler::Type* ReleaseLastInternal(std::true_type);
+  template <typename TypeHandler>
+  typename TypeHandler::Type* ReleaseLastInternal(std::false_type);
+
+  template <typename TypeHandler>
+  PROTOBUF_NOINLINE void SwapFallback(RepeatedPtrFieldBase* other);
+
+  inline Arena* GetArena() const { return arena_; }
+
+ private:
+  static constexpr int kInitialSize = 0;
+  // A few notes on internal representation:
+  //
+  // We use an indirected approach, with struct Rep, to keep
+  // sizeof(RepeatedPtrFieldBase) equivalent to what it was before arena support
+  // was added, namely, 3 8-byte machine words on x86-64. An instance of Rep is
+  // allocated only when the repeated field is non-empty, and it is a
+  // dynamically-sized struct (the header is directly followed by elements[]).
+  // We place arena_ and current_size_ directly in the object to avoid cache
+  // misses due to the indirection, because these fields are checked frequently.
+  // Placing all fields directly in the RepeatedPtrFieldBase instance costs
+  // significant performance for memory-sensitive workloads.
+  Arena* arena_;
+  int current_size_;
+  int total_size_;
+  struct Rep {
+    int allocated_size;
+    // Here we declare a huge array as a way of approximating C's "flexible
+    // array member" feature without relying on undefined behavior.
+    void* elements[(std::numeric_limits<int>::max() - 2 * sizeof(int)) /
+                   sizeof(void*)];
+  };
+  static constexpr size_t kRepHeaderSize = offsetof(Rep, elements);
+  Rep* rep_;
+
+  template <typename TypeHandler>
+  static inline typename TypeHandler::Type* cast(void* element) {
+    return reinterpret_cast<typename TypeHandler::Type*>(element);
+  }
+  template <typename TypeHandler>
+  static inline const typename TypeHandler::Type* cast(const void* element) {
+    return reinterpret_cast<const typename TypeHandler::Type*>(element);
+  }
+
+  // Non-templated inner function to avoid code duplication. Takes a function
+  // pointer to the type-specific (templated) inner allocate/merge loop.
+  void MergeFromInternal(const RepeatedPtrFieldBase& other,
+                         void (RepeatedPtrFieldBase::*inner_loop)(void**,
+                                                                  void**, int,
+                                                                  int));
+
+  template <typename TypeHandler>
+  PROTOBUF_NOINLINE void MergeFromInnerLoop(void** our_elems,
+                                            void** other_elems, int length,
+                                            int already_allocated);
+
+  // Internal helper: extend array space if necessary to contain |extend_amount|
+  // more elements, and return a pointer to the element immediately following
+  // the old list of elements.  This interface factors out common behavior from
+  // Reserve() and MergeFrom() to reduce code size. |extend_amount| must be > 0.
+  void** InternalExtend(int extend_amount);
+
+  // Internal helper for Add: add "obj" as the next element in the
+  // array, including potentially resizing the array with Reserve if
+  // needed
+  void* AddOutOfLineHelper(void* obj);
+
+  // The reflection implementation needs to call protected methods directly,
+  // reinterpreting pointers as being to Message instead of a specific Message
+  // subclass.
+  friend class ::PROTOBUF_NAMESPACE_ID::Reflection;
+  friend class ::PROTOBUF_NAMESPACE_ID::internal::SwapFieldHelper;
+
+  // ExtensionSet stores repeated message extensions as
+  // RepeatedPtrField<MessageLite>, but non-lite ExtensionSets need to implement
+  // SpaceUsedLong(), and thus need to call SpaceUsedExcludingSelfLong()
+  // reinterpreting MessageLite as Message.  ExtensionSet also needs to make use
+  // of AddFromCleared(), which is not part of the public interface.
+  friend class ExtensionSet;
+
+  // The MapFieldBase implementation needs to call protected methods directly,
+  // reinterpreting pointers as being to Message instead of a specific Message
+  // subclass.
+  friend class MapFieldBase;
+  friend class MapFieldBaseStub;
+
+  // The table-driven MergePartialFromCodedStream implementation needs to
+  // operate on RepeatedPtrField<MessageLite>.
+  friend class MergePartialFromCodedStreamHelper;
+  friend class AccessorHelper;
+  template <typename T>
+  friend struct google::protobuf::WeakRepeatedPtrField;
+
+  GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(RepeatedPtrFieldBase);
+};
+
+template <typename GenericType>
+class GenericTypeHandler {
+ public:
+  typedef GenericType Type;
+  using Movable = IsMovable<GenericType>;
+
+  static inline GenericType* New(Arena* arena) {
+    return Arena::CreateMaybeMessage<Type>(arena);
+  }
+  static inline GenericType* New(Arena* arena, GenericType&& value) {
+    return Arena::Create<GenericType>(arena, std::move(value));
+  }
+  static inline GenericType* NewFromPrototype(const GenericType* prototype,
+                                              Arena* arena = nullptr);
+  static inline void Delete(GenericType* value, Arena* arena) {
+    if (arena == nullptr) {
+      delete value;
+    }
+  }
+  static inline Arena* GetOwningArena(GenericType* value) {
+    return Arena::GetOwningArena<Type>(value);
+  }
+
+  static inline void Clear(GenericType* value) { value->Clear(); }
+  PROTOBUF_NOINLINE
+  static void Merge(const GenericType& from, GenericType* to);
+  static inline size_t SpaceUsedLong(const GenericType& value) {
+    return value.SpaceUsedLong();
+  }
+};
+
+template <typename GenericType>
+GenericType* GenericTypeHandler<GenericType>::NewFromPrototype(
+    const GenericType* /* prototype */, Arena* arena) {
+  return New(arena);
+}
+template <typename GenericType>
+void GenericTypeHandler<GenericType>::Merge(const GenericType& from,
+                                            GenericType* to) {
+  to->MergeFrom(from);
+}
+
+// NewFromPrototype() and Merge() are not defined inline here, as we will need
+// to do a virtual function dispatch anyways to go from Message* to call
+// New/Merge.
+template <>
+MessageLite* GenericTypeHandler<MessageLite>::NewFromPrototype(
+    const MessageLite* prototype, Arena* arena);
+template <>
+inline Arena* GenericTypeHandler<MessageLite>::GetOwningArena(
+    MessageLite* value) {
+  return value->GetOwningArena();
+}
+template <>
+void GenericTypeHandler<MessageLite>::Merge(const MessageLite& from,
+                                            MessageLite* to);
+template <>
+inline void GenericTypeHandler<std::string>::Clear(std::string* value) {
+  value->clear();
+}
+template <>
+void GenericTypeHandler<std::string>::Merge(const std::string& from,
+                                            std::string* to);
+
+// Message specialization bodies defined in message.cc. This split is necessary
+// to allow proto2-lite (which includes this header) to be independent of
+// Message.
+template <>
+PROTOBUF_EXPORT Message* GenericTypeHandler<Message>::NewFromPrototype(
+    const Message* prototype, Arena* arena);
+template <>
+PROTOBUF_EXPORT Arena* GenericTypeHandler<Message>::GetOwningArena(
+    Message* value);
+
+class StringTypeHandler {
+ public:
+  typedef std::string Type;
+  using Movable = IsMovable<Type>;
+
+  static inline std::string* New(Arena* arena) {
+    return Arena::Create<std::string>(arena);
+  }
+  static inline std::string* New(Arena* arena, std::string&& value) {
+    return Arena::Create<std::string>(arena, std::move(value));
+  }
+  static inline std::string* NewFromPrototype(const std::string*,
+                                              Arena* arena) {
+    return New(arena);
+  }
+  static inline Arena* GetOwningArena(std::string*) { return nullptr; }
+  static inline void Delete(std::string* value, Arena* arena) {
+    if (arena == nullptr) {
+      delete value;
+    }
+  }
+  static inline void Clear(std::string* value) { value->clear(); }
+  static inline void Merge(const std::string& from, std::string* to) {
+    *to = from;
+  }
+  static size_t SpaceUsedLong(const std::string& value) {
+    return sizeof(value) + StringSpaceUsedExcludingSelfLong(value);
+  }
+};
+
+}  // namespace internal
+
+// RepeatedPtrField is like RepeatedField, but used for repeated strings or
+// Messages.
+template <typename Element>
+class RepeatedPtrField final : private internal::RepeatedPtrFieldBase {
+ public:
+  constexpr RepeatedPtrField();
+  explicit RepeatedPtrField(Arena* arena);
+
+  RepeatedPtrField(const RepeatedPtrField& other);
+
+  template <typename Iter,
+            typename = typename std::enable_if<std::is_constructible<
+                Element, decltype(*std::declval<Iter>())>::value>::type>
+  RepeatedPtrField(Iter begin, Iter end);
+
+  ~RepeatedPtrField();
+
+  RepeatedPtrField& operator=(const RepeatedPtrField& other);
+
+  RepeatedPtrField(RepeatedPtrField&& other) noexcept;
+  RepeatedPtrField& operator=(RepeatedPtrField&& other) noexcept;
+
+  bool empty() const;
+  int size() const;
+
+  const Element& Get(int index) const;
+  Element* Mutable(int index);
+  Element* Add();
+  void Add(Element&& value);
+  // Append elements in the range [begin, end) after reserving
+  // the appropriate number of elements.
+  template <typename Iter>
+  void Add(Iter begin, Iter end);
+
+  const Element& operator[](int index) const { return Get(index); }
+  Element& operator[](int index) { return *Mutable(index); }
+
+  const Element& at(int index) const;
+  Element& at(int index);
+
+  // Remove the last element in the array.
+  // Ownership of the element is retained by the array.
+  void RemoveLast();
+
+  // Delete elements with indices in the range [start .. start+num-1].
+  // Caution: implementation moves all elements with indices [start+num .. ].
+  // Calling this routine inside a loop can cause quadratic behavior.
+  void DeleteSubrange(int start, int num);
+
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear();
+  void MergeFrom(const RepeatedPtrField& other);
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void CopyFrom(const RepeatedPtrField& other);
+
+  // Replaces the contents with RepeatedPtrField(begin, end).
+  template <typename Iter>
+  PROTOBUF_ATTRIBUTE_REINITIALIZES void Assign(Iter begin, Iter end);
+
+  // Reserve space to expand the field to at least the given size.  This only
+  // resizes the pointer array; it doesn't allocate any objects.  If the
+  // array is grown, it will always be at least doubled in size.
+  void Reserve(int new_size);
+
+  int Capacity() const;
+
+  // Gets the underlying array.  This pointer is possibly invalidated by
+  // any add or remove operation.
+  Element** mutable_data();
+  const Element* const* data() const;
+
+  // Swap entire contents with "other". If they are on separate arenas, then
+  // copies data.
+  void Swap(RepeatedPtrField* other);
+
+  // Swap entire contents with "other". Caller should guarantee that either both
+  // fields are on the same arena or both are on the heap. Swapping between
+  // different arenas with this function is disallowed and is caught via
+  // GOOGLE_DCHECK.
+  void UnsafeArenaSwap(RepeatedPtrField* other);
+
+  // Swap two elements.
+  void SwapElements(int index1, int index2);
+
+  // STL-like iterator support
+  typedef internal::RepeatedPtrIterator<Element> iterator;
+  typedef internal::RepeatedPtrIterator<const Element> const_iterator;
+  typedef Element value_type;
+  typedef value_type& reference;
+  typedef const value_type& const_reference;
+  typedef value_type* pointer;
+  typedef const value_type* const_pointer;
+  typedef int size_type;
+  typedef ptrdiff_t difference_type;
+
+  iterator begin();
+  const_iterator begin() const;
+  const_iterator cbegin() const;
+  iterator end();
+  const_iterator end() const;
+  const_iterator cend() const;
+
+  // Reverse iterator support
+  typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+  typedef std::reverse_iterator<iterator> reverse_iterator;
+  reverse_iterator rbegin() { return reverse_iterator(end()); }
+  const_reverse_iterator rbegin() const {
+    return const_reverse_iterator(end());
+  }
+  reverse_iterator rend() { return reverse_iterator(begin()); }
+  const_reverse_iterator rend() const {
+    return const_reverse_iterator(begin());
+  }
+
+  // Custom STL-like iterator that iterates over and returns the underlying
+  // pointers to Element rather than Element itself.
+  typedef internal::RepeatedPtrOverPtrsIterator<Element*, void*>
+      pointer_iterator;
+  typedef internal::RepeatedPtrOverPtrsIterator<const Element* const,
+                                                const void* const>
+      const_pointer_iterator;
+  pointer_iterator pointer_begin();
+  const_pointer_iterator pointer_begin() const;
+  pointer_iterator pointer_end();
+  const_pointer_iterator pointer_end() const;
+
+  // Returns (an estimate of) the number of bytes used by the repeated field,
+  // excluding sizeof(*this).
+  size_t SpaceUsedExcludingSelfLong() const;
+
+  int SpaceUsedExcludingSelf() const {
+    return internal::ToIntSize(SpaceUsedExcludingSelfLong());
+  }
+
+  // Advanced memory management --------------------------------------
+  // When hardcore memory management becomes necessary -- as it sometimes
+  // does here at Google -- the following methods may be useful.
+
+  // Add an already-allocated object, passing ownership to the
+  // RepeatedPtrField.
+  //
+  // Note that some special behavior occurs with respect to arenas:
+  //
+  //   (i) if this field holds submessages, the new submessage will be copied if
+  //   the original is in an arena and this RepeatedPtrField is either in a
+  //   different arena, or on the heap.
+  //   (ii) if this field holds strings, the passed-in string *must* be
+  //   heap-allocated, not arena-allocated. There is no way to dynamically check
+  //   this at runtime, so User Beware.
+  void AddAllocated(Element* value);
+
+  // Remove the last element and return it, passing ownership to the caller.
+  // Requires:  size() > 0
+  //
+  // If this RepeatedPtrField is on an arena, an object copy is required to pass
+  // ownership back to the user (for compatible semantics). Use
+  // UnsafeArenaReleaseLast() if this behavior is undesired.
+  PROTOBUF_NODISCARD Element* ReleaseLast();
+
+  // Add an already-allocated object, skipping arena-ownership checks. The user
+  // must guarantee that the given object is in the same arena as this
+  // RepeatedPtrField.
+  // It is also useful in legacy code that uses temporary ownership to avoid
+  // copies. Example:
+  //   RepeatedPtrField<T> temp_field;
+  //   temp_field.UnsafeArenaAddAllocated(new T);
+  //   ... // Do something with temp_field
+  //   temp_field.UnsafeArenaExtractSubrange(0, temp_field.size(), nullptr);
+  // If you put temp_field on the arena this fails, because the ownership
+  // transfers to the arena at the "AddAllocated" call and is not released
+  // anymore causing a double delete. UnsafeArenaAddAllocated prevents this.
+  void UnsafeArenaAddAllocated(Element* value);
+
+  // Remove the last element and return it.  Unlike ReleaseLast, the returned
+  // pointer is always to the original object.  This may be in an arena, and
+  // therefore have the arena's lifetime.
+  // Requires: current_size_ > 0
+  Element* UnsafeArenaReleaseLast();
+
+  // Extract elements with indices in the range "[start .. start+num-1]".
+  // The caller assumes ownership of the extracted elements and is responsible
+  // for deleting them when they are no longer needed.
+  // If "elements" is non-nullptr, then pointers to the extracted elements
+  // are stored in "elements[0 .. num-1]" for the convenience of the caller.
+  // If "elements" is nullptr, then the caller must use some other mechanism
+  // to perform any further operations (like deletion) on these elements.
+  // Caution: implementation also moves elements with indices [start+num ..].
+  // Calling this routine inside a loop can cause quadratic behavior.
+  //
+  // Memory copying behavior is identical to ReleaseLast(), described above: if
+  // this RepeatedPtrField is on an arena, an object copy is performed for each
+  // returned element, so that all returned element pointers are to
+  // heap-allocated copies. If this copy is not desired, the user should call
+  // UnsafeArenaExtractSubrange().
+  void ExtractSubrange(int start, int num, Element** elements);
+
+  // Identical to ExtractSubrange() described above, except that no object
+  // copies are ever performed. Instead, the raw object pointers are returned.
+  // Thus, if on an arena, the returned objects must not be freed, because they
+  // will not be heap-allocated objects.
+  void UnsafeArenaExtractSubrange(int start, int num, Element** elements);
+
+  // When elements are removed by calls to RemoveLast() or Clear(), they
+  // are not actually freed.  Instead, they are cleared and kept so that
+  // they can be reused later.  This can save lots of CPU time when
+  // repeatedly reusing a protocol message for similar purposes.
+  //
+  // Hardcore programs may choose to manipulate these cleared objects
+  // to better optimize memory management using the following routines.
+
+  // Get the number of cleared objects that are currently being kept
+  // around for reuse.
+  int ClearedCount() const;
+#ifndef PROTOBUF_FUTURE_BREAKING_CHANGES
+  // Add an element to the pool of cleared objects, passing ownership to
+  // the RepeatedPtrField.  The element must be cleared prior to calling
+  // this method.
+  //
+  // This method cannot be called when the repeated field is on an arena or when
+  // |value| is; both cases will trigger a GOOGLE_DCHECK-failure.
+  void AddCleared(Element* value);
+  // Remove a single element from the cleared pool and return it, passing
+  // ownership to the caller.  The element is guaranteed to be cleared.
+  // Requires:  ClearedCount() > 0
+  //
+  //
+  // This method cannot be called when the repeated field is on an arena; doing
+  // so will trigger a GOOGLE_DCHECK-failure.
+  PROTOBUF_NODISCARD Element* ReleaseCleared();
+#endif  // !PROTOBUF_FUTURE_BREAKING_CHANGES
+
+  // Removes the element referenced by position.
+  //
+  // Returns an iterator to the element immediately following the removed
+  // element.
+  //
+  // Invalidates all iterators at or after the removed element, including end().
+  iterator erase(const_iterator position);
+
+  // Removes the elements in the range [first, last).
+  //
+  // Returns an iterator to the element immediately following the removed range.
+  //
+  // Invalidates all iterators at or after the removed range, including end().
+  iterator erase(const_iterator first, const_iterator last);
+
+  // Gets the arena on which this RepeatedPtrField stores its elements.
+  inline Arena* GetArena() const;
+
+  // For internal use only.
+  //
+  // This is public due to it being called by generated code.
+  void InternalSwap(RepeatedPtrField* other) {
+    internal::RepeatedPtrFieldBase::InternalSwap(other);
+  }
+
+ private:
+  // Note:  RepeatedPtrField SHOULD NOT be subclassed by users.
+  class TypeHandler;
+
+  // Implementations for ExtractSubrange(). The copying behavior must be
+  // included only if the type supports the necessary operations (e.g.,
+  // MergeFrom()), so we must resolve this at compile time. ExtractSubrange()
+  // uses SFINAE to choose one of the below implementations.
+  void ExtractSubrangeInternal(int start, int num, Element** elements,
+                               std::true_type);
+  void ExtractSubrangeInternal(int start, int num, Element** elements,
+                               std::false_type);
+
+  friend class Arena;
+
+  template <typename T>
+  friend struct WeakRepeatedPtrField;
+
+  typedef void InternalArenaConstructable_;
+
+};
+
+// implementation ====================================================
+
+namespace internal {
+
+constexpr RepeatedPtrFieldBase::RepeatedPtrFieldBase()
+    : arena_(nullptr), current_size_(0), total_size_(0), rep_(nullptr) {}
+
+inline RepeatedPtrFieldBase::RepeatedPtrFieldBase(Arena* arena)
+    : arena_(arena), current_size_(0), total_size_(0), rep_(nullptr) {}
+
+template <typename TypeHandler>
+void RepeatedPtrFieldBase::Destroy() {
+  if (rep_ != nullptr && arena_ == nullptr) {
+    int n = rep_->allocated_size;
+    void* const* elements = rep_->elements;
+    for (int i = 0; i < n; i++) {
+      TypeHandler::Delete(cast<TypeHandler>(elements[i]), nullptr);
+    }
+#if defined(__GXX_DELETE_WITH_SIZE__) || defined(__cpp_sized_deallocation)
+    const size_t size = total_size_ * sizeof(elements[0]) + kRepHeaderSize;
+    ::operator delete(static_cast<void*>(rep_), size);
+#else
+    ::operator delete(static_cast<void*>(rep_));
+#endif
+  }
+  rep_ = nullptr;
+}
+
+template <typename TypeHandler>
+inline void RepeatedPtrFieldBase::Swap(RepeatedPtrFieldBase* other) {
+#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+  if (GetArena() != nullptr && GetArena() == other->GetArena()) {
+#else   // PROTOBUF_FORCE_COPY_IN_SWAP
+  if (GetArena() == other->GetArena()) {
+#endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
+    InternalSwap(other);
+  } else {
+    SwapFallback<TypeHandler>(other);
+  }
+}
+
+template <typename TypeHandler>
+void RepeatedPtrFieldBase::SwapFallback(RepeatedPtrFieldBase* other) {
+#ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+  GOOGLE_DCHECK(GetArena() == nullptr || other->GetArena() != GetArena());
+#else   // PROTOBUF_FORCE_COPY_IN_SWAP
+  GOOGLE_DCHECK(other->GetArena() != GetArena());
+#endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
+
+  // Copy semantics in this case. We try to improve efficiency by placing the
+  // temporary on |other|'s arena so that messages are copied twice rather than
+  // three times.
+  RepeatedPtrFieldBase temp(other->GetArena());
+  temp.MergeFrom<TypeHandler>(*this);
+  this->Clear<TypeHandler>();
+  this->MergeFrom<TypeHandler>(*other);
+  other->InternalSwap(&temp);
+  temp.Destroy<TypeHandler>();  // Frees rep_ if `other` had no arena.
+}
+
+inline bool RepeatedPtrFieldBase::empty() const { return current_size_ == 0; }
+
+inline int RepeatedPtrFieldBase::size() const { return current_size_; }
+
+template <typename TypeHandler>
+inline const typename TypeHandler::Type& RepeatedPtrFieldBase::Get(
+    int index) const {
+  GOOGLE_DCHECK_GE(index, 0);
+  GOOGLE_DCHECK_LT(index, current_size_);
+  return *cast<TypeHandler>(rep_->elements[index]);
+}
+
+template <typename TypeHandler>
+inline const typename TypeHandler::Type& RepeatedPtrFieldBase::at(
+    int index) const {
+  GOOGLE_CHECK_GE(index, 0);
+  GOOGLE_CHECK_LT(index, current_size_);
+  return *cast<TypeHandler>(rep_->elements[index]);
+}
+
+template <typename TypeHandler>
+inline typename TypeHandler::Type& RepeatedPtrFieldBase::at(int index) {
+  GOOGLE_CHECK_GE(index, 0);
+  GOOGLE_CHECK_LT(index, current_size_);
+  return *cast<TypeHandler>(rep_->elements[index]);
+}
+
+template <typename TypeHandler>
+inline typename TypeHandler::Type* RepeatedPtrFieldBase::Mutable(int index) {
+  GOOGLE_DCHECK_GE(index, 0);
+  GOOGLE_DCHECK_LT(index, current_size_);
+  return cast<TypeHandler>(rep_->elements[index]);
+}
+
+template <typename TypeHandler>
+inline void RepeatedPtrFieldBase::Delete(int index) {
+  GOOGLE_DCHECK_GE(index, 0);
+  GOOGLE_DCHECK_LT(index, current_size_);
+  TypeHandler::Delete(cast<TypeHandler>(rep_->elements[index]), arena_);
+}
+
+template <typename TypeHandler>
+inline typename TypeHandler::Type* RepeatedPtrFieldBase::Add(
+    typename TypeHandler::Type* prototype) {
+  if (rep_ != nullptr && current_size_ < rep_->allocated_size) {
+    return cast<TypeHandler>(rep_->elements[current_size_++]);
+  }
+  typename TypeHandler::Type* result =
+      TypeHandler::NewFromPrototype(prototype, arena_);
+  return reinterpret_cast<typename TypeHandler::Type*>(
+      AddOutOfLineHelper(result));
+}
+
+template <typename TypeHandler,
+          typename std::enable_if<TypeHandler::Movable::value>::type*>
+inline void RepeatedPtrFieldBase::Add(typename TypeHandler::Type&& value) {
+  if (rep_ != nullptr && current_size_ < rep_->allocated_size) {
+    *cast<TypeHandler>(rep_->elements[current_size_++]) = std::move(value);
+    return;
+  }
+  if (!rep_ || rep_->allocated_size == total_size_) {
+    Reserve(total_size_ + 1);
+  }
+  ++rep_->allocated_size;
+  typename TypeHandler::Type* result =
+      TypeHandler::New(arena_, std::move(value));
+  rep_->elements[current_size_++] = result;
+}
+
+template <typename TypeHandler>
+inline void RepeatedPtrFieldBase::RemoveLast() {
+  GOOGLE_DCHECK_GT(current_size_, 0);
+  TypeHandler::Clear(cast<TypeHandler>(rep_->elements[--current_size_]));
+}
+
+template <typename TypeHandler>
+void RepeatedPtrFieldBase::Clear() {
+  const int n = current_size_;
+  GOOGLE_DCHECK_GE(n, 0);
+  if (n > 0) {
+    void* const* elements = rep_->elements;
+    int i = 0;
+    do {
+      TypeHandler::Clear(cast<TypeHandler>(elements[i++]));
+    } while (i < n);
+    current_size_ = 0;
+  }
+}
+
+// To avoid unnecessary code duplication and reduce binary size, we use a
+// layered approach to implementing MergeFrom(). The toplevel method is
+// templated, so we get a small thunk per concrete message type in the binary.
+// This calls a shared implementation with most of the logic, passing a function
+// pointer to another type-specific piece of code that calls the object-allocate
+// and merge handlers.
+template <typename TypeHandler>
+inline void RepeatedPtrFieldBase::MergeFrom(const RepeatedPtrFieldBase& other) {
+  GOOGLE_DCHECK_NE(&other, this);
+  if (other.current_size_ == 0) return;
+  MergeFromInternal(other,
+                    &RepeatedPtrFieldBase::MergeFromInnerLoop<TypeHandler>);
+}
+
+inline void RepeatedPtrFieldBase::MergeFromInternal(
+    const RepeatedPtrFieldBase& other,
+    void (RepeatedPtrFieldBase::*inner_loop)(void**, void**, int, int)) {
+  // Note: wrapper has already guaranteed that other.rep_ != nullptr here.
+  int other_size = other.current_size_;
+  void** other_elements = other.rep_->elements;
+  void** new_elements = InternalExtend(other_size);
+  int allocated_elems = rep_->allocated_size - current_size_;
+  (this->*inner_loop)(new_elements, other_elements, other_size,
+                      allocated_elems);
+  current_size_ += other_size;
+  if (rep_->allocated_size < current_size_) {
+    rep_->allocated_size = current_size_;
+  }
+}
+
+// Merges other_elems to our_elems.
+template <typename TypeHandler>
+void RepeatedPtrFieldBase::MergeFromInnerLoop(void** our_elems,
+                                              void** other_elems, int length,
+                                              int already_allocated) {
+  if (already_allocated < length) {
+    Arena* arena = GetArena();
+    typename TypeHandler::Type* elem_prototype =
+        reinterpret_cast<typename TypeHandler::Type*>(other_elems[0]);
+    for (int i = already_allocated; i < length; i++) {
+      // Allocate a new empty element that we'll merge into below
+      typename TypeHandler::Type* new_elem =
+          TypeHandler::NewFromPrototype(elem_prototype, arena);
+      our_elems[i] = new_elem;
+    }
+  }
+  // Main loop that does the actual merging
+  for (int i = 0; i < length; i++) {
+    // Already allocated: use existing element.
+    typename TypeHandler::Type* other_elem =
+        reinterpret_cast<typename TypeHandler::Type*>(other_elems[i]);
+    typename TypeHandler::Type* new_elem =
+        reinterpret_cast<typename TypeHandler::Type*>(our_elems[i]);
+    TypeHandler::Merge(*other_elem, new_elem);
+  }
+}
+
+template <typename TypeHandler>
+inline void RepeatedPtrFieldBase::CopyFrom(const RepeatedPtrFieldBase& other) {
+  if (&other == this) return;
+  RepeatedPtrFieldBase::Clear<TypeHandler>();
+  RepeatedPtrFieldBase::MergeFrom<TypeHandler>(other);
+}
+
+inline int RepeatedPtrFieldBase::Capacity() const { return total_size_; }
+
+inline void* const* RepeatedPtrFieldBase::raw_data() const {
+  return rep_ ? rep_->elements : nullptr;
+}
+
+inline void** RepeatedPtrFieldBase::raw_mutable_data() const {
+  return rep_ ? const_cast<void**>(rep_->elements) : nullptr;
+}
+
+template <typename TypeHandler>
+inline typename TypeHandler::Type** RepeatedPtrFieldBase::mutable_data() {
+  // TODO(kenton):  Breaks C++ aliasing rules.  We should probably remove this
+  //   method entirely.
+  return reinterpret_cast<typename TypeHandler::Type**>(raw_mutable_data());
+}
+
+template <typename TypeHandler>
+inline const typename TypeHandler::Type* const* RepeatedPtrFieldBase::data()
+    const {
+  // TODO(kenton):  Breaks C++ aliasing rules.  We should probably remove this
+  //   method entirely.
+  return reinterpret_cast<const typename TypeHandler::Type* const*>(raw_data());
+}
+
+inline void RepeatedPtrFieldBase::SwapElements(int index1, int index2) {
+  using std::swap;  // enable ADL with fallback
+  swap(rep_->elements[index1], rep_->elements[index2]);
+}
+
+template <typename TypeHandler>
+inline size_t RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong() const {
+  size_t allocated_bytes = static_cast<size_t>(total_size_) * sizeof(void*);
+  if (rep_ != nullptr) {
+    for (int i = 0; i < rep_->allocated_size; ++i) {
+      allocated_bytes +=
+          TypeHandler::SpaceUsedLong(*cast<TypeHandler>(rep_->elements[i]));
+    }
+    allocated_bytes += kRepHeaderSize;
+  }
+  return allocated_bytes;
+}
+
+template <typename TypeHandler>
+inline typename TypeHandler::Type* RepeatedPtrFieldBase::AddFromCleared() {
+  if (rep_ != nullptr && current_size_ < rep_->allocated_size) {
+    return cast<TypeHandler>(rep_->elements[current_size_++]);
+  } else {
+    return nullptr;
+  }
+}
+
+// AddAllocated version that implements arena-safe copying behavior.
+template <typename TypeHandler>
+void RepeatedPtrFieldBase::AddAllocatedInternal(
+    typename TypeHandler::Type* value, std::true_type) {
+  Arena* element_arena =
+      reinterpret_cast<Arena*>(TypeHandler::GetOwningArena(value));
+  Arena* arena = GetArena();
+  if (arena == element_arena && rep_ && rep_->allocated_size < total_size_) {
+    // Fast path: underlying arena representation (tagged pointer) is equal to
+    // our arena pointer, and we can add to array without resizing it (at least
+    // one slot that is not allocated).
+    void** elems = rep_->elements;
+    if (current_size_ < rep_->allocated_size) {
+      // Make space at [current] by moving first allocated element to end of
+      // allocated list.
+      elems[rep_->allocated_size] = elems[current_size_];
+    }
+    elems[current_size_] = value;
+    current_size_ = current_size_ + 1;
+    rep_->allocated_size = rep_->allocated_size + 1;
+  } else {
+    AddAllocatedSlowWithCopy<TypeHandler>(value, element_arena, arena);
+  }
+}
+
+// Slowpath handles all cases, copying if necessary.
+template <typename TypeHandler>
+void RepeatedPtrFieldBase::AddAllocatedSlowWithCopy(
+    // Pass value_arena and my_arena to avoid duplicate virtual call (value) or
+    // load (mine).
+    typename TypeHandler::Type* value, Arena* value_arena, Arena* my_arena) {
+  // Ensure that either the value is in the same arena, or if not, we do the
+  // appropriate thing: Own() it (if it's on heap and we're in an arena) or copy
+  // it to our arena/heap (otherwise).
+  if (my_arena != nullptr && value_arena == nullptr) {
+    my_arena->Own(value);
+  } else if (my_arena != value_arena) {
+    typename TypeHandler::Type* new_value =
+        TypeHandler::NewFromPrototype(value, my_arena);
+    TypeHandler::Merge(*value, new_value);
+    TypeHandler::Delete(value, value_arena);
+    value = new_value;
+  }
+
+  UnsafeArenaAddAllocated<TypeHandler>(value);
+}
+
+// AddAllocated version that does not implement arena-safe copying behavior.
+template <typename TypeHandler>
+void RepeatedPtrFieldBase::AddAllocatedInternal(
+    typename TypeHandler::Type* value, std::false_type) {
+  if (rep_ && rep_->allocated_size < total_size_) {
+    // Fast path: underlying arena representation (tagged pointer) is equal to
+    // our arena pointer, and we can add to array without resizing it (at least
+    // one slot that is not allocated).
+    void** elems = rep_->elements;
+    if (current_size_ < rep_->allocated_size) {
+      // Make space at [current] by moving first allocated element to end of
+      // allocated list.
+      elems[rep_->allocated_size] = elems[current_size_];
+    }
+    elems[current_size_] = value;
+    current_size_ = current_size_ + 1;
+    ++rep_->allocated_size;
+  } else {
+    UnsafeArenaAddAllocated<TypeHandler>(value);
+  }
+}
+
+template <typename TypeHandler>
+void RepeatedPtrFieldBase::UnsafeArenaAddAllocated(
+    typename TypeHandler::Type* value) {
+  // Make room for the new pointer.
+  if (!rep_ || current_size_ == total_size_) {
+    // The array is completely full with no cleared objects, so grow it.
+    Reserve(total_size_ + 1);
+    ++rep_->allocated_size;
+  } else if (rep_->allocated_size == total_size_) {
+    // There is no more space in the pointer array because it contains some
+    // cleared objects awaiting reuse.  We don't want to grow the array in this
+    // case because otherwise a loop calling AddAllocated() followed by Clear()
+    // would leak memory.
+    TypeHandler::Delete(cast<TypeHandler>(rep_->elements[current_size_]),
+                        arena_);
+  } else if (current_size_ < rep_->allocated_size) {
+    // We have some cleared objects.  We don't care about their order, so we
+    // can just move the first one to the end to make space.
+    rep_->elements[rep_->allocated_size] = rep_->elements[current_size_];
+    ++rep_->allocated_size;
+  } else {
+    // There are no cleared objects.
+    ++rep_->allocated_size;
+  }
+
+  rep_->elements[current_size_++] = value;
+}
+
+// ReleaseLast() for types that implement merge/copy behavior.
+template <typename TypeHandler>
+inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseLastInternal(
+    std::true_type) {
+  // First, release an element.
+  typename TypeHandler::Type* result = UnsafeArenaReleaseLast<TypeHandler>();
+  // Now perform a copy if we're on an arena.
+  Arena* arena = GetArena();
+
+  typename TypeHandler::Type* new_result;
+#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
+  new_result = copy<TypeHandler>(result);
+  if (arena == nullptr) delete result;
+#else   // PROTOBUF_FORCE_COPY_IN_RELEASE
+  new_result = (arena == nullptr) ? result : copy<TypeHandler>(result);
+#endif  // !PROTOBUF_FORCE_COPY_IN_RELEASE
+  return new_result;
+}
+
+// ReleaseLast() for types that *do not* implement merge/copy behavior -- this
+// is the same as UnsafeArenaReleaseLast(). Note that we GOOGLE_DCHECK-fail if we're on
+// an arena, since the user really should implement the copy operation in this
+// case.
+template <typename TypeHandler>
+inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseLastInternal(
+    std::false_type) {
+  GOOGLE_DCHECK(GetArena() == nullptr)
+      << "ReleaseLast() called on a RepeatedPtrField that is on an arena, "
+      << "with a type that does not implement MergeFrom. This is unsafe; "
+      << "please implement MergeFrom for your type.";
+  return UnsafeArenaReleaseLast<TypeHandler>();
+}
+
+template <typename TypeHandler>
+inline typename TypeHandler::Type*
+RepeatedPtrFieldBase::UnsafeArenaReleaseLast() {
+  GOOGLE_DCHECK_GT(current_size_, 0);
+  typename TypeHandler::Type* result =
+      cast<TypeHandler>(rep_->elements[--current_size_]);
+  --rep_->allocated_size;
+  if (current_size_ < rep_->allocated_size) {
+    // There are cleared elements on the end; replace the removed element
+    // with the last allocated element.
+    rep_->elements[current_size_] = rep_->elements[rep_->allocated_size];
+  }
+  return result;
+}
+
+inline int RepeatedPtrFieldBase::ClearedCount() const {
+  return rep_ ? (rep_->allocated_size - current_size_) : 0;
+}
+
+template <typename TypeHandler>
+inline void RepeatedPtrFieldBase::AddCleared(
+    typename TypeHandler::Type* value) {
+  GOOGLE_DCHECK(GetArena() == nullptr)
+      << "AddCleared() can only be used on a RepeatedPtrField not on an arena.";
+  GOOGLE_DCHECK(TypeHandler::GetOwningArena(value) == nullptr)
+      << "AddCleared() can only accept values not on an arena.";
+  if (!rep_ || rep_->allocated_size == total_size_) {
+    Reserve(total_size_ + 1);
+  }
+  rep_->elements[rep_->allocated_size++] = value;
+}
+
+template <typename TypeHandler>
+inline typename TypeHandler::Type* RepeatedPtrFieldBase::ReleaseCleared() {
+  GOOGLE_DCHECK(GetArena() == nullptr)
+      << "ReleaseCleared() can only be used on a RepeatedPtrField not on "
+      << "an arena.";
+  GOOGLE_DCHECK(GetArena() == nullptr);
+  GOOGLE_DCHECK(rep_ != nullptr);
+  GOOGLE_DCHECK_GT(rep_->allocated_size, current_size_);
+  return cast<TypeHandler>(rep_->elements[--rep_->allocated_size]);
+}
+
+}  // namespace internal
+
+// -------------------------------------------------------------------
+
+template <typename Element>
+class RepeatedPtrField<Element>::TypeHandler
+    : public internal::GenericTypeHandler<Element> {};
+
+template <>
+class RepeatedPtrField<std::string>::TypeHandler
+    : public internal::StringTypeHandler {};
+
+template <typename Element>
+constexpr RepeatedPtrField<Element>::RepeatedPtrField()
+    : RepeatedPtrFieldBase() {}
+
+template <typename Element>
+inline RepeatedPtrField<Element>::RepeatedPtrField(Arena* arena)
+    : RepeatedPtrFieldBase(arena) {}
+
+template <typename Element>
+inline RepeatedPtrField<Element>::RepeatedPtrField(
+    const RepeatedPtrField& other)
+    : RepeatedPtrFieldBase() {
+  MergeFrom(other);
+}
+
+template <typename Element>
+template <typename Iter, typename>
+inline RepeatedPtrField<Element>::RepeatedPtrField(Iter begin, Iter end) {
+  Add(begin, end);
+}
+
+template <typename Element>
+RepeatedPtrField<Element>::~RepeatedPtrField() {
+#ifdef __cpp_if_constexpr
+  if constexpr (std::is_base_of<MessageLite, Element>::value) {
+#else
+  if (std::is_base_of<MessageLite, Element>::value) {
+#endif
+    if (NeedsDestroy()) DestroyProtos();
+  } else {
+    Destroy<TypeHandler>();
+  }
+}
+
+template <typename Element>
+inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=(
+    const RepeatedPtrField& other) {
+  if (this != &other) CopyFrom(other);
+  return *this;
+}
+
+template <typename Element>
+inline RepeatedPtrField<Element>::RepeatedPtrField(
+    RepeatedPtrField&& other) noexcept
+    : RepeatedPtrField() {
+#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
+  CopyFrom(other);
+#else   // PROTOBUF_FORCE_COPY_IN_MOVE
+  // We don't just call Swap(&other) here because it would perform 3 copies if
+  // other is on an arena. This field can't be on an arena because arena
+  // construction always uses the Arena* accepting constructor.
+  if (other.GetArena()) {
+    CopyFrom(other);
+  } else {
+    InternalSwap(&other);
+  }
+#endif  // !PROTOBUF_FORCE_COPY_IN_MOVE
+}
+
+template <typename Element>
+inline RepeatedPtrField<Element>& RepeatedPtrField<Element>::operator=(
+    RepeatedPtrField&& other) noexcept {
+  // We don't just call Swap(&other) here because it would perform 3 copies if
+  // the two fields are on different arenas.
+  if (this != &other) {
+    if (GetArena() != other.GetArena()
+#ifdef PROTOBUF_FORCE_COPY_IN_MOVE
+        || GetArena() == nullptr
+#endif  // !PROTOBUF_FORCE_COPY_IN_MOVE
+    ) {
+      CopyFrom(other);
+    } else {
+      InternalSwap(&other);
+    }
+  }
+  return *this;
+}
+
+template <typename Element>
+inline bool RepeatedPtrField<Element>::empty() const {
+  return RepeatedPtrFieldBase::empty();
+}
+
+template <typename Element>
+inline int RepeatedPtrField<Element>::size() const {
+  return RepeatedPtrFieldBase::size();
+}
+
+template <typename Element>
+inline const Element& RepeatedPtrField<Element>::Get(int index) const {
+  return RepeatedPtrFieldBase::Get<TypeHandler>(index);
+}
+
+template <typename Element>
+inline const Element& RepeatedPtrField<Element>::at(int index) const {
+  return RepeatedPtrFieldBase::at<TypeHandler>(index);
+}
+
+template <typename Element>
+inline Element& RepeatedPtrField<Element>::at(int index) {
+  return RepeatedPtrFieldBase::at<TypeHandler>(index);
+}
+
+
+template <typename Element>
+inline Element* RepeatedPtrField<Element>::Mutable(int index) {
+  return RepeatedPtrFieldBase::Mutable<TypeHandler>(index);
+}
+
+template <typename Element>
+inline Element* RepeatedPtrField<Element>::Add() {
+  return RepeatedPtrFieldBase::Add<TypeHandler>();
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::Add(Element&& value) {
+  RepeatedPtrFieldBase::Add<TypeHandler>(std::move(value));
+}
+
+template <typename Element>
+template <typename Iter>
+inline void RepeatedPtrField<Element>::Add(Iter begin, Iter end) {
+  if (std::is_base_of<
+          std::forward_iterator_tag,
+          typename std::iterator_traits<Iter>::iterator_category>::value) {
+    int reserve = std::distance(begin, end);
+    Reserve(size() + reserve);
+  }
+  for (; begin != end; ++begin) {
+    *Add() = *begin;
+  }
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::RemoveLast() {
+  RepeatedPtrFieldBase::RemoveLast<TypeHandler>();
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::DeleteSubrange(int start, int num) {
+  GOOGLE_DCHECK_GE(start, 0);
+  GOOGLE_DCHECK_GE(num, 0);
+  GOOGLE_DCHECK_LE(start + num, size());
+  for (int i = 0; i < num; ++i) {
+    RepeatedPtrFieldBase::Delete<TypeHandler>(start + i);
+  }
+  UnsafeArenaExtractSubrange(start, num, nullptr);
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::ExtractSubrange(int start, int num,
+                                                       Element** elements) {
+  typename internal::TypeImplementsMergeBehavior<
+      typename TypeHandler::Type>::type t;
+  ExtractSubrangeInternal(start, num, elements, t);
+}
+
+// ExtractSubrange() implementation for types that implement merge/copy
+// behavior.
+template <typename Element>
+inline void RepeatedPtrField<Element>::ExtractSubrangeInternal(
+    int start, int num, Element** elements, std::true_type) {
+  GOOGLE_DCHECK_GE(start, 0);
+  GOOGLE_DCHECK_GE(num, 0);
+  GOOGLE_DCHECK_LE(start + num, size());
+
+  if (num == 0) return;
+
+  GOOGLE_DCHECK_NE(elements, nullptr)
+      << "Releasing elements without transferring ownership is an unsafe "
+         "operation.  Use UnsafeArenaExtractSubrange.";
+  if (elements == nullptr) {
+    CloseGap(start, num);
+    return;
+  }
+
+  Arena* arena = GetArena();
+#ifdef PROTOBUF_FORCE_COPY_IN_RELEASE
+  // Always copy.
+  for (int i = 0; i < num; ++i) {
+    elements[i] = copy<TypeHandler>(
+        RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start));
+  }
+  if (arena == nullptr) {
+    for (int i = 0; i < num; ++i) {
+      delete RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start);
+    }
+  }
+#else   // PROTOBUF_FORCE_COPY_IN_RELEASE
+  // If we're on an arena, we perform a copy for each element so that the
+  // returned elements are heap-allocated. Otherwise, just forward it.
+  if (arena != nullptr) {
+    for (int i = 0; i < num; ++i) {
+      elements[i] = copy<TypeHandler>(
+          RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start));
+    }
+  } else {
+    for (int i = 0; i < num; ++i) {
+      elements[i] = RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start);
+    }
+  }
+#endif  // !PROTOBUF_FORCE_COPY_IN_RELEASE
+  CloseGap(start, num);
+}
+
+// ExtractSubrange() implementation for types that do not implement merge/copy
+// behavior.
+template <typename Element>
+inline void RepeatedPtrField<Element>::ExtractSubrangeInternal(
+    int start, int num, Element** elements, std::false_type) {
+  // This case is identical to UnsafeArenaExtractSubrange(). However, since
+  // ExtractSubrange() must return heap-allocated objects by contract, and we
+  // cannot fulfill this contract if we are an on arena, we must GOOGLE_DCHECK() that
+  // we are not on an arena.
+  GOOGLE_DCHECK(GetArena() == nullptr)
+      << "ExtractSubrange() when arena is non-nullptr is only supported when "
+      << "the Element type supplies a MergeFrom() operation to make copies.";
+  UnsafeArenaExtractSubrange(start, num, elements);
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::UnsafeArenaExtractSubrange(
+    int start, int num, Element** elements) {
+  GOOGLE_DCHECK_GE(start, 0);
+  GOOGLE_DCHECK_GE(num, 0);
+  GOOGLE_DCHECK_LE(start + num, size());
+
+  if (num > 0) {
+    // Save the values of the removed elements if requested.
+    if (elements != nullptr) {
+      for (int i = 0; i < num; ++i) {
+        elements[i] = RepeatedPtrFieldBase::Mutable<TypeHandler>(i + start);
+      }
+    }
+    CloseGap(start, num);
+  }
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::Clear() {
+  RepeatedPtrFieldBase::Clear<TypeHandler>();
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::MergeFrom(
+    const RepeatedPtrField& other) {
+  RepeatedPtrFieldBase::MergeFrom<TypeHandler>(other);
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::CopyFrom(const RepeatedPtrField& other) {
+  RepeatedPtrFieldBase::CopyFrom<TypeHandler>(other);
+}
+
+template <typename Element>
+template <typename Iter>
+inline void RepeatedPtrField<Element>::Assign(Iter begin, Iter end) {
+  Clear();
+  Add(begin, end);
+}
+
+template <typename Element>
+inline typename RepeatedPtrField<Element>::iterator
+RepeatedPtrField<Element>::erase(const_iterator position) {
+  return erase(position, position + 1);
+}
+
+template <typename Element>
+inline typename RepeatedPtrField<Element>::iterator
+RepeatedPtrField<Element>::erase(const_iterator first, const_iterator last) {
+  size_type pos_offset = std::distance(cbegin(), first);
+  size_type last_offset = std::distance(cbegin(), last);
+  DeleteSubrange(pos_offset, last_offset - pos_offset);
+  return begin() + pos_offset;
+}
+
+template <typename Element>
+inline Element** RepeatedPtrField<Element>::mutable_data() {
+  return RepeatedPtrFieldBase::mutable_data<TypeHandler>();
+}
+
+template <typename Element>
+inline const Element* const* RepeatedPtrField<Element>::data() const {
+  return RepeatedPtrFieldBase::data<TypeHandler>();
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::Swap(RepeatedPtrField* other) {
+  if (this == other) return;
+  RepeatedPtrFieldBase::Swap<TypeHandler>(other);
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::UnsafeArenaSwap(
+    RepeatedPtrField* other) {
+  if (this == other) return;
+  RepeatedPtrFieldBase::InternalSwap(other);
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::SwapElements(int index1, int index2) {
+  RepeatedPtrFieldBase::SwapElements(index1, index2);
+}
+
+template <typename Element>
+inline Arena* RepeatedPtrField<Element>::GetArena() const {
+  return RepeatedPtrFieldBase::GetArena();
+}
+
+template <typename Element>
+inline size_t RepeatedPtrField<Element>::SpaceUsedExcludingSelfLong() const {
+  return RepeatedPtrFieldBase::SpaceUsedExcludingSelfLong<TypeHandler>();
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::AddAllocated(Element* value) {
+  RepeatedPtrFieldBase::AddAllocated<TypeHandler>(value);
+}
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::UnsafeArenaAddAllocated(Element* value) {
+  RepeatedPtrFieldBase::UnsafeArenaAddAllocated<TypeHandler>(value);
+}
+
+template <typename Element>
+inline Element* RepeatedPtrField<Element>::ReleaseLast() {
+  return RepeatedPtrFieldBase::ReleaseLast<TypeHandler>();
+}
+
+template <typename Element>
+inline Element* RepeatedPtrField<Element>::UnsafeArenaReleaseLast() {
+  return RepeatedPtrFieldBase::UnsafeArenaReleaseLast<TypeHandler>();
+}
+
+template <typename Element>
+inline int RepeatedPtrField<Element>::ClearedCount() const {
+  return RepeatedPtrFieldBase::ClearedCount();
+}
+
+#ifndef PROTOBUF_FUTURE_BREAKING_CHANGES
+template <typename Element>
+inline void RepeatedPtrField<Element>::AddCleared(Element* value) {
+  return RepeatedPtrFieldBase::AddCleared<TypeHandler>(value);
+}
+
+template <typename Element>
+inline Element* RepeatedPtrField<Element>::ReleaseCleared() {
+  return RepeatedPtrFieldBase::ReleaseCleared<TypeHandler>();
+}
+#endif  // !PROTOBUF_FUTURE_BREAKING_CHANGES
+
+template <typename Element>
+inline void RepeatedPtrField<Element>::Reserve(int new_size) {
+  return RepeatedPtrFieldBase::Reserve(new_size);
+}
+
+template <typename Element>
+inline int RepeatedPtrField<Element>::Capacity() const {
+  return RepeatedPtrFieldBase::Capacity();
+}
+
+// -------------------------------------------------------------------
+
+namespace internal {
+
+// STL-like iterator implementation for RepeatedPtrField.  You should not
+// refer to this class directly; use RepeatedPtrField<T>::iterator instead.
+//
+// The iterator for RepeatedPtrField<T>, RepeatedPtrIterator<T>, is
+// very similar to iterator_ptr<T**> in util/gtl/iterator_adaptors.h,
+// but adds random-access operators and is modified to wrap a void** base
+// iterator (since RepeatedPtrField stores its array as a void* array and
+// casting void** to T** would violate C++ aliasing rules).
+//
+// This code based on net/proto/proto-array-internal.h by Jeffrey Yasskin
+// (jyasskin@google.com).
+template <typename Element>
+class RepeatedPtrIterator {
+ public:
+  using iterator = RepeatedPtrIterator<Element>;
+  using iterator_category = std::random_access_iterator_tag;
+  using value_type = typename std::remove_const<Element>::type;
+  using difference_type = std::ptrdiff_t;
+  using pointer = Element*;
+  using reference = Element&;
+
+  RepeatedPtrIterator() : it_(nullptr) {}
+  explicit RepeatedPtrIterator(void* const* it) : it_(it) {}
+
+  // Allow "upcasting" from RepeatedPtrIterator<T**> to
+  // RepeatedPtrIterator<const T*const*>.
+  template <typename OtherElement>
+  RepeatedPtrIterator(const RepeatedPtrIterator<OtherElement>& other)
+      : it_(other.it_) {
+    // Force a compiler error if the other type is not convertible to ours.
+    if (false) {
+      static_cast<void>([](OtherElement* from) -> Element* { return from; });
+    }
+  }
+
+  // dereferenceable
+  reference operator*() const { return *reinterpret_cast<Element*>(*it_); }
+  pointer operator->() const { return &(operator*()); }
+
+  // {inc,dec}rementable
+  iterator& operator++() {
+    ++it_;
+    return *this;
+  }
+  iterator operator++(int) { return iterator(it_++); }
+  iterator& operator--() {
+    --it_;
+    return *this;
+  }
+  iterator operator--(int) { return iterator(it_--); }
+
+  // equality_comparable
+  bool operator==(const iterator& x) const { return it_ == x.it_; }
+  bool operator!=(const iterator& x) const { return it_ != x.it_; }
+
+  // less_than_comparable
+  bool operator<(const iterator& x) const { return it_ < x.it_; }
+  bool operator<=(const iterator& x) const { return it_ <= x.it_; }
+  bool operator>(const iterator& x) const { return it_ > x.it_; }
+  bool operator>=(const iterator& x) const { return it_ >= x.it_; }
+
+  // addable, subtractable
+  iterator& operator+=(difference_type d) {
+    it_ += d;
+    return *this;
+  }
+  friend iterator operator+(iterator it, const difference_type d) {
+    it += d;
+    return it;
+  }
+  friend iterator operator+(const difference_type d, iterator it) {
+    it += d;
+    return it;
+  }
+  iterator& operator-=(difference_type d) {
+    it_ -= d;
+    return *this;
+  }
+  friend iterator operator-(iterator it, difference_type d) {
+    it -= d;
+    return it;
+  }
+
+  // indexable
+  reference operator[](difference_type d) const { return *(*this + d); }
+
+  // random access iterator
+  difference_type operator-(const iterator& x) const { return it_ - x.it_; }
+
+ private:
+  template <typename OtherElement>
+  friend class RepeatedPtrIterator;
+
+  // The internal iterator.
+  void* const* it_;
+};
+
+// Provide an iterator that operates on pointers to the underlying objects
+// rather than the objects themselves as RepeatedPtrIterator does.
+// Consider using this when working with stl algorithms that change
+// the array.
+// The VoidPtr template parameter holds the type-agnostic pointer value
+// referenced by the iterator.  It should either be "void *" for a mutable
+// iterator, or "const void* const" for a constant iterator.
+template <typename Element, typename VoidPtr>
+class RepeatedPtrOverPtrsIterator {
+ public:
+  using iterator = RepeatedPtrOverPtrsIterator<Element, VoidPtr>;
+  using iterator_category = std::random_access_iterator_tag;
+  using value_type = typename std::remove_const<Element>::type;
+  using difference_type = std::ptrdiff_t;
+  using pointer = Element*;
+  using reference = Element&;
+
+  RepeatedPtrOverPtrsIterator() : it_(nullptr) {}
+  explicit RepeatedPtrOverPtrsIterator(VoidPtr* it) : it_(it) {}
+
+  // dereferenceable
+  reference operator*() const { return *reinterpret_cast<Element*>(it_); }
+  pointer operator->() const { return &(operator*()); }
+
+  // {inc,dec}rementable
+  iterator& operator++() {
+    ++it_;
+    return *this;
+  }
+  iterator operator++(int) { return iterator(it_++); }
+  iterator& operator--() {
+    --it_;
+    return *this;
+  }
+  iterator operator--(int) { return iterator(it_--); }
+
+  // equality_comparable
+  bool operator==(const iterator& x) const { return it_ == x.it_; }
+  bool operator!=(const iterator& x) const { return it_ != x.it_; }
+
+  // less_than_comparable
+  bool operator<(const iterator& x) const { return it_ < x.it_; }
+  bool operator<=(const iterator& x) const { return it_ <= x.it_; }
+  bool operator>(const iterator& x) const { return it_ > x.it_; }
+  bool operator>=(const iterator& x) const { return it_ >= x.it_; }
+
+  // addable, subtractable
+  iterator& operator+=(difference_type d) {
+    it_ += d;
+    return *this;
+  }
+  friend iterator operator+(iterator it, difference_type d) {
+    it += d;
+    return it;
+  }
+  friend iterator operator+(difference_type d, iterator it) {
+    it += d;
+    return it;
+  }
+  iterator& operator-=(difference_type d) {
+    it_ -= d;
+    return *this;
+  }
+  friend iterator operator-(iterator it, difference_type d) {
+    it -= d;
+    return it;
+  }
+
+  // indexable
+  reference operator[](difference_type d) const { return *(*this + d); }
+
+  // random access iterator
+  difference_type operator-(const iterator& x) const { return it_ - x.it_; }
+
+ private:
+  template <typename OtherElement>
+  friend class RepeatedPtrIterator;
+
+  // The internal iterator.
+  VoidPtr* it_;
+};
+
+void RepeatedPtrFieldBase::InternalSwap(RepeatedPtrFieldBase* rhs) {
+  GOOGLE_DCHECK(this != rhs);
+
+  // Swap all fields at once.
+  auto temp = std::make_tuple(rhs->arena_, rhs->current_size_, rhs->total_size_,
+                              rhs->rep_);
+  std::tie(rhs->arena_, rhs->current_size_, rhs->total_size_, rhs->rep_) =
+      std::make_tuple(arena_, current_size_, total_size_, rep_);
+  std::tie(arena_, current_size_, total_size_, rep_) = temp;
+}
+
+}  // namespace internal
+
+template <typename Element>
+inline typename RepeatedPtrField<Element>::iterator
+RepeatedPtrField<Element>::begin() {
+  return iterator(raw_data());
+}
+template <typename Element>
+inline typename RepeatedPtrField<Element>::const_iterator
+RepeatedPtrField<Element>::begin() const {
+  return iterator(raw_data());
+}
+template <typename Element>
+inline typename RepeatedPtrField<Element>::const_iterator
+RepeatedPtrField<Element>::cbegin() const {
+  return begin();
+}
+template <typename Element>
+inline typename RepeatedPtrField<Element>::iterator
+RepeatedPtrField<Element>::end() {
+  return iterator(raw_data() + size());
+}
+template <typename Element>
+inline typename RepeatedPtrField<Element>::const_iterator
+RepeatedPtrField<Element>::end() const {
+  return iterator(raw_data() + size());
+}
+template <typename Element>
+inline typename RepeatedPtrField<Element>::const_iterator
+RepeatedPtrField<Element>::cend() const {
+  return end();
+}
+
+template <typename Element>
+inline typename RepeatedPtrField<Element>::pointer_iterator
+RepeatedPtrField<Element>::pointer_begin() {
+  return pointer_iterator(raw_mutable_data());
+}
+template <typename Element>
+inline typename RepeatedPtrField<Element>::const_pointer_iterator
+RepeatedPtrField<Element>::pointer_begin() const {
+  return const_pointer_iterator(const_cast<const void* const*>(raw_data()));
+}
+template <typename Element>
+inline typename RepeatedPtrField<Element>::pointer_iterator
+RepeatedPtrField<Element>::pointer_end() {
+  return pointer_iterator(raw_mutable_data() + size());
+}
+template <typename Element>
+inline typename RepeatedPtrField<Element>::const_pointer_iterator
+RepeatedPtrField<Element>::pointer_end() const {
+  return const_pointer_iterator(
+      const_cast<const void* const*>(raw_data() + size()));
+}
+
+// Iterators and helper functions that follow the spirit of the STL
+// std::back_insert_iterator and std::back_inserter but are tailor-made
+// for RepeatedField and RepeatedPtrField. Typical usage would be:
+//
+//   std::copy(some_sequence.begin(), some_sequence.end(),
+//             RepeatedFieldBackInserter(proto.mutable_sequence()));
+//
+// Ported by johannes from util/gtl/proto-array-iterators.h
+
+namespace internal {
+
+// A back inserter for RepeatedPtrField objects.
+template <typename T>
+class RepeatedPtrFieldBackInsertIterator {
+ public:
+  using iterator_category = std::output_iterator_tag;
+  using value_type = T;
+  using pointer = void;
+  using reference = void;
+  using difference_type = std::ptrdiff_t;
+
+  RepeatedPtrFieldBackInsertIterator(RepeatedPtrField<T>* const mutable_field)
+      : field_(mutable_field) {}
+  RepeatedPtrFieldBackInsertIterator<T>& operator=(const T& value) {
+    *field_->Add() = value;
+    return *this;
+  }
+  RepeatedPtrFieldBackInsertIterator<T>& operator=(
+      const T* const ptr_to_value) {
+    *field_->Add() = *ptr_to_value;
+    return *this;
+  }
+  RepeatedPtrFieldBackInsertIterator<T>& operator=(T&& value) {
+    *field_->Add() = std::move(value);
+    return *this;
+  }
+  RepeatedPtrFieldBackInsertIterator<T>& operator*() { return *this; }
+  RepeatedPtrFieldBackInsertIterator<T>& operator++() { return *this; }
+  RepeatedPtrFieldBackInsertIterator<T>& operator++(int /* unused */) {
+    return *this;
+  }
+
+ private:
+  RepeatedPtrField<T>* field_;
+};
+
+// A back inserter for RepeatedPtrFields that inserts by transferring ownership
+// of a pointer.
+template <typename T>
+class AllocatedRepeatedPtrFieldBackInsertIterator {
+ public:
+  using iterator_category = std::output_iterator_tag;
+  using value_type = T;
+  using pointer = void;
+  using reference = void;
+  using difference_type = std::ptrdiff_t;
+
+  explicit AllocatedRepeatedPtrFieldBackInsertIterator(
+      RepeatedPtrField<T>* const mutable_field)
+      : field_(mutable_field) {}
+  AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator=(
+      T* const ptr_to_value) {
+    field_->AddAllocated(ptr_to_value);
+    return *this;
+  }
+  AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator*() { return *this; }
+  AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++() { return *this; }
+  AllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++(int /* unused */) {
+    return *this;
+  }
+
+ private:
+  RepeatedPtrField<T>* field_;
+};
+
+// Almost identical to AllocatedRepeatedPtrFieldBackInsertIterator. This one
+// uses the UnsafeArenaAddAllocated instead.
+template <typename T>
+class UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator {
+ public:
+  using iterator_category = std::output_iterator_tag;
+  using value_type = T;
+  using pointer = void;
+  using reference = void;
+  using difference_type = std::ptrdiff_t;
+
+  explicit UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator(
+      RepeatedPtrField<T>* const mutable_field)
+      : field_(mutable_field) {}
+  UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator=(
+      T const* const ptr_to_value) {
+    field_->UnsafeArenaAddAllocated(const_cast<T*>(ptr_to_value));
+    return *this;
+  }
+  UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator*() {
+    return *this;
+  }
+  UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++() {
+    return *this;
+  }
+  UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>& operator++(
+      int /* unused */) {
+    return *this;
+  }
+
+ private:
+  RepeatedPtrField<T>* field_;
+};
+
+}  // namespace internal
+
+// Provides a back insert iterator for RepeatedPtrField instances,
+// similar to std::back_inserter().
+template <typename T>
+internal::RepeatedPtrFieldBackInsertIterator<T> RepeatedPtrFieldBackInserter(
+    RepeatedPtrField<T>* const mutable_field) {
+  return internal::RepeatedPtrFieldBackInsertIterator<T>(mutable_field);
+}
+
+// Special back insert iterator for RepeatedPtrField instances, just in
+// case someone wants to write generic template code that can access both
+// RepeatedFields and RepeatedPtrFields using a common name.
+template <typename T>
+internal::RepeatedPtrFieldBackInsertIterator<T> RepeatedFieldBackInserter(
+    RepeatedPtrField<T>* const mutable_field) {
+  return internal::RepeatedPtrFieldBackInsertIterator<T>(mutable_field);
+}
+
+// Provides a back insert iterator for RepeatedPtrField instances
+// similar to std::back_inserter() which transfers the ownership while
+// copying elements.
+template <typename T>
+internal::AllocatedRepeatedPtrFieldBackInsertIterator<T>
+AllocatedRepeatedPtrFieldBackInserter(
+    RepeatedPtrField<T>* const mutable_field) {
+  return internal::AllocatedRepeatedPtrFieldBackInsertIterator<T>(
+      mutable_field);
+}
+
+// Similar to AllocatedRepeatedPtrFieldBackInserter, using
+// UnsafeArenaAddAllocated instead of AddAllocated.
+// This is slightly faster if that matters. It is also useful in legacy code
+// that uses temporary ownership to avoid copies. Example:
+//   RepeatedPtrField<T> temp_field;
+//   temp_field.UnsafeArenaAddAllocated(new T);
+//   ... // Do something with temp_field
+//   temp_field.UnsafeArenaExtractSubrange(0, temp_field.size(), nullptr);
+// If you put temp_field on the arena this fails, because the ownership
+// transfers to the arena at the "AddAllocated" call and is not released anymore
+// causing a double delete. Using UnsafeArenaAddAllocated prevents this.
+template <typename T>
+internal::UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>
+UnsafeArenaAllocatedRepeatedPtrFieldBackInserter(
+    RepeatedPtrField<T>* const mutable_field) {
+  return internal::UnsafeArenaAllocatedRepeatedPtrFieldBackInsertIterator<T>(
+      mutable_field);
+}
+
+extern template class PROTOBUF_EXPORT_TEMPLATE_DECLARE
+    RepeatedPtrField<std::string>;
+
+}  // namespace protobuf
+}  // namespace google
+
+#include <google/protobuf/port_undef.inc>
+
+#endif  // GOOGLE_PROTOBUF_REPEATED_PTR_FIELD_H__
diff --git a/src/google/protobuf/source_context.pb.cc b/src/google/protobuf/source_context.pb.cc
index 7748dc3..4edb90b 100644
--- a/src/google/protobuf/source_context.pb.cc
+++ b/src/google/protobuf/source_context.pb.cc
@@ -34,7 +34,7 @@
 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto = nullptr;
 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fsource_5fcontext_2eproto = nullptr;
 
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fsource_5fcontext_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   ~0u,  // no _has_bits_
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::SourceContext, _internal_metadata_),
   ~0u,  // no _extensions_
@@ -93,6 +93,9 @@
   : ::PROTOBUF_NAMESPACE_ID::Message() {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   file_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_file_name().empty()) {
     file_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_file_name(), 
       GetArenaForAllocation());
@@ -100,8 +103,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.SourceContext)
 }
 
-void SourceContext::SharedCtor() {
+inline void SourceContext::SharedCtor() {
 file_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 }
 
 SourceContext::~SourceContext() {
@@ -128,7 +134,7 @@
 
 void SourceContext::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.SourceContext)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -139,12 +145,12 @@
 const char* SourceContext::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // string file_name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_file_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.SourceContext.file_name"));
@@ -175,10 +181,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* SourceContext::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* SourceContext::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.SourceContext)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // string file_name = 1;
@@ -203,7 +209,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.SourceContext)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -233,7 +239,7 @@
 void SourceContext::MergeFrom(const SourceContext& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.SourceContext)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (!from._internal_file_name().empty()) {
diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h
index 13dce1c..28af27d 100644
--- a/src/google/protobuf/source_context.pb.h
+++ b/src/google/protobuf/source_context.pb.h
@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3018000
+#if PROTOBUF_VERSION < 3019000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
@@ -50,7 +50,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
   static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
-  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+  static const uint32_t offsets[];
 };
 PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fsource_5fcontext_2eproto;
 PROTOBUF_NAMESPACE_OPEN
@@ -120,7 +120,12 @@
   }
   inline void Swap(SourceContext* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -134,11 +139,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline SourceContext* New() const final {
-    return new SourceContext();
-  }
-
-  SourceContext* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  SourceContext* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<SourceContext>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -153,8 +154,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -162,6 +163,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(SourceContext* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.SourceContext";
@@ -192,7 +195,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_file_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_file_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_file_name();
+  PROTOBUF_NODISCARD std::string* release_file_name();
   void set_allocated_file_name(std::string* file_name);
   private:
   const std::string& _internal_file_name() const;
@@ -265,6 +268,11 @@
   }
   file_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), file_name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (file_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    file_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.SourceContext.file_name)
 }
 
diff --git a/src/google/protobuf/struct.pb.cc b/src/google/protobuf/struct.pb.cc
index ab60a03..f90e213 100644
--- a/src/google/protobuf/struct.pb.cc
+++ b/src/google/protobuf/struct.pb.cc
@@ -69,7 +69,7 @@
 static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2fstruct_2eproto[1];
 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fstruct_2eproto = nullptr;
 
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fstruct_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fstruct_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, _has_bits_),
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Struct_FieldsEntry_DoNotUse, _internal_metadata_),
   ~0u,  // no _extensions_
@@ -205,7 +205,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Struct)
 }
 
-void Struct::SharedCtor() {
+inline void Struct::SharedCtor() {
 }
 
 Struct::~Struct() {
@@ -235,7 +235,7 @@
 
 void Struct::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Struct)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -246,12 +246,12 @@
 const char* Struct::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // map<string, .google.protobuf.Value> fields = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -285,10 +285,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Struct::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Struct::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Struct)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // map<string, .google.protobuf.Value> fields = 1;
@@ -345,7 +345,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Struct)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -377,7 +377,7 @@
 void Struct::MergeFrom(const Struct& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Struct)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   fields_.MergeFrom(from.fields_);
@@ -498,7 +498,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Value)
 }
 
-void Value::SharedCtor() {
+inline void Value::SharedCtor() {
 clear_has_kind();
 }
 
@@ -567,7 +567,7 @@
 
 void Value::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Value)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -578,13 +578,13 @@
 const char* Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // .google.protobuf.NullValue null_value = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           _internal_set_null_value(static_cast<::PROTOBUF_NAMESPACE_ID::NullValue>(val));
         } else
@@ -592,7 +592,7 @@
         continue;
       // double number_value = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 17)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 17)) {
           _internal_set_number_value(::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr));
           ptr += sizeof(double);
         } else
@@ -600,7 +600,7 @@
         continue;
       // string string_value = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           auto str = _internal_mutable_string_value();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Value.string_value"));
@@ -610,7 +610,7 @@
         continue;
       // bool bool_value = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 32)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 32)) {
           _internal_set_bool_value(::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr));
           CHK_(ptr);
         } else
@@ -618,7 +618,7 @@
         continue;
       // .google.protobuf.Struct struct_value = 5;
       case 5:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
           ptr = ctx->ParseMessage(_internal_mutable_struct_value(), ptr);
           CHK_(ptr);
         } else
@@ -626,7 +626,7 @@
         continue;
       // .google.protobuf.ListValue list_value = 6;
       case 6:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
           ptr = ctx->ParseMessage(_internal_mutable_list_value(), ptr);
           CHK_(ptr);
         } else
@@ -655,10 +655,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Value::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Value::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Value)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // .google.protobuf.NullValue null_value = 1;
@@ -718,7 +718,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Value)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -783,7 +783,7 @@
 void Value::MergeFrom(const Value& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Value)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   switch (from.kind_case()) {
@@ -865,7 +865,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.ListValue)
 }
 
-void ListValue::SharedCtor() {
+inline void ListValue::SharedCtor() {
 }
 
 ListValue::~ListValue() {
@@ -891,7 +891,7 @@
 
 void ListValue::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.ListValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -902,12 +902,12 @@
 const char* ListValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // repeated .google.protobuf.Value values = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -941,10 +941,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* ListValue::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* ListValue::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.ListValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // repeated .google.protobuf.Value values = 1;
@@ -967,7 +967,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.ListValue)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -997,7 +997,7 @@
 void ListValue::MergeFrom(const ListValue& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.ListValue)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   values_.MergeFrom(from.values_);
diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h
index e84004b..8ac5cdb 100644
--- a/src/google/protobuf/struct.pb.h
+++ b/src/google/protobuf/struct.pb.h
@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3018000
+#if PROTOBUF_VERSION < 3019000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
@@ -54,7 +54,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
   static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
-  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+  static const uint32_t offsets[];
 };
 PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fstruct_2eproto;
 PROTOBUF_NAMESPACE_OPEN
@@ -81,8 +81,8 @@
 
 enum NullValue : int {
   NULL_VALUE = 0,
-  NullValue_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
-  NullValue_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
+  NullValue_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(),
+  NullValue_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max()
 };
 PROTOBUF_EXPORT bool NullValue_IsValid(int value);
 constexpr NullValue NullValue_MIN = NULL_VALUE;
@@ -185,7 +185,12 @@
   }
   inline void Swap(Struct* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -199,11 +204,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Struct* New() const final {
-    return new Struct();
-  }
-
-  Struct* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Struct* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Struct>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -218,8 +219,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -227,6 +228,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Struct* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Struct";
@@ -351,7 +354,12 @@
   }
   inline void Swap(Value* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -365,11 +373,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Value* New() const final {
-    return new Value();
-  }
-
-  Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Value>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -384,8 +388,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -393,6 +397,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Value* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Value";
@@ -458,7 +464,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_string_value(ArgT0&& arg0, ArgT... args);
   std::string* mutable_string_value();
-  PROTOBUF_MUST_USE_RESULT std::string* release_string_value();
+  PROTOBUF_NODISCARD std::string* release_string_value();
   void set_allocated_string_value(std::string* string_value);
   private:
   const std::string& _internal_string_value() const;
@@ -486,7 +492,7 @@
   public:
   void clear_struct_value();
   const ::PROTOBUF_NAMESPACE_ID::Struct& struct_value() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::Struct* release_struct_value();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::Struct* release_struct_value();
   ::PROTOBUF_NAMESPACE_ID::Struct* mutable_struct_value();
   void set_allocated_struct_value(::PROTOBUF_NAMESPACE_ID::Struct* struct_value);
   private:
@@ -504,7 +510,7 @@
   public:
   void clear_list_value();
   const ::PROTOBUF_NAMESPACE_ID::ListValue& list_value() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::ListValue* release_list_value();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::ListValue* release_list_value();
   ::PROTOBUF_NAMESPACE_ID::ListValue* mutable_list_value();
   void set_allocated_list_value(::PROTOBUF_NAMESPACE_ID::ListValue* list_value);
   private:
@@ -544,7 +550,7 @@
     ::PROTOBUF_NAMESPACE_ID::ListValue* list_value_;
   } kind_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
-  ::PROTOBUF_NAMESPACE_ID::uint32 _oneof_case_[1];
+  uint32_t _oneof_case_[1];
 
   friend struct ::TableStruct_google_2fprotobuf_2fstruct_2eproto;
 };
@@ -605,7 +611,12 @@
   }
   inline void Swap(ListValue* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -619,11 +630,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline ListValue* New() const final {
-    return new ListValue();
-  }
-
-  ListValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  ListValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<ListValue>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -638,8 +645,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -647,6 +654,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(ListValue* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.ListValue";
diff --git a/src/google/protobuf/struct.proto b/src/google/protobuf/struct.proto
index 545215c..0ac843c 100644
--- a/src/google/protobuf/struct.proto
+++ b/src/google/protobuf/struct.proto
@@ -55,8 +55,8 @@
 
 // `Value` represents a dynamically typed value which can be either
 // null, a number, a string, a boolean, a recursive struct value, or a
-// list of values. A producer of value is expected to set one of that
-// variants, absence of any variant indicates an error.
+// list of values. A producer of value is expected to set one of these
+// variants. Absence of any variant indicates an error.
 //
 // The JSON representation for `Value` is JSON value.
 message Value {
diff --git a/src/google/protobuf/stubs/common.cc b/src/google/protobuf/stubs/common.cc
index 9067818..82d4653 100644
--- a/src/google/protobuf/stubs/common.cc
+++ b/src/google/protobuf/stubs/common.cc
@@ -44,10 +44,6 @@
 #endif
 #include <windows.h>
 #define snprintf _snprintf    // see comment in strutil.cc
-#elif defined(HAVE_PTHREAD)
-#include <pthread.h>
-#else
-#error "No suitable threading library available."
 #endif
 #if defined(__ANDROID__)
 #include <android/log.h>
diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h
index ed4e061..2d71f08 100644
--- a/src/google/protobuf/stubs/common.h
+++ b/src/google/protobuf/stubs/common.h
@@ -82,7 +82,7 @@
 
 // The current version, represented as a single integer to make comparison
 // easier:  major * 10^6 + minor * 10^3 + micro
-#define GOOGLE_PROTOBUF_VERSION 3018001
+#define GOOGLE_PROTOBUF_VERSION 3019004
 
 // A suffix string for alpha, beta or rc releases. Empty for stable releases.
 #define GOOGLE_PROTOBUF_VERSION_SUFFIX ""
@@ -90,15 +90,15 @@
 // The minimum header version which works with the current version of
 // the library.  This constant should only be used by protoc's C++ code
 // generator.
-static const int kMinHeaderVersionForLibrary = 3018000;
+static const int kMinHeaderVersionForLibrary = 3019000;
 
 // The minimum protoc version which works with the current version of the
 // headers.
-#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3018000
+#define GOOGLE_PROTOBUF_MIN_PROTOC_VERSION 3019000
 
 // The minimum header version which works with the current version of
 // protoc.  This constant should only be used in VerifyVersion().
-static const int kMinHeaderVersionForProtoc = 3018000;
+static const int kMinHeaderVersionForProtoc = 3019000;
 
 // Verifies that the headers and libraries are compatible.  Use the macro
 // below to call this.
@@ -176,7 +176,7 @@
       : filename_(filename), line_(line), message_(message) {}
   virtual ~FatalException() throw();
 
-  virtual const char* what() const throw() override;
+  const char* what() const throw() override;
 
   const char* filename() const { return filename_; }
   int line() const { return line_; }
diff --git a/src/google/protobuf/stubs/mathutil.h b/src/google/protobuf/stubs/mathutil.h
index 7116d2d..1d16bce 100644
--- a/src/google/protobuf/stubs/mathutil.h
+++ b/src/google/protobuf/stubs/mathutil.h
@@ -51,7 +51,7 @@
 // types.
 template <typename T,
           typename std::enable_if<std::is_integral<T>::value, int>::type = 0>
-bool IsNan(T val) {
+bool IsNan(T /*val*/) {
   return false;
 }
 
diff --git a/src/google/protobuf/stubs/mutex.h b/src/google/protobuf/stubs/mutex.h
index 5c025b1..c459991 100644
--- a/src/google/protobuf/stubs/mutex.h
+++ b/src/google/protobuf/stubs/mutex.h
@@ -144,10 +144,11 @@
 // MutexLock(mu) acquires mu when constructed and releases it when destroyed.
 class GOOGLE_PROTOBUF_SCOPED_CAPABILITY PROTOBUF_EXPORT MutexLock {
  public:
-  explicit MutexLock(Mutex *mu) GOOGLE_PROTOBUF_ACQUIRE(mu) : mu_(mu) {
+  explicit MutexLock(Mutex* mu) GOOGLE_PROTOBUF_ACQUIRE(mu) : mu_(mu) {
     this->mu_->Lock();
   }
   ~MutexLock() GOOGLE_PROTOBUF_RELEASE() { this->mu_->Unlock(); }
+
  private:
   Mutex *const mu_;
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(MutexLock);
diff --git a/src/google/protobuf/stubs/port.h b/src/google/protobuf/stubs/port.h
index d4d2736..045e25d 100644
--- a/src/google/protobuf/stubs/port.h
+++ b/src/google/protobuf/stubs/port.h
@@ -61,6 +61,10 @@
 #include <machine/endian.h>  // __BYTE_ORDER
 #elif defined(__FreeBSD__)
 #include <sys/endian.h>  // __BYTE_ORDER
+#elif (defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__))
+#include <sys/isa_defs.h>  // __BYTE_ORDER
+#elif defined(_AIX) || defined(__TOS_AIX__)
+#include <sys/machine.h>  // BYTE_ORDER
 #else
 #if !defined(__QNX__)
 #include <endian.h>  // __BYTE_ORDER
@@ -265,8 +269,7 @@
 
 #ifndef bswap_64
 static inline uint64 bswap_64(uint64 x) {
-  return (((x & uint64_t{0xFFu}) << 56) |
-          ((x & uint64_t{0xFF00u}) << 40) |
+  return (((x & uint64_t{0xFFu}) << 56) | ((x & uint64_t{0xFF00u}) << 40) |
           ((x & uint64_t{0xFF0000u}) << 24) |
           ((x & uint64_t{0xFF000000u}) << 8) |
           ((x & uint64_t{0xFF00000000u}) >> 8) |
diff --git a/src/google/protobuf/stubs/statusor.h b/src/google/protobuf/stubs/statusor.h
index a569502..20e603e 100644
--- a/src/google/protobuf/stubs/statusor.h
+++ b/src/google/protobuf/stubs/statusor.h
@@ -166,7 +166,7 @@
 template<typename T>
 struct StatusOrHelper::Specialize {
   // For non-pointer T, a reference can never be nullptr.
-  static inline bool IsValueNull(const T& t) { return false; }
+  static inline bool IsValueNull(const T& /*t*/) { return false; }
 };
 
 template<typename T>
diff --git a/src/google/protobuf/stubs/stringprintf.cc b/src/google/protobuf/stubs/stringprintf.cc
index 0761986..a6ad4c0 100644
--- a/src/google/protobuf/stubs/stringprintf.cc
+++ b/src/google/protobuf/stubs/stringprintf.cc
@@ -44,14 +44,11 @@
 namespace protobuf {
 
 #ifdef _MSC_VER
-enum { IS_COMPILER_MSVC = 1 };
 #ifndef va_copy
 // Define va_copy for MSVC. This is a hack, assuming va_list is simply a
 // pointer into the stack and is safe to copy.
 #define va_copy(dest, src) ((dest) = (src))
 #endif
-#else
-enum { IS_COMPILER_MSVC = 0 };
 #endif
 
 void StringAppendV(std::string* dst, const char* format, va_list ap) {
@@ -74,13 +71,15 @@
       return;
     }
 
-    if (IS_COMPILER_MSVC) {
+#ifdef _MSC_VER
+    {
       // Error or MSVC running out of space.  MSVC 8.0 and higher
       // can be asked about space needed with the special idiom below:
       va_copy(backup_ap, ap);
       result = vsnprintf(nullptr, 0, format, backup_ap);
       va_end(backup_ap);
     }
+#endif
 
     if (result < 0) {
       // Just an error.
diff --git a/src/google/protobuf/stubs/stringprintf_unittest.cc b/src/google/protobuf/stubs/stringprintf_unittest.cc
index 63f38bf..dbecd2b 100644
--- a/src/google/protobuf/stubs/stringprintf_unittest.cc
+++ b/src/google/protobuf/stubs/stringprintf_unittest.cc
@@ -31,14 +31,13 @@
 // from google3/base/stringprintf_unittest.cc
 
 #include <google/protobuf/stubs/stringprintf.h>
+#include <google/protobuf/testing/googletest.h>
+#include <gtest/gtest.h>
 
 #include <array>
 #include <cerrno>
 #include <string>
 
-#include <google/protobuf/testing/googletest.h>
-#include <gtest/gtest.h>
-
 namespace google {
 namespace protobuf {
 namespace {
@@ -110,10 +109,10 @@
   // Repeat with longer string, to make sure that the dynamically
   // allocated path in StringAppendV is handled correctly.
   const size_t n = 2048;
-  std::array<char, n+1> buf;
-  memset(&buf[0], ' ', n-3);
+  std::array<char, n + 1> buf;
+  memset(&buf[0], ' ', n - 3);
   memcpy(&buf[0] + n - 3, kInvalidCodePoint, 4);
-  value =  StringPrintf("%.*s", n, &buf[0]);
+  value = StringPrintf("%.*s", n, &buf[0]);
   // See GRTEv2 vs. GRTEv3 comment above.
   EXPECT_TRUE(value.empty() || value == &buf[0]);
 
diff --git a/src/google/protobuf/stubs/strutil.cc b/src/google/protobuf/stubs/strutil.cc
index 0865f9f..6bead9a 100644
--- a/src/google/protobuf/stubs/strutil.cc
+++ b/src/google/protobuf/stubs/strutil.cc
@@ -1272,8 +1272,8 @@
   // truncated to a double.
   volatile double parsed_value = internal::NoLocaleStrtod(buffer, nullptr);
   if (parsed_value != value) {
-    int snprintf_result =
-      snprintf(buffer, kDoubleToBufferSize, "%.*g", DBL_DIG+2, value);
+    snprintf_result =
+        snprintf(buffer, kDoubleToBufferSize, "%.*g", DBL_DIG + 2, value);
 
     // Should never overflow; see above.
     GOOGLE_DCHECK(snprintf_result > 0 && snprintf_result < kDoubleToBufferSize);
@@ -1384,8 +1384,8 @@
 
   float parsed_value;
   if (!safe_strtof(buffer, &parsed_value) || parsed_value != value) {
-    int snprintf_result =
-      snprintf(buffer, kFloatToBufferSize, "%.*g", FLT_DIG+3, value);
+    snprintf_result =
+        snprintf(buffer, kFloatToBufferSize, "%.*g", FLT_DIG + 3, value);
 
     // Should never overflow; see above.
     GOOGLE_DCHECK(snprintf_result > 0 && snprintf_result < kFloatToBufferSize);
diff --git a/src/google/protobuf/stubs/strutil_unittest.cc b/src/google/protobuf/stubs/strutil_unittest.cc
index 0fbfab4..0bb9558 100644
--- a/src/google/protobuf/stubs/strutil_unittest.cc
+++ b/src/google/protobuf/stubs/strutil_unittest.cc
@@ -345,93 +345,97 @@
   const char* plaintext;
   const char* ciphertext;
 } base64_strings[] = {
-  // Some google quotes
-  // Ciphertext created with "uuencode (GNU sharutils) 4.6.3"
-  // (Note that we're testing the websafe encoding, though, so if
-  // you add messages, be sure to run "tr -- '+/' '-_'" on the output)
-  { "I was always good at math and science, and I never realized "
-    "that was unusual or somehow undesirable. So one of the things "
-    "I care a lot about is helping to remove that stigma, "
-    "to show girls that you can be feminine, you can like the things "
-    "that girls like, but you can also be really good at technology. "
-    "You can be really good at building things."
-    " - Marissa Meyer, Newsweek, 2010-12-22" "\n",
+    // Some google quotes
+    // Ciphertext created with "uuencode (GNU sharutils) 4.6.3"
+    // (Note that we're testing the websafe encoding, though, so if
+    // you add messages, be sure to run "tr -- '+/' '-_'" on the output)
+    {"I was always good at math and science, and I never realized "
+     "that was unusual or somehow undesirable. So one of the things "
+     "I care a lot about is helping to remove that stigma, "
+     "to show girls that you can be feminine, you can like the things "
+     "that girls like, but you can also be really good at technology. "
+     "You can be really good at building things."
+     " - Marissa Meyer, Newsweek, 2010-12-22"
+     "\n",
 
-    "SSB3YXMgYWx3YXlzIGdvb2QgYXQgbWF0aCBhbmQgc2NpZW5jZSwgYW5kIEkg"
-    "bmV2ZXIgcmVhbGl6ZWQgdGhhdCB3YXMgdW51c3VhbCBvciBzb21laG93IHVu"
-    "ZGVzaXJhYmxlLiBTbyBvbmUgb2YgdGhlIHRoaW5ncyBJIGNhcmUgYSBsb3Qg"
-    "YWJvdXQgaXMgaGVscGluZyB0byByZW1vdmUgdGhhdCBzdGlnbWEsIHRvIHNo"
-    "b3cgZ2lybHMgdGhhdCB5b3UgY2FuIGJlIGZlbWluaW5lLCB5b3UgY2FuIGxp"
-    "a2UgdGhlIHRoaW5ncyB0aGF0IGdpcmxzIGxpa2UsIGJ1dCB5b3UgY2FuIGFs"
-    "c28gYmUgcmVhbGx5IGdvb2QgYXQgdGVjaG5vbG9neS4gWW91IGNhbiBiZSBy"
-    "ZWFsbHkgZ29vZCBhdCBidWlsZGluZyB0aGluZ3MuIC0gTWFyaXNzYSBNZXll"
-    "ciwgTmV3c3dlZWssIDIwMTAtMTItMjIK" },
+     "SSB3YXMgYWx3YXlzIGdvb2QgYXQgbWF0aCBhbmQgc2NpZW5jZSwgYW5kIEkg"
+     "bmV2ZXIgcmVhbGl6ZWQgdGhhdCB3YXMgdW51c3VhbCBvciBzb21laG93IHVu"
+     "ZGVzaXJhYmxlLiBTbyBvbmUgb2YgdGhlIHRoaW5ncyBJIGNhcmUgYSBsb3Qg"
+     "YWJvdXQgaXMgaGVscGluZyB0byByZW1vdmUgdGhhdCBzdGlnbWEsIHRvIHNo"
+     "b3cgZ2lybHMgdGhhdCB5b3UgY2FuIGJlIGZlbWluaW5lLCB5b3UgY2FuIGxp"
+     "a2UgdGhlIHRoaW5ncyB0aGF0IGdpcmxzIGxpa2UsIGJ1dCB5b3UgY2FuIGFs"
+     "c28gYmUgcmVhbGx5IGdvb2QgYXQgdGVjaG5vbG9neS4gWW91IGNhbiBiZSBy"
+     "ZWFsbHkgZ29vZCBhdCBidWlsZGluZyB0aGluZ3MuIC0gTWFyaXNzYSBNZXll"
+     "ciwgTmV3c3dlZWssIDIwMTAtMTItMjIK"},
 
-  { "Typical first year for a new cluster: "
-    "~0.5 overheating "
-    "~1 PDU failure "
-    "~1 rack-move "
-    "~1 network rewiring "
-    "~20 rack failures "
-    "~5 racks go wonky "
-    "~8 network maintenances "
-    "~12 router reloads "
-    "~3 router failures "
-    "~dozens of minor 30-second blips for dns "
-    "~1000 individual machine failures "
-    "~thousands of hard drive failures "
-    "slow disks, bad memory, misconfigured machines, flaky machines, etc."
-    " - Jeff Dean, The Joys of Real Hardware" "\n",
+    {"Typical first year for a new cluster: "
+     "~0.5 overheating "
+     "~1 PDU failure "
+     "~1 rack-move "
+     "~1 network rewiring "
+     "~20 rack failures "
+     "~5 racks go wonky "
+     "~8 network maintenances "
+     "~12 router reloads "
+     "~3 router failures "
+     "~dozens of minor 30-second blips for dns "
+     "~1000 individual machine failures "
+     "~thousands of hard drive failures "
+     "slow disks, bad memory, misconfigured machines, flaky machines, etc."
+     " - Jeff Dean, The Joys of Real Hardware"
+     "\n",
 
-    "VHlwaWNhbCBmaXJzdCB5ZWFyIGZvciBhIG5ldyBjbHVzdGVyOiB-MC41IG92"
-    "ZXJoZWF0aW5nIH4xIFBEVSBmYWlsdXJlIH4xIHJhY2stbW92ZSB-MSBuZXR3"
-    "b3JrIHJld2lyaW5nIH4yMCByYWNrIGZhaWx1cmVzIH41IHJhY2tzIGdvIHdv"
-    "bmt5IH44IG5ldHdvcmsgbWFpbnRlbmFuY2VzIH4xMiByb3V0ZXIgcmVsb2Fk"
-    "cyB-MyByb3V0ZXIgZmFpbHVyZXMgfmRvemVucyBvZiBtaW5vciAzMC1zZWNv"
-    "bmQgYmxpcHMgZm9yIGRucyB-MTAwMCBpbmRpdmlkdWFsIG1hY2hpbmUgZmFp"
-    "bHVyZXMgfnRob3VzYW5kcyBvZiBoYXJkIGRyaXZlIGZhaWx1cmVzIHNsb3cg"
-    "ZGlza3MsIGJhZCBtZW1vcnksIG1pc2NvbmZpZ3VyZWQgbWFjaGluZXMsIGZs"
-    "YWt5IG1hY2hpbmVzLCBldGMuIC0gSmVmZiBEZWFuLCBUaGUgSm95cyBvZiBS"
-    "ZWFsIEhhcmR3YXJlCg" },
+     "VHlwaWNhbCBmaXJzdCB5ZWFyIGZvciBhIG5ldyBjbHVzdGVyOiB-MC41IG92"
+     "ZXJoZWF0aW5nIH4xIFBEVSBmYWlsdXJlIH4xIHJhY2stbW92ZSB-MSBuZXR3"
+     "b3JrIHJld2lyaW5nIH4yMCByYWNrIGZhaWx1cmVzIH41IHJhY2tzIGdvIHdv"
+     "bmt5IH44IG5ldHdvcmsgbWFpbnRlbmFuY2VzIH4xMiByb3V0ZXIgcmVsb2Fk"
+     "cyB-MyByb3V0ZXIgZmFpbHVyZXMgfmRvemVucyBvZiBtaW5vciAzMC1zZWNv"
+     "bmQgYmxpcHMgZm9yIGRucyB-MTAwMCBpbmRpdmlkdWFsIG1hY2hpbmUgZmFp"
+     "bHVyZXMgfnRob3VzYW5kcyBvZiBoYXJkIGRyaXZlIGZhaWx1cmVzIHNsb3cg"
+     "ZGlza3MsIGJhZCBtZW1vcnksIG1pc2NvbmZpZ3VyZWQgbWFjaGluZXMsIGZs"
+     "YWt5IG1hY2hpbmVzLCBldGMuIC0gSmVmZiBEZWFuLCBUaGUgSm95cyBvZiBS"
+     "ZWFsIEhhcmR3YXJlCg"},
 
-  { "I'm the head of the webspam team at Google.  "
-    "That means that if you type your name into Google and get porn back, "
-    "it's my fault. Unless you're a porn star, in which case porn is a "
-    "completely reasonable response."
-    " - Matt Cutts, Google Plus" "\n",
+    {"I'm the head of the webspam team at Google.  "
+     "That means that if you type your name into Google and get porn back, "
+     "it's my fault. Unless you're a porn star, in which case porn is a "
+     "completely reasonable response."
+     " - Matt Cutts, Google Plus"
+     "\n",
 
-    "SSdtIHRoZSBoZWFkIG9mIHRoZSB3ZWJzcGFtIHRlYW0gYXQgR29vZ2xlLiAg"
-    "VGhhdCBtZWFucyB0aGF0IGlmIHlvdSB0eXBlIHlvdXIgbmFtZSBpbnRvIEdv"
-    "b2dsZSBhbmQgZ2V0IHBvcm4gYmFjaywgaXQncyBteSBmYXVsdC4gVW5sZXNz"
-    "IHlvdSdyZSBhIHBvcm4gc3RhciwgaW4gd2hpY2ggY2FzZSBwb3JuIGlzIGEg"
-    "Y29tcGxldGVseSByZWFzb25hYmxlIHJlc3BvbnNlLiAtIE1hdHQgQ3V0dHMs"
-    "IEdvb2dsZSBQbHVzCg" },
+     "SSdtIHRoZSBoZWFkIG9mIHRoZSB3ZWJzcGFtIHRlYW0gYXQgR29vZ2xlLiAg"
+     "VGhhdCBtZWFucyB0aGF0IGlmIHlvdSB0eXBlIHlvdXIgbmFtZSBpbnRvIEdv"
+     "b2dsZSBhbmQgZ2V0IHBvcm4gYmFjaywgaXQncyBteSBmYXVsdC4gVW5sZXNz"
+     "IHlvdSdyZSBhIHBvcm4gc3RhciwgaW4gd2hpY2ggY2FzZSBwb3JuIGlzIGEg"
+     "Y29tcGxldGVseSByZWFzb25hYmxlIHJlc3BvbnNlLiAtIE1hdHQgQ3V0dHMs"
+     "IEdvb2dsZSBQbHVzCg"},
 
-  { "It will still be a long time before machines approach human intelligence. "
-    "But luckily, machines don't actually have to be intelligent; "
-    "they just have to fake it. Access to a wealth of information, "
-    "combined with a rudimentary decision-making capacity, "
-    "can often be almost as useful. Of course, the results are better yet "
-    "when coupled with intelligence. A reference librarian with access to "
-    "a good search engine is a formidable tool."
-    " - Craig Silverstein, Siemens Pictures of the Future, Spring 2004" "\n",
+    {"It will still be a long time before machines approach human "
+     "intelligence. "
+     "But luckily, machines don't actually have to be intelligent; "
+     "they just have to fake it. Access to a wealth of information, "
+     "combined with a rudimentary decision-making capacity, "
+     "can often be almost as useful. Of course, the results are better yet "
+     "when coupled with intelligence. A reference librarian with access to "
+     "a good search engine is a formidable tool."
+     " - Craig Silverstein, Siemens Pictures of the Future, Spring 2004"
+     "\n",
 
-    "SXQgd2lsbCBzdGlsbCBiZSBhIGxvbmcgdGltZSBiZWZvcmUgbWFjaGluZXMg"
-    "YXBwcm9hY2ggaHVtYW4gaW50ZWxsaWdlbmNlLiBCdXQgbHVja2lseSwgbWFj"
-    "aGluZXMgZG9uJ3QgYWN0dWFsbHkgaGF2ZSB0byBiZSBpbnRlbGxpZ2VudDsg"
-    "dGhleSBqdXN0IGhhdmUgdG8gZmFrZSBpdC4gQWNjZXNzIHRvIGEgd2VhbHRo"
-    "IG9mIGluZm9ybWF0aW9uLCBjb21iaW5lZCB3aXRoIGEgcnVkaW1lbnRhcnkg"
-    "ZGVjaXNpb24tbWFraW5nIGNhcGFjaXR5LCBjYW4gb2Z0ZW4gYmUgYWxtb3N0"
-    "IGFzIHVzZWZ1bC4gT2YgY291cnNlLCB0aGUgcmVzdWx0cyBhcmUgYmV0dGVy"
-    "IHlldCB3aGVuIGNvdXBsZWQgd2l0aCBpbnRlbGxpZ2VuY2UuIEEgcmVmZXJl"
-    "bmNlIGxpYnJhcmlhbiB3aXRoIGFjY2VzcyB0byBhIGdvb2Qgc2VhcmNoIGVu"
-    "Z2luZSBpcyBhIGZvcm1pZGFibGUgdG9vbC4gLSBDcmFpZyBTaWx2ZXJzdGVp"
-    "biwgU2llbWVucyBQaWN0dXJlcyBvZiB0aGUgRnV0dXJlLCBTcHJpbmcgMjAw"
-    "NAo" },
+     "SXQgd2lsbCBzdGlsbCBiZSBhIGxvbmcgdGltZSBiZWZvcmUgbWFjaGluZXMg"
+     "YXBwcm9hY2ggaHVtYW4gaW50ZWxsaWdlbmNlLiBCdXQgbHVja2lseSwgbWFj"
+     "aGluZXMgZG9uJ3QgYWN0dWFsbHkgaGF2ZSB0byBiZSBpbnRlbGxpZ2VudDsg"
+     "dGhleSBqdXN0IGhhdmUgdG8gZmFrZSBpdC4gQWNjZXNzIHRvIGEgd2VhbHRo"
+     "IG9mIGluZm9ybWF0aW9uLCBjb21iaW5lZCB3aXRoIGEgcnVkaW1lbnRhcnkg"
+     "ZGVjaXNpb24tbWFraW5nIGNhcGFjaXR5LCBjYW4gb2Z0ZW4gYmUgYWxtb3N0"
+     "IGFzIHVzZWZ1bC4gT2YgY291cnNlLCB0aGUgcmVzdWx0cyBhcmUgYmV0dGVy"
+     "IHlldCB3aGVuIGNvdXBsZWQgd2l0aCBpbnRlbGxpZ2VuY2UuIEEgcmVmZXJl"
+     "bmNlIGxpYnJhcmlhbiB3aXRoIGFjY2VzcyB0byBhIGdvb2Qgc2VhcmNoIGVu"
+     "Z2luZSBpcyBhIGZvcm1pZGFibGUgdG9vbC4gLSBDcmFpZyBTaWx2ZXJzdGVp"
+     "biwgU2llbWVucyBQaWN0dXJlcyBvZiB0aGUgRnV0dXJlLCBTcHJpbmcgMjAw"
+     "NAo"},
 
-  // Degenerate edge case
-  { "",
-    "" },
+    // Degenerate edge case
+    {"", ""},
 };
 
 TEST(Base64, EscapeAndUnescape) {
@@ -469,10 +473,9 @@
 
     // If we encode it into a buffer of exactly the right length...
     memset(encode_buffer, 0, sizeof(encode_buffer));
-    encode_length = Base64Escape(unsigned_plaintext,
-                                          base64_tests[i].plain_length,
-                                          encode_buffer,
-                                          cipher_length);
+    encode_length =
+        Base64Escape(unsigned_plaintext, base64_tests[i].plain_length,
+                     encode_buffer, cipher_length);
     //    Is it still of the expected length?
     EXPECT_EQ(encode_length, cipher_length);
 
@@ -481,8 +484,8 @@
 
     // If we decode it back:
     decode_str.clear();
-    EXPECT_TRUE(Base64Unescape(
-        StringPiece(encode_buffer, cipher_length), &decode_str));
+    EXPECT_TRUE(
+        Base64Unescape(StringPiece(encode_buffer, cipher_length), &decode_str));
 
     //    Is it of the expected length?
     EXPECT_EQ(base64_tests[i].plain_length, decode_str.length());
@@ -498,8 +501,8 @@
     EXPECT_EQ(encoded, std::string(encode_buffer, cipher_length));
 
     std::string decoded("this junk should be ignored");
-    EXPECT_TRUE(Base64Unescape(
-        StringPiece(encode_buffer, cipher_length), &decoded));
+    EXPECT_TRUE(
+        Base64Unescape(StringPiece(encode_buffer, cipher_length), &decoded));
     EXPECT_EQ(decoded.size(), base64_tests[i].plain_length);
     EXPECT_EQ_ARRAY(decoded.size(), decoded, base64_tests[i].plaintext, i);
 
@@ -602,11 +605,9 @@
 
     //    If we encode it into a buffer of exactly the right length...
     memset(encode_buffer, 0, sizeof(encode_buffer));
-    encode_length = WebSafeBase64Escape(unsigned_plaintext,
-                                                 base64_tests[i].plain_length,
-                                                 encode_buffer,
-                                                 cipher_length,
-                                                 true);
+    encode_length =
+        WebSafeBase64Escape(unsigned_plaintext, base64_tests[i].plain_length,
+                            encode_buffer, cipher_length, true);
     //    Is it still of the expected length?
     EXPECT_EQ(encode_length, cipher_length);
 
@@ -623,10 +624,8 @@
 
     //    If we decode it back:
     memset(decode_buffer, 0, sizeof(decode_buffer));
-    decode_length = WebSafeBase64Unescape(encode_buffer,
-                                                   cipher_length,
-                                                   decode_buffer,
-                                                   sizeof(decode_buffer));
+    decode_length = WebSafeBase64Unescape(encode_buffer, cipher_length,
+                                          decode_buffer, sizeof(decode_buffer));
 
     //    Is it of the expected length?
     EXPECT_EQ(decode_length, base64_tests[i].plain_length);
@@ -637,10 +636,8 @@
 
     //    If we decode it into a buffer of exactly the right length...
     memset(decode_buffer, 0, sizeof(decode_buffer));
-    decode_length = WebSafeBase64Unescape(encode_buffer,
-                                                   cipher_length,
-                                                   decode_buffer,
-                                                   decode_length);
+    decode_length = WebSafeBase64Unescape(encode_buffer, cipher_length,
+                                          decode_buffer, decode_length);
 
     //    Is it still of the expected length?
     EXPECT_EQ(decode_length, base64_tests[i].plain_length);
@@ -656,10 +653,8 @@
 
     // If we decode it back:
     memset(decode_buffer, 0, sizeof(decode_buffer));
-    decode_length = WebSafeBase64Unescape(encode_buffer,
-                                                   cipher_length,
-                                                   decode_buffer,
-                                                   sizeof(decode_buffer));
+    decode_length = WebSafeBase64Unescape(encode_buffer, cipher_length,
+                                          decode_buffer, sizeof(decode_buffer));
 
     // Is it of the expected length?
     EXPECT_EQ(decode_length, base64_tests[i].plain_length);
@@ -670,10 +665,8 @@
 
     // If we decode it into a buffer of exactly the right length...
     memset(decode_buffer, 0, sizeof(decode_buffer));
-    decode_length = WebSafeBase64Unescape(encode_buffer,
-                                                   cipher_length,
-                                                   decode_buffer,
-                                                   decode_length);
+    decode_length = WebSafeBase64Unescape(encode_buffer, cipher_length,
+                                          decode_buffer, decode_length);
 
     // Is it still of the expected length?
     EXPECT_EQ(decode_length, base64_tests[i].plain_length);
@@ -684,8 +677,8 @@
 
     // Let's try the string version of the decoder
     decoded = "this junk should be ignored";
-    EXPECT_TRUE(WebSafeBase64Unescape(
-        StringPiece(encode_buffer, cipher_length), &decoded));
+    EXPECT_TRUE(WebSafeBase64Unescape(StringPiece(encode_buffer, cipher_length),
+                                      &decoded));
     EXPECT_EQ(decoded.size(), base64_tests[i].plain_length);
     EXPECT_EQ_ARRAY(decoded.size(), decoded, base64_tests[i].plaintext, i);
 
@@ -718,11 +711,9 @@
 
     //    If we encode it into a buffer of exactly the right length...
     memset(encode_buffer, 0, sizeof(encode_buffer));
-    encode_length = WebSafeBase64Escape(unsigned_plaintext,
-                                                 base64_tests[i].plain_length,
-                                                 encode_buffer,
-                                                 cipher_length,
-                                                 false);
+    encode_length =
+        WebSafeBase64Escape(unsigned_plaintext, base64_tests[i].plain_length,
+                            encode_buffer, cipher_length, false);
     //    Is it still of the expected length?
     EXPECT_EQ(encode_length, cipher_length);
 
@@ -738,10 +729,8 @@
 
     //    If we decode it back:
     memset(decode_buffer, 0, sizeof(decode_buffer));
-    decode_length = WebSafeBase64Unescape(encode_buffer,
-                                                   cipher_length,
-                                                   decode_buffer,
-                                                   sizeof(decode_buffer));
+    decode_length = WebSafeBase64Unescape(encode_buffer, cipher_length,
+                                          decode_buffer, sizeof(decode_buffer));
 
     //    Is it of the expected length?
     EXPECT_EQ(decode_length, base64_tests[i].plain_length);
@@ -752,10 +741,8 @@
 
     //    If we decode it into a buffer of exactly the right length...
     memset(decode_buffer, 0, sizeof(decode_buffer));
-    decode_length = WebSafeBase64Unescape(encode_buffer,
-                                                   cipher_length,
-                                                   decode_buffer,
-                                                   decode_length);
+    decode_length = WebSafeBase64Unescape(encode_buffer, cipher_length,
+                                          decode_buffer, decode_length);
 
     //    Is it still of the expected length?
     EXPECT_EQ(decode_length, base64_tests[i].plain_length);
@@ -767,8 +754,8 @@
 
     // Let's try the string version of the decoder
     decoded = "this junk should be ignored";
-    EXPECT_TRUE(WebSafeBase64Unescape(
-        StringPiece(encode_buffer, cipher_length), &decoded));
+    EXPECT_TRUE(WebSafeBase64Unescape(StringPiece(encode_buffer, cipher_length),
+                                      &decoded));
     EXPECT_EQ(decoded.size(), base64_tests[i].plain_length);
     EXPECT_EQ_ARRAY(decoded.size(), decoded, base64_tests[i].plaintext, i);
 
@@ -782,7 +769,7 @@
       reinterpret_cast<const unsigned char*>(base64_strings[i].plaintext);
     int plain_length = strlen(base64_strings[i].plaintext);
     int cipher_length = strlen(base64_strings[i].ciphertext);
-    std::vector<char> buffer(cipher_length+1);
+    std::vector<char> buffer(cipher_length + 1);
     int encode_length = WebSafeBase64Escape(unsigned_plaintext,
                                                      plain_length,
                                                      &buffer[0],
diff --git a/src/google/protobuf/test_messages_proto2.proto b/src/google/protobuf/test_messages_proto2.proto
index d064fbb..39fc123 100644
--- a/src/google/protobuf/test_messages_proto2.proto
+++ b/src/google/protobuf/test_messages_proto2.proto
@@ -194,6 +194,22 @@
     optional uint32 group_uint32 = 203;
   }
 
+  // default values
+  optional int32 default_int32 = 241 [ default = -123456789];
+  optional int64 default_int64 = 242 [ default = -9123456789123456789];
+  optional uint32 default_uint32 = 243 [ default = 2123456789];
+  optional uint64 default_uint64 = 244 [ default = 10123456789123456789];
+  optional sint32 default_sint32 = 245 [ default = -123456789];
+  optional sint64 default_sint64 = 246 [default = -9123456789123456789];
+  optional fixed32 default_fixed32 = 247 [ default = 2123456789];
+  optional fixed64 default_fixed64 = 248 [ default = 10123456789123456789];
+  optional sfixed32 default_sfixed32 = 249 [ default = -123456789];
+  optional sfixed64 default_sfixed64 = 250 [default = -9123456789123456789];
+  optional float default_float = 251 [ default = 9e9];
+  optional double default_double = 252 [ default = 7e22];
+  optional bool default_bool = 253 [ default = true];
+  optional string default_string = 254 [ default = "Rosebud"];
+
   // Test field-name-to-JSON-name convention.
   // (protobuf says names can be any valid C/C++ identifier.)
   optional int32 fieldname1 = 401;
diff --git a/src/google/protobuf/text_format.cc b/src/google/protobuf/text_format.cc
index 13bf91c..8b20d76 100644
--- a/src/google/protobuf/text_format.cc
+++ b/src/google/protobuf/text_format.cc
@@ -38,6 +38,7 @@
 #include <stdio.h>
 
 #include <algorithm>
+#include <atomic>
 #include <climits>
 #include <cmath>
 #include <limits>
@@ -84,11 +85,18 @@
 
 }  // namespace
 
+namespace internal {
+// Controls insertion of DEBUG_STRING_SILENT_MARKER.
+PROTOBUF_EXPORT std::atomic<bool> enable_debug_text_format_marker;
+}  // namespace internal
+
 std::string Message::DebugString() const {
   std::string debug_string;
 
   TextFormat::Printer printer;
   printer.SetExpandAny(true);
+  printer.SetInsertSilentMarker(internal::enable_debug_text_format_marker.load(
+      std::memory_order_relaxed));
 
   printer.PrintToString(*this, &debug_string);
 
@@ -101,6 +109,8 @@
   TextFormat::Printer printer;
   printer.SetSingleLineMode(true);
   printer.SetExpandAny(true);
+  printer.SetInsertSilentMarker(internal::enable_debug_text_format_marker.load(
+      std::memory_order_relaxed));
 
   printer.PrintToString(*this, &debug_string);
   // Single line mode currently might have an extra space at the end.
@@ -117,6 +127,8 @@
   TextFormat::Printer printer;
   printer.SetUseUtf8StringEscaping(true);
   printer.SetExpandAny(true);
+  printer.SetInsertSilentMarker(internal::enable_debug_text_format_marker.load(
+      std::memory_order_relaxed));
 
   printer.PrintToString(*this, &debug_string);
 
@@ -348,6 +360,12 @@
   }
 
  private:
+  static constexpr int32_t kint32max = std::numeric_limits<int32_t>::max();
+  static constexpr uint32_t kuint32max = std::numeric_limits<uint32_t>::max();
+  static constexpr int64_t kint64min = std::numeric_limits<int64_t>::min();
+  static constexpr int64_t kint64max = std::numeric_limits<int64_t>::max();
+  static constexpr uint64_t kuint64max = std::numeric_limits<uint64_t>::max();
+
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(ParserImpl);
 
   // Reports an error with the given message with information indicating
@@ -408,14 +426,19 @@
         TryConsume("[")) {
       std::string full_type_name, prefix;
       DO(ConsumeAnyTypeUrl(&full_type_name, &prefix));
-      DO(Consume("]"));
-      TryConsume(":");  // ':' is optional between message labels and values.
+      std::string prefix_and_full_type_name =
+          StrCat(prefix, full_type_name);
+      DO(ConsumeBeforeWhitespace("]"));
+      TryConsumeWhitespace(prefix_and_full_type_name, "Any");
+      // ':' is optional between message labels and values.
+      TryConsumeBeforeWhitespace(":");
+      TryConsumeWhitespace(prefix_and_full_type_name, "Any");
       std::string serialized_value;
       const Descriptor* value_descriptor =
           finder_ ? finder_->FindAnyType(*message, prefix, full_type_name)
                   : DefaultFinderFindAnyType(*message, prefix, full_type_name);
       if (value_descriptor == nullptr) {
-        ReportError("Could not find type \"" + prefix + full_type_name +
+        ReportError("Could not find type \"" + prefix_and_full_type_name +
                     "\" stored in google.protobuf.Any.");
         return false;
       }
@@ -431,14 +454,15 @@
         }
       }
       reflection->SetString(message, any_type_url_field,
-                            std::string(prefix + full_type_name));
+                            prefix_and_full_type_name);
       reflection->SetString(message, any_value_field, serialized_value);
       return true;
     }
     if (TryConsume("[")) {
       // Extension.
       DO(ConsumeFullTypeName(&field_name));
-      DO(Consume("]"));
+      DO(ConsumeBeforeWhitespace("]"));
+      TryConsumeWhitespace(message->GetTypeName(), "Extension");
 
       field = finder_ ? finder_->FindExtension(message, field_name)
                       : DefaultFinderFindExtension(message, field_name);
@@ -457,7 +481,8 @@
         }
       }
     } else {
-      DO(ConsumeIdentifier(&field_name));
+      DO(ConsumeIdentifierBeforeWhitespace(&field_name));
+      TryConsumeWhitespace(message->GetTypeName(), "Normal");
 
       int32_t field_number;
       if (allow_field_number_ && safe_strto32(field_name, &field_number)) {
@@ -525,11 +550,13 @@
       // start with "{" or "<" which indicates the beginning of a message body.
       // If there is no ":" or there is a "{" or "<" after ":", this field has
       // to be a message or the input is ill-formed.
-      if (TryConsume(":") && !LookingAt("{") && !LookingAt("<")) {
-        return SkipFieldValue();
-      } else {
-        return SkipFieldMessage();
+      if (TryConsumeBeforeWhitespace(":")) {
+        TryConsumeWhitespace(message->GetTypeName(), "Unknown/Reserved");
+        if (!LookingAt("{") && !LookingAt("<")) {
+          return SkipFieldValue();
+        }
       }
+      return SkipFieldMessage();
     }
 
     if (singular_overwrite_policy_ == FORBID_SINGULAR_OVERWRITES) {
@@ -559,7 +586,8 @@
     // Perform special handling for embedded message types.
     if (field->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
       // ':' is optional here.
-      bool consumed_semicolon = TryConsume(":");
+      bool consumed_semicolon = TryConsumeBeforeWhitespace(":");
+      TryConsumeWhitespace(message->GetTypeName(), "Normal");
       if (consumed_semicolon && field->options().weak() &&
           LookingAtType(io::Tokenizer::TYPE_STRING)) {
         // we are getting a bytes string for a weak field.
@@ -573,7 +601,8 @@
       }
     } else {
       // ':' is required here.
-      DO(Consume(":"));
+      DO(ConsumeBeforeWhitespace(":"));
+      TryConsumeWhitespace(message->GetTypeName(), "Normal");
     }
 
     if (field->is_repeated() && TryConsume("[")) {
@@ -627,11 +656,12 @@
     if (TryConsume("[")) {
       // Extension name or type URL.
       DO(ConsumeTypeUrlOrFullTypeName());
-      DO(Consume("]"));
+      DO(ConsumeBeforeWhitespace("]"));
     } else {
       std::string field_name;
-      DO(ConsumeIdentifier(&field_name));
+      DO(ConsumeIdentifierBeforeWhitespace(&field_name));
     }
+    TryConsumeWhitespace("Unknown/Reserved", "n/a");
 
     // Try to guess the type of this field.
     // If this field is not a message, there should be a ":" between the
@@ -639,8 +669,13 @@
     // start with "{" or "<" which indicates the beginning of a message body.
     // If there is no ":" or there is a "{" or "<" after ":", this field has
     // to be a message or the input is ill-formed.
-    if (TryConsume(":") && !LookingAt("{") && !LookingAt("<")) {
-      DO(SkipFieldValue());
+    if (TryConsumeBeforeWhitespace(":")) {
+      TryConsumeWhitespace("Unknown/Reserved", "n/a");
+      if (!LookingAt("{") && !LookingAt("<")) {
+        DO(SkipFieldValue());
+      } else {
+        DO(SkipFieldMessage());
+      }
     } else {
       DO(SkipFieldMessage());
     }
@@ -962,6 +997,15 @@
     return false;
   }
 
+  // Similar to `ConsumeIdentifier`, but any following whitespace token may
+  // be reported.
+  bool ConsumeIdentifierBeforeWhitespace(std::string* identifier) {
+    tokenizer_.set_report_whitespace(true);
+    bool result = ConsumeIdentifier(identifier);
+    tokenizer_.set_report_whitespace(false);
+    return result;
+  }
+
   // Consume a string of form "<id1>.<id2>....<idN>".
   bool ConsumeFullTypeName(std::string* name) {
     DO(ConsumeIdentifier(name));
@@ -1189,6 +1233,16 @@
     return true;
   }
 
+  // Similar to `Consume`, but the following token may be tokenized as
+  // TYPE_WHITESPACE.
+  bool ConsumeBeforeWhitespace(const std::string& value) {
+    // Report whitespace after this token, but only once.
+    tokenizer_.set_report_whitespace(true);
+    bool result = Consume(value);
+    tokenizer_.set_report_whitespace(false);
+    return result;
+  }
+
   // Attempts to consume the supplied value. Returns false if a the
   // token found does not match the value specified.
   bool TryConsume(const std::string& value) {
@@ -1200,6 +1254,26 @@
     }
   }
 
+  // Similar to `TryConsume`, but the following token may be tokenized as
+  // TYPE_WHITESPACE.
+  bool TryConsumeBeforeWhitespace(const std::string& value) {
+    // Report whitespace after this token, but only once.
+    tokenizer_.set_report_whitespace(true);
+    bool result = TryConsume(value);
+    tokenizer_.set_report_whitespace(false);
+    return result;
+  }
+
+  bool TryConsumeWhitespace(const std::string& message_type,
+                            const char* field_type) {
+    if (LookingAtType(io::Tokenizer::TYPE_WHITESPACE)) {
+      tokenizer_.Next();
+      return true;
+    }
+
+    return false;
+  }
+
   // An internal instance of the Tokenizer's error collector, used to
   // collect any base-level parse errors and feed them to the ParserImpl.
   class ParserErrorCollector : public io::ErrorCollector {
@@ -1433,8 +1507,8 @@
 class TextFormat::Printer::DebugStringFieldValuePrinter
     : public TextFormat::FastFieldValuePrinter {
  public:
-  void PrintMessageStart(const Message& message, int field_index,
-                         int field_count, bool single_line_mode,
+  void PrintMessageStart(const Message& /*message*/, int /*field_index*/,
+                         int /*field_count*/, bool single_line_mode,
                          BaseTextGenerator* generator) const override {
     // This is safe as only TextGenerator is used with
     // DebugStringFieldValuePrinter.
@@ -1485,7 +1559,7 @@
 }
 
 MessageFactory* TextFormat::Finder::FindExtensionFactory(
-    const FieldDescriptor* field) const {
+    const FieldDescriptor* /*field*/) const {
   return nullptr;
 }
 
@@ -1548,7 +1622,6 @@
   return Parse(&input_stream, output);
 }
 
-
 bool TextFormat::Parser::Merge(io::ZeroCopyInputStream* input,
                                Message* output) {
   ParserImpl parser(output->GetDescriptor(), input, error_collector_, finder_,
@@ -1751,7 +1824,8 @@
   generator->PrintString(!std::isnan(val) ? SimpleDtoa(val) : "nan");
 }
 void TextFormat::FastFieldValuePrinter::PrintEnum(
-    int32_t val, const std::string& name, BaseTextGenerator* generator) const {
+    int32_t /*val*/, const std::string& name,
+    BaseTextGenerator* generator) const {
   generator->PrintString(name);
 }
 
@@ -1766,13 +1840,13 @@
   PrintString(val, generator);
 }
 void TextFormat::FastFieldValuePrinter::PrintFieldName(
-    const Message& message, int field_index, int field_count,
+    const Message& message, int /*field_index*/, int /*field_count*/,
     const Reflection* reflection, const FieldDescriptor* field,
     BaseTextGenerator* generator) const {
   PrintFieldName(message, reflection, field, generator);
 }
 void TextFormat::FastFieldValuePrinter::PrintFieldName(
-    const Message& message, const Reflection* reflection,
+    const Message& /*message*/, const Reflection* /*reflection*/,
     const FieldDescriptor* field, BaseTextGenerator* generator) const {
   if (field->is_extension()) {
     generator->PrintLiteral("[");
@@ -1786,7 +1860,7 @@
   }
 }
 void TextFormat::FastFieldValuePrinter::PrintMessageStart(
-    const Message& message, int field_index, int field_count,
+    const Message& /*message*/, int /*field_index*/, int /*field_count*/,
     bool single_line_mode, BaseTextGenerator* generator) const {
   if (single_line_mode) {
     generator->PrintLiteral(" { ");
@@ -1795,12 +1869,12 @@
   }
 }
 bool TextFormat::FastFieldValuePrinter::PrintMessageContent(
-    const Message& message, int field_index, int field_count,
-    bool single_line_mode, BaseTextGenerator* generator) const {
+    const Message& /*message*/, int /*field_index*/, int /*field_count*/,
+    bool /*single_line_mode*/, BaseTextGenerator* /*generator*/) const {
   return false;  // Use the default printing function.
 }
 void TextFormat::FastFieldValuePrinter::PrintMessageEnd(
-    const Message& message, int field_index, int field_count,
+    const Message& /*message*/, int /*field_index*/, int /*field_count*/,
     bool single_line_mode, BaseTextGenerator* generator) const {
   if (single_line_mode) {
     generator->PrintLiteral("} ");
@@ -1862,8 +1936,8 @@
                  TextFormat::BaseTextGenerator* generator) const override {
     generator->PrintString(delegate_->PrintEnum(val, name));
   }
-  void PrintFieldName(const Message& message, int field_index, int field_count,
-                      const Reflection* reflection,
+  void PrintFieldName(const Message& message, int /*field_index*/,
+                      int /*field_count*/, const Reflection* reflection,
                       const FieldDescriptor* field,
                       TextFormat::BaseTextGenerator* generator) const override {
     generator->PrintString(
diff --git a/src/google/protobuf/text_format.h b/src/google/protobuf/text_format.h
index 4831de6..f2c8dc3 100644
--- a/src/google/protobuf/text_format.h
+++ b/src/google/protobuf/text_format.h
@@ -213,7 +213,7 @@
     virtual ~Finder();
 
     // Try to find an extension of *message by fully-qualified field
-    // name.  Returns NULL if no extension is known for this name or number.
+    // name.  Returns nullptr if no extension is known for this name or number.
     // The base implementation uses the extensions already known by the message.
     virtual const FieldDescriptor* FindExtension(Message* message,
                                                  const std::string& name) const;
@@ -224,7 +224,7 @@
         const Descriptor* descriptor, int number) const;
 
     // Find the message type for an Any proto.
-    // Returns NULL if no message is known for this name.
+    // Returns nullptr if no message is known for this name.
     // The base implementation only accepts prefixes of type.googleprod.com/ or
     // type.googleapis.com/, and searches the DescriptorPool of the parent
     // message.
@@ -365,6 +365,13 @@
                                 const MessagePrinter* printer);
 
    private:
+    friend std::string Message::DebugString() const;
+    friend std::string Message::ShortDebugString() const;
+    friend std::string Message::Utf8DebugString() const;
+
+    // Sets whether *DebugString should insert a silent marker.
+    void SetInsertSilentMarker(bool v) { insert_silent_marker_ = v; }
+
     // Forward declaration of an internal class used to print the text
     // output to the OutputStream (see text_format.cc for implementation).
     class TextGenerator;
@@ -564,18 +571,19 @@
     // Like TextFormat::MergeFromString().
     bool MergeFromString(ConstStringParam input, Message* output);
 
-    // Set where to report parse errors.  If NULL (the default), errors will
+    // Set where to report parse errors.  If nullptr (the default), errors will
     // be printed to stderr.
     void RecordErrorsTo(io::ErrorCollector* error_collector) {
       error_collector_ = error_collector;
     }
 
-    // Set how parser finds extensions.  If NULL (the default), the
+    // Set how parser finds extensions.  If nullptr (the default), the
     // parser will use the standard Reflection object associated with
     // the message being parsed.
     void SetFinder(const Finder* finder) { finder_ = finder; }
 
-    // Sets where location information about the parse will be written. If NULL
+    // Sets where location information about the parse will be written. If
+    // nullptr
     // (the default), then no location will be written.
     void WriteLocationsTo(ParseInfoTree* tree) { parse_info_tree_ = tree; }
 
diff --git a/src/google/protobuf/text_format_unittest.cc b/src/google/protobuf/text_format_unittest.cc
index f8848c4..1da753b 100644
--- a/src/google/protobuf/text_format_unittest.cc
+++ b/src/google/protobuf/text_format_unittest.cc
@@ -37,6 +37,7 @@
 #include <math.h>
 #include <stdlib.h>
 
+#include <atomic>
 #include <limits>
 #include <memory>
 
@@ -44,6 +45,7 @@
 #include <google/protobuf/stubs/common.h>
 #include <google/protobuf/testing/file.h>
 #include <google/protobuf/testing/file.h>
+#include <google/protobuf/any.pb.h>
 #include <google/protobuf/map_unittest.pb.h>
 #include <google/protobuf/test_util.h>
 #include <google/protobuf/test_util2.h>
@@ -66,6 +68,11 @@
 namespace google {
 namespace protobuf {
 
+namespace internal {
+// Controls insertion of DEBUG_STRING_SILENT_MARKER.
+extern PROTOBUF_EXPORT std::atomic<bool> enable_debug_text_format_marker;
+}  // namespace internal
+
 // Can't use an anonymous namespace here due to brokenness of Tru64 compiler.
 namespace text_format_unittest {
 
@@ -509,7 +516,7 @@
 TEST_F(TextFormatTest, ErrorCasesRegisteringFieldValuePrinterShouldFail) {
   protobuf_unittest::TestAllTypes message;
   TextFormat::Printer printer;
-  // NULL printer.
+  // nullptr printer.
   EXPECT_FALSE(printer.RegisterFieldValuePrinter(
       message.GetDescriptor()->FindFieldByName("optional_int32"),
       static_cast<const TextFormat::FieldValuePrinter*>(nullptr)));
@@ -518,7 +525,7 @@
       static_cast<const TextFormat::FastFieldValuePrinter*>(nullptr)));
   // Because registration fails, the ownership of this printer is never taken.
   TextFormat::FieldValuePrinter my_field_printer;
-  // NULL field
+  // nullptr field
   EXPECT_FALSE(printer.RegisterFieldValuePrinter(nullptr, &my_field_printer));
 }
 
@@ -1086,7 +1093,7 @@
   //   seemed to trigger an odd case on MinGW/GCC 3.4.5 where GCC's parsing of
   //   the value differed from strtod()'s parsing.  That is to say, the
   //   following assertion fails on MinGW:
-  //     assert(1.23e22 == strtod("1.23e22", NULL));
+  //     assert(1.23e22 == strtod("1.23e22", nullptr));
   //   As a result, SimpleDtoa() would print the value as
   //   "1.2300000000000001e+22" to make sure strtod() produce the exact same
   //   result.  Our goal is to test runtime parsing, not compile-time parsing,
@@ -1504,11 +1511,11 @@
   ExpectLocation(nested_tree, nested_field->message_type(), "bb", -1, 12, 2, 12,
                  8);
 
-  // Verify a NULL tree for an unknown nested field.
+  // Verify a nullptr tree for an unknown nested field.
   TextFormat::ParseInfoTree* unknown_nested_tree =
       tree.GetTreeForNested(nested_field, 2);
 
-  EXPECT_EQ(NULL, unknown_nested_tree);
+  EXPECT_EQ(nullptr, unknown_nested_tree);
 }
 
 TEST_F(TextFormatParserTest, ParseFieldValueFromString) {
@@ -1958,6 +1965,102 @@
   ExpectSuccessAndTree(input, &message, nullptr);
 }
 
+TEST_F(TextFormatParserTest, ParseAnyFieldWithAdditionalWhiteSpaces) {
+  Any any;
+  std::string parse_string =
+      "[type.googleapis.com/protobuf_unittest.TestAllTypes] \t :  \t {\n"
+      "  optional_int32: 321\n"
+      "  optional_string: \"teststr0\"\n"
+      "}\n";
+
+  ASSERT_TRUE(TextFormat::ParseFromString(parse_string, &any));
+
+  TextFormat::Printer printer;
+  printer.SetExpandAny(true);
+  std::string text;
+  ASSERT_TRUE(printer.PrintToString(any, &text));
+  EXPECT_EQ(text,
+            "[type.googleapis.com/protobuf_unittest.TestAllTypes] {\n"
+            "  optional_int32: 321\n"
+            "  optional_string: \"teststr0\"\n"
+            "}\n");
+}
+
+TEST_F(TextFormatParserTest, ParseExtensionFieldWithAdditionalWhiteSpaces) {
+  unittest::TestAllExtensions proto;
+  std::string parse_string =
+      "[protobuf_unittest.optional_int32_extension]   : \t 101\n"
+      "[protobuf_unittest.optional_int64_extension] \t : 102\n";
+
+  ASSERT_TRUE(TextFormat::ParseFromString(parse_string, &proto));
+
+  TextFormat::Printer printer;
+  std::string text;
+  ASSERT_TRUE(printer.PrintToString(proto, &text));
+  EXPECT_EQ(text,
+            "[protobuf_unittest.optional_int32_extension]: 101\n"
+            "[protobuf_unittest.optional_int64_extension]: 102\n");
+}
+
+TEST_F(TextFormatParserTest, ParseNormalFieldWithAdditionalWhiteSpaces) {
+  unittest::TestAllTypes proto;
+  std::string parse_string =
+      "repeated_int32  : \t 1\n"
+      "repeated_int32: 2\n"
+      "repeated_nested_message: {\n"
+      "  bb: 3\n"
+      "}\n"
+      "repeated_nested_message  : \t {\n"
+      "  bb: 4\n"
+      "}\n"
+      "repeated_nested_message     {\n"
+      "  bb: 5\n"
+      "}\n";
+
+  ASSERT_TRUE(TextFormat::ParseFromString(parse_string, &proto));
+
+  TextFormat::Printer printer;
+  std::string text;
+  ASSERT_TRUE(printer.PrintToString(proto, &text));
+  EXPECT_EQ(text,
+            "repeated_int32: 1\n"
+            "repeated_int32: 2\n"
+            "repeated_nested_message {\n"
+            "  bb: 3\n"
+            "}\n"
+            "repeated_nested_message {\n"
+            "  bb: 4\n"
+            "}\n"
+            "repeated_nested_message {\n"
+            "  bb: 5\n"
+            "}\n");
+}
+
+TEST_F(TextFormatParserTest, ParseSkippedFieldWithAdditionalWhiteSpaces) {
+  protobuf_unittest::TestAllTypes proto;
+  TextFormat::Parser parser;
+  parser.AllowUnknownField(true);
+  EXPECT_TRUE(
+      parser.ParseFromString("optional_int32: 321\n"
+                             "unknown_field1   : \t 12345\n"
+                             "[somewhere.unknown_extension1]   {\n"
+                             "  unknown_field2 \t :   12345\n"
+                             "}\n"
+                             "[somewhere.unknown_extension2]    : \t {\n"
+                             "  unknown_field3     \t :   12345\n"
+                             "  [somewhere.unknown_extension3]    \t :   {\n"
+                             "    unknown_field4:   10\n"
+                             "  }\n"
+                             "  [somewhere.unknown_extension4] \t {\n"
+                             "  }\n"
+                             "}\n",
+                             &proto));
+  std::string text;
+  TextFormat::Printer printer;
+  ASSERT_TRUE(printer.PrintToString(proto, &text));
+  EXPECT_EQ(text, "optional_int32: 321\n");
+}
+
 class TextFormatMessageSetTest : public testing::Test {
  protected:
   static const char proto_debug_string_[];
@@ -2147,6 +2250,148 @@
   EXPECT_FALSE(parser.ParseFromString("unknown_field: 1", &proto));
 }
 
+class TextFormatSilentMarkerTest : public testing::Test {
+ public:
+  void SetUp() override {
+    google::protobuf::internal::enable_debug_text_format_marker = true;
+  }
+  void TearDown() override {
+    google::protobuf::internal::enable_debug_text_format_marker = false;
+  }
+};
+
+TEST_F(TextFormatSilentMarkerTest, NonMessageFieldAsFirstField) {
+  protobuf_unittest::TestAllTypes proto;
+  proto.set_optional_int32(1);
+  proto.mutable_optional_nested_message()->set_bb(2);
+
+  EXPECT_EQ(
+      "optional_int32: \t 1\n"
+      "optional_nested_message {\n"
+      "  bb: 2\n"
+      "}\n",
+      proto.DebugString());
+
+  EXPECT_EQ(
+      "optional_int32: \t 1 "
+      "optional_nested_message { bb: 2 }",
+      proto.ShortDebugString());
+}
+
+TEST_F(TextFormatSilentMarkerTest, MessageFieldAsFirstField) {
+  protobuf_unittest::TestAllTypes proto;
+  proto.mutable_optional_nested_message()->set_bb(2);
+  proto.add_repeated_int32(3);
+
+  EXPECT_EQ(
+      "optional_nested_message \t {\n"
+      "  bb: 2\n"
+      "}\n"
+      "repeated_int32: 3\n",
+      proto.DebugString());
+
+  EXPECT_EQ(
+      "optional_nested_message \t { bb: 2 } "
+      "repeated_int32: 3",
+      proto.ShortDebugString());
+}
+
+TEST_F(TextFormatSilentMarkerTest, UnknownFieldAsFirstField) {
+  unittest::TestEmptyMessage message;
+  UnknownFieldSet* unknown_fields = message.mutable_unknown_fields();
+
+  unknown_fields->AddVarint(5, 1);
+  unknown_fields->AddGroup(5)->AddVarint(10, 5);
+
+  EXPECT_EQ(
+      "5: \t 1\n"
+      "5 {\n"
+      "  10: 5\n"
+      "}\n",
+      message.DebugString());
+
+  EXPECT_EQ(
+      "5: \t 1 "
+      "5 { 10: 5 }",
+      message.ShortDebugString());
+
+  unknown_fields->Clear();
+  unknown_fields->AddGroup(5)->AddVarint(10, 5);
+  unknown_fields->AddVarint(5, 1);
+
+  EXPECT_EQ(
+      "5 \t {\n"
+      "  10: 5\n"
+      "}\n"
+      "5: 1\n",
+      message.DebugString());
+
+  EXPECT_EQ(
+      "5 \t { 10: 5 } "
+      "5: 1",
+      message.ShortDebugString());
+}
+
+TEST_F(TextFormatSilentMarkerTest, AnyFieldAsFirstField) {
+  protobuf_unittest::TestAllTypes proto;
+  proto.set_optional_string("teststr");
+  proto.set_optional_int32(432);
+  Any any;
+  any.PackFrom(proto);
+
+  EXPECT_EQ(
+      "[type.googleapis.com/protobuf_unittest.TestAllTypes] \t {\n"
+      "  optional_int32: 432\n"
+      "  optional_string: \"teststr\"\n"
+      "}\n",
+      any.DebugString());
+
+  EXPECT_EQ(
+      "[type.googleapis.com/protobuf_unittest.TestAllTypes]"
+      " \t { optional_int32: 432 optional_string: \"teststr\" }",
+      any.ShortDebugString());
+}
+
+TEST_F(TextFormatSilentMarkerTest, ExtensionFieldAsFirstField) {
+  unittest::TestAllExtensions proto;
+  proto.SetExtension(protobuf_unittest::optional_int32_extension, 101);
+  proto.SetExtension(protobuf_unittest::optional_int64_extension, 102);
+
+  EXPECT_EQ(
+      "[protobuf_unittest.optional_int32_extension]: \t 101\n"
+      "[protobuf_unittest.optional_int64_extension]: 102\n",
+      proto.DebugString());
+}
+
+TEST_F(TextFormatSilentMarkerTest, MapFieldAsFirstField) {
+  unittest::TestMap proto;
+  (*proto.mutable_map_int32_int32())[0] = 1;
+  (*proto.mutable_map_int64_int64())[2] = 3;
+
+  EXPECT_EQ(
+      "map_int32_int32 \t {\n  key: 0\n  value: 1\n}\n"
+      "map_int64_int64 {\n  key: 2\n  value: 3\n}\n",
+      proto.DebugString());
+}
+
+
+TEST(TextFormatFloatingPointTest, PreservesNegative0) {
+  proto3_unittest::TestAllTypes in_message;
+  in_message.set_optional_float(-0.0f);
+  in_message.set_optional_double(-0.0);
+  TextFormat::Printer printer;
+  std::string serialized;
+  EXPECT_TRUE(printer.PrintToString(in_message, &serialized));
+  proto3_unittest::TestAllTypes out_message;
+  TextFormat::Parser parser;
+  EXPECT_TRUE(parser.ParseFromString(serialized, &out_message));
+  EXPECT_EQ(in_message.optional_float(), out_message.optional_float());
+  EXPECT_EQ(std::signbit(in_message.optional_float()),
+            std::signbit(out_message.optional_float()));
+  EXPECT_EQ(in_message.optional_double(), out_message.optional_double());
+  EXPECT_EQ(std::signbit(in_message.optional_double()),
+            std::signbit(out_message.optional_double()));
+}
 
 }  // namespace text_format_unittest
 }  // namespace protobuf
diff --git a/src/google/protobuf/timestamp.pb.cc b/src/google/protobuf/timestamp.pb.cc
index a7ab3b9..71361e3 100644
--- a/src/google/protobuf/timestamp.pb.cc
+++ b/src/google/protobuf/timestamp.pb.cc
@@ -35,7 +35,7 @@
 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2ftimestamp_2eproto = nullptr;
 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2ftimestamp_2eproto = nullptr;
 
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ftimestamp_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2ftimestamp_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   ~0u,  // no _has_bits_
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Timestamp, _internal_metadata_),
   ~0u,  // no _extensions_
@@ -100,7 +100,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Timestamp)
 }
 
-void Timestamp::SharedCtor() {
+inline void Timestamp::SharedCtor() {
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&seconds_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&nanos_) -
@@ -130,7 +130,7 @@
 
 void Timestamp::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Timestamp)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -143,12 +143,12 @@
 const char* Timestamp::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // int64 seconds = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           seconds_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
         } else
@@ -156,8 +156,8 @@
         continue;
       // int32 nanos = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
-          nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
+          nanos_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
@@ -185,10 +185,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Timestamp::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Timestamp::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Timestamp)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // int64 seconds = 1;
@@ -215,7 +215,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Timestamp)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -248,7 +248,7 @@
 void Timestamp::MergeFrom(const Timestamp& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Timestamp)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (from._internal_seconds() != 0) {
diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h
index f5c7f98..cf66335 100644
--- a/src/google/protobuf/timestamp.pb.h
+++ b/src/google/protobuf/timestamp.pb.h
@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3018000
+#if PROTOBUF_VERSION < 3019000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
@@ -50,7 +50,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
   static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
-  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+  static const uint32_t offsets[];
 };
 PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ftimestamp_2eproto;
 PROTOBUF_NAMESPACE_OPEN
@@ -120,7 +120,12 @@
   }
   inline void Swap(Timestamp* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -134,11 +139,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Timestamp* New() const final {
-    return new Timestamp();
-  }
-
-  Timestamp* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Timestamp* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Timestamp>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -153,8 +154,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -162,6 +163,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Timestamp* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Timestamp";
@@ -189,20 +192,20 @@
   };
   // int64 seconds = 1;
   void clear_seconds();
-  ::PROTOBUF_NAMESPACE_ID::int64 seconds() const;
-  void set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value);
+  int64_t seconds() const;
+  void set_seconds(int64_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int64 _internal_seconds() const;
-  void _internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value);
+  int64_t _internal_seconds() const;
+  void _internal_set_seconds(int64_t value);
   public:
 
   // int32 nanos = 2;
   void clear_nanos();
-  ::PROTOBUF_NAMESPACE_ID::int32 nanos() const;
-  void set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t nanos() const;
+  void set_nanos(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_nanos() const;
-  void _internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_nanos() const;
+  void _internal_set_nanos(int32_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.Timestamp)
@@ -212,8 +215,8 @@
   template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
   typedef void InternalArenaConstructable_;
   typedef void DestructorSkippable_;
-  ::PROTOBUF_NAMESPACE_ID::int64 seconds_;
-  ::PROTOBUF_NAMESPACE_ID::int32 nanos_;
+  int64_t seconds_;
+  int32_t nanos_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
   friend struct ::TableStruct_google_2fprotobuf_2ftimestamp_2eproto;
 };
@@ -232,18 +235,18 @@
 inline void Timestamp::clear_seconds() {
   seconds_ = int64_t{0};
 }
-inline ::PROTOBUF_NAMESPACE_ID::int64 Timestamp::_internal_seconds() const {
+inline int64_t Timestamp::_internal_seconds() const {
   return seconds_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int64 Timestamp::seconds() const {
+inline int64_t Timestamp::seconds() const {
   // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.seconds)
   return _internal_seconds();
 }
-inline void Timestamp::_internal_set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) {
+inline void Timestamp::_internal_set_seconds(int64_t value) {
   
   seconds_ = value;
 }
-inline void Timestamp::set_seconds(::PROTOBUF_NAMESPACE_ID::int64 value) {
+inline void Timestamp::set_seconds(int64_t value) {
   _internal_set_seconds(value);
   // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.seconds)
 }
@@ -252,18 +255,18 @@
 inline void Timestamp::clear_nanos() {
   nanos_ = 0;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Timestamp::_internal_nanos() const {
+inline int32_t Timestamp::_internal_nanos() const {
   return nanos_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Timestamp::nanos() const {
+inline int32_t Timestamp::nanos() const {
   // @@protoc_insertion_point(field_get:google.protobuf.Timestamp.nanos)
   return _internal_nanos();
 }
-inline void Timestamp::_internal_set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Timestamp::_internal_set_nanos(int32_t value) {
   
   nanos_ = value;
 }
-inline void Timestamp::set_nanos(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Timestamp::set_nanos(int32_t value) {
   _internal_set_nanos(value);
   // @@protoc_insertion_point(field_set:google.protobuf.Timestamp.nanos)
 }
diff --git a/src/google/protobuf/type.pb.cc b/src/google/protobuf/type.pb.cc
index 7e8e795..88fa46c 100644
--- a/src/google/protobuf/type.pb.cc
+++ b/src/google/protobuf/type.pb.cc
@@ -107,7 +107,7 @@
 static const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[3];
 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2ftype_2eproto = nullptr;
 
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2ftype_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   ~0u,  // no _has_bits_
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::Type, _internal_metadata_),
   ~0u,  // no _extensions_
@@ -272,7 +272,7 @@
   }
 }
 
-#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 constexpr Field_Kind Field::TYPE_UNKNOWN;
 constexpr Field_Kind Field::TYPE_DOUBLE;
 constexpr Field_Kind Field::TYPE_FLOAT;
@@ -295,7 +295,7 @@
 constexpr Field_Kind Field::Kind_MIN;
 constexpr Field_Kind Field::Kind_MAX;
 constexpr int Field::Kind_ARRAYSIZE;
-#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Field_Cardinality_descriptor() {
   ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2ftype_2eproto);
   return file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[1];
@@ -312,7 +312,7 @@
   }
 }
 
-#if (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#if (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 constexpr Field_Cardinality Field::CARDINALITY_UNKNOWN;
 constexpr Field_Cardinality Field::CARDINALITY_OPTIONAL;
 constexpr Field_Cardinality Field::CARDINALITY_REQUIRED;
@@ -320,7 +320,7 @@
 constexpr Field_Cardinality Field::Cardinality_MIN;
 constexpr Field_Cardinality Field::Cardinality_MAX;
 constexpr int Field::Cardinality_ARRAYSIZE;
-#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || _MSC_VER >= 1900)
+#endif  // (__cplusplus < 201703) && (!defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912))
 const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Syntax_descriptor() {
   ::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&descriptor_table_google_2fprotobuf_2ftype_2eproto);
   return file_level_enum_descriptors_google_2fprotobuf_2ftype_2eproto[2];
@@ -372,6 +372,9 @@
       options_(from.options_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_name().empty()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
@@ -385,8 +388,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Type)
 }
 
-void Type::SharedCtor() {
+inline void Type::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&source_context_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&syntax_) -
@@ -418,7 +424,7 @@
 
 void Type::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Type)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -437,12 +443,12 @@
 const char* Type::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Type.name"));
@@ -452,7 +458,7 @@
         continue;
       // repeated .google.protobuf.Field fields = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -465,7 +471,7 @@
         continue;
       // repeated string oneofs = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -480,7 +486,7 @@
         continue;
       // repeated .google.protobuf.Option options = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -493,7 +499,7 @@
         continue;
       // .google.protobuf.SourceContext source_context = 5;
       case 5:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 42)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 42)) {
           ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr);
           CHK_(ptr);
         } else
@@ -501,8 +507,8 @@
         continue;
       // .google.protobuf.Syntax syntax = 6;
       case 6:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 48)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 48)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val));
         } else
@@ -531,10 +537,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Type::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Type::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Type)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // string name = 1;
@@ -600,7 +606,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Type)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -665,7 +671,7 @@
 void Type::MergeFrom(const Type& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Type)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   fields_.MergeFrom(from.fields_);
@@ -742,21 +748,33 @@
       options_(from.options_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_name().empty()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
   }
   type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_type_url().empty()) {
     type_url_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_type_url(), 
       GetArenaForAllocation());
   }
   json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_json_name().empty()) {
     json_name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_json_name(), 
       GetArenaForAllocation());
   }
   default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_default_value().empty()) {
     default_value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_default_value(), 
       GetArenaForAllocation());
@@ -767,11 +785,23 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Field)
 }
 
-void Field::SharedCtor() {
+inline void Field::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 type_url_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 json_name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 default_value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&kind_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&packed_) -
@@ -805,7 +835,7 @@
 
 void Field::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Field)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -823,13 +853,13 @@
 const char* Field::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // .google.protobuf.Field.Kind kind = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           _internal_set_kind(static_cast<::PROTOBUF_NAMESPACE_ID::Field_Kind>(val));
         } else
@@ -837,8 +867,8 @@
         continue;
       // .google.protobuf.Field.Cardinality cardinality = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           _internal_set_cardinality(static_cast<::PROTOBUF_NAMESPACE_ID::Field_Cardinality>(val));
         } else
@@ -846,15 +876,15 @@
         continue;
       // int32 number = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 24)) {
-          number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 24)) {
+          number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // string name = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.name"));
@@ -864,7 +894,7 @@
         continue;
       // string type_url = 6;
       case 6:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 50)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 50)) {
           auto str = _internal_mutable_type_url();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.type_url"));
@@ -874,15 +904,15 @@
         continue;
       // int32 oneof_index = 7;
       case 7:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 56)) {
-          oneof_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 56)) {
+          oneof_index_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // bool packed = 8;
       case 8:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 64)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 64)) {
           packed_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
         } else
@@ -890,7 +920,7 @@
         continue;
       // repeated .google.protobuf.Option options = 9;
       case 9:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 74)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 74)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -903,7 +933,7 @@
         continue;
       // string json_name = 10;
       case 10:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 82)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 82)) {
           auto str = _internal_mutable_json_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.json_name"));
@@ -913,7 +943,7 @@
         continue;
       // string default_value = 11;
       case 11:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 90)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 90)) {
           auto str = _internal_mutable_default_value();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Field.default_value"));
@@ -944,10 +974,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Field::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Field::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Field)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // .google.protobuf.Field.Kind kind = 1;
@@ -1042,7 +1072,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Field)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1127,7 +1157,7 @@
 void Field::MergeFrom(const Field& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Field)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   options_.MergeFrom(from.options_);
@@ -1246,6 +1276,9 @@
       options_(from.options_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_name().empty()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
@@ -1259,8 +1292,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Enum)
 }
 
-void Enum::SharedCtor() {
+inline void Enum::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 ::memset(reinterpret_cast<char*>(this) + static_cast<size_t>(
     reinterpret_cast<char*>(&source_context_) - reinterpret_cast<char*>(this)),
     0, static_cast<size_t>(reinterpret_cast<char*>(&syntax_) -
@@ -1292,7 +1328,7 @@
 
 void Enum::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Enum)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1310,12 +1346,12 @@
 const char* Enum::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Enum.name"));
@@ -1325,7 +1361,7 @@
         continue;
       // repeated .google.protobuf.EnumValue enumvalue = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -1338,7 +1374,7 @@
         continue;
       // repeated .google.protobuf.Option options = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -1351,7 +1387,7 @@
         continue;
       // .google.protobuf.SourceContext source_context = 4;
       case 4:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 34)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
           ptr = ctx->ParseMessage(_internal_mutable_source_context(), ptr);
           CHK_(ptr);
         } else
@@ -1359,8 +1395,8 @@
         continue;
       // .google.protobuf.Syntax syntax = 5;
       case 5:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 40)) {
-          ::PROTOBUF_NAMESPACE_ID::uint64 val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 40)) {
+          uint64_t val = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
           _internal_set_syntax(static_cast<::PROTOBUF_NAMESPACE_ID::Syntax>(val));
         } else
@@ -1389,10 +1425,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Enum::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Enum::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Enum)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // string name = 1;
@@ -1448,7 +1484,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Enum)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1505,7 +1541,7 @@
 void Enum::MergeFrom(const Enum& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Enum)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   enumvalue_.MergeFrom(from.enumvalue_);
@@ -1580,6 +1616,9 @@
       options_(from.options_) {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_name().empty()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
@@ -1588,8 +1627,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.EnumValue)
 }
 
-void EnumValue::SharedCtor() {
+inline void EnumValue::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 number_ = 0;
 }
 
@@ -1617,7 +1659,7 @@
 
 void EnumValue::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.EnumValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1630,12 +1672,12 @@
 const char* EnumValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.EnumValue.name"));
@@ -1645,15 +1687,15 @@
         continue;
       // int32 number = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 16)) {
-          number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 16)) {
+          number_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
         continue;
       // repeated .google.protobuf.Option options = 3;
       case 3:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 26)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
           ptr -= 1;
           do {
             ptr += 1;
@@ -1687,10 +1729,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* EnumValue::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* EnumValue::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.EnumValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // string name = 1;
@@ -1729,7 +1771,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.EnumValue)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1771,7 +1813,7 @@
 void EnumValue::MergeFrom(const EnumValue& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.EnumValue)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   options_.MergeFrom(from.options_);
@@ -1845,6 +1887,9 @@
   : ::PROTOBUF_NAMESPACE_ID::Message() {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_name().empty()) {
     name_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_name(), 
       GetArenaForAllocation());
@@ -1857,8 +1902,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Option)
 }
 
-void Option::SharedCtor() {
+inline void Option::SharedCtor() {
 name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 value_ = nullptr;
 }
 
@@ -1887,7 +1935,7 @@
 
 void Option::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Option)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1902,12 +1950,12 @@
 const char* Option::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // string name = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_name();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.Option.name"));
@@ -1917,7 +1965,7 @@
         continue;
       // .google.protobuf.Any value = 2;
       case 2:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 18)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
           ptr = ctx->ParseMessage(_internal_mutable_value(), ptr);
           CHK_(ptr);
         } else
@@ -1946,10 +1994,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Option::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Option::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Option)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // string name = 1;
@@ -1982,7 +2030,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Option)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -2019,7 +2067,7 @@
 void Option::MergeFrom(const Option& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Option)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (!from._internal_name().empty()) {
diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h
index 4baf376..cf5943c 100644
--- a/src/google/protobuf/type.pb.h
+++ b/src/google/protobuf/type.pb.h
@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3018000
+#if PROTOBUF_VERSION < 3019000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
@@ -53,7 +53,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
   static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
-  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+  static const uint32_t offsets[];
 };
 PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2ftype_2eproto;
 PROTOBUF_NAMESPACE_OPEN
@@ -102,8 +102,8 @@
   Field_Kind_TYPE_SFIXED64 = 16,
   Field_Kind_TYPE_SINT32 = 17,
   Field_Kind_TYPE_SINT64 = 18,
-  Field_Kind_Field_Kind_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
-  Field_Kind_Field_Kind_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
+  Field_Kind_Field_Kind_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(),
+  Field_Kind_Field_Kind_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max()
 };
 PROTOBUF_EXPORT bool Field_Kind_IsValid(int value);
 constexpr Field_Kind Field_Kind_Kind_MIN = Field_Kind_TYPE_UNKNOWN;
@@ -129,8 +129,8 @@
   Field_Cardinality_CARDINALITY_OPTIONAL = 1,
   Field_Cardinality_CARDINALITY_REQUIRED = 2,
   Field_Cardinality_CARDINALITY_REPEATED = 3,
-  Field_Cardinality_Field_Cardinality_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
-  Field_Cardinality_Field_Cardinality_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
+  Field_Cardinality_Field_Cardinality_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(),
+  Field_Cardinality_Field_Cardinality_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max()
 };
 PROTOBUF_EXPORT bool Field_Cardinality_IsValid(int value);
 constexpr Field_Cardinality Field_Cardinality_Cardinality_MIN = Field_Cardinality_CARDINALITY_UNKNOWN;
@@ -154,8 +154,8 @@
 enum Syntax : int {
   SYNTAX_PROTO2 = 0,
   SYNTAX_PROTO3 = 1,
-  Syntax_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
-  Syntax_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
+  Syntax_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::min(),
+  Syntax_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<int32_t>::max()
 };
 PROTOBUF_EXPORT bool Syntax_IsValid(int value);
 constexpr Syntax Syntax_MIN = SYNTAX_PROTO2;
@@ -233,7 +233,12 @@
   }
   inline void Swap(Type* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -247,11 +252,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Type* New() const final {
-    return new Type();
-  }
-
-  Type* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Type* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Type>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -266,8 +267,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -275,6 +276,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Type* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Type";
@@ -370,7 +373,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -385,7 +388,7 @@
   public:
   void clear_source_context();
   const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
   ::PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context();
   void set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context);
   private:
@@ -478,7 +481,12 @@
   }
   inline void Swap(Field* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -492,11 +500,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Field* New() const final {
-    return new Field();
-  }
-
-  Field* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Field* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Field>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -511,8 +515,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -520,6 +524,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Field* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Field";
@@ -675,7 +681,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -689,7 +695,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_type_url(ArgT0&& arg0, ArgT... args);
   std::string* mutable_type_url();
-  PROTOBUF_MUST_USE_RESULT std::string* release_type_url();
+  PROTOBUF_NODISCARD std::string* release_type_url();
   void set_allocated_type_url(std::string* type_url);
   private:
   const std::string& _internal_type_url() const;
@@ -703,7 +709,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_json_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_json_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_json_name();
+  PROTOBUF_NODISCARD std::string* release_json_name();
   void set_allocated_json_name(std::string* json_name);
   private:
   const std::string& _internal_json_name() const;
@@ -717,7 +723,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_default_value(ArgT0&& arg0, ArgT... args);
   std::string* mutable_default_value();
-  PROTOBUF_MUST_USE_RESULT std::string* release_default_value();
+  PROTOBUF_NODISCARD std::string* release_default_value();
   void set_allocated_default_value(std::string* default_value);
   private:
   const std::string& _internal_default_value() const;
@@ -745,20 +751,20 @@
 
   // int32 number = 3;
   void clear_number();
-  ::PROTOBUF_NAMESPACE_ID::int32 number() const;
-  void set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t number() const;
+  void set_number(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const;
-  void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_number() const;
+  void _internal_set_number(int32_t value);
   public:
 
   // int32 oneof_index = 7;
   void clear_oneof_index();
-  ::PROTOBUF_NAMESPACE_ID::int32 oneof_index() const;
-  void set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t oneof_index() const;
+  void set_oneof_index(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_oneof_index() const;
-  void _internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_oneof_index() const;
+  void _internal_set_oneof_index(int32_t value);
   public:
 
   // bool packed = 8;
@@ -784,8 +790,8 @@
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr default_value_;
   int kind_;
   int cardinality_;
-  ::PROTOBUF_NAMESPACE_ID::int32 number_;
-  ::PROTOBUF_NAMESPACE_ID::int32 oneof_index_;
+  int32_t number_;
+  int32_t oneof_index_;
   bool packed_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
   friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto;
@@ -847,7 +853,12 @@
   }
   inline void Swap(Enum* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -861,11 +872,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Enum* New() const final {
-    return new Enum();
-  }
-
-  Enum* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Enum* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Enum>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -880,8 +887,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -889,6 +896,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Enum* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Enum";
@@ -959,7 +968,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -974,7 +983,7 @@
   public:
   void clear_source_context();
   const ::PROTOBUF_NAMESPACE_ID::SourceContext& source_context() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::SourceContext* release_source_context();
   ::PROTOBUF_NAMESPACE_ID::SourceContext* mutable_source_context();
   void set_allocated_source_context(::PROTOBUF_NAMESPACE_ID::SourceContext* source_context);
   private:
@@ -1066,7 +1075,12 @@
   }
   inline void Swap(EnumValue* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1080,11 +1094,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline EnumValue* New() const final {
-    return new EnumValue();
-  }
-
-  EnumValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  EnumValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<EnumValue>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -1099,8 +1109,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -1108,6 +1118,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(EnumValue* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.EnumValue";
@@ -1158,7 +1170,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -1168,11 +1180,11 @@
 
   // int32 number = 2;
   void clear_number();
-  ::PROTOBUF_NAMESPACE_ID::int32 number() const;
-  void set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t number() const;
+  void set_number(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_number() const;
-  void _internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_number() const;
+  void _internal_set_number(int32_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.EnumValue)
@@ -1184,7 +1196,7 @@
   typedef void DestructorSkippable_;
   ::PROTOBUF_NAMESPACE_ID::RepeatedPtrField< ::PROTOBUF_NAMESPACE_ID::Option > options_;
   ::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr name_;
-  ::PROTOBUF_NAMESPACE_ID::int32 number_;
+  int32_t number_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
   friend struct ::TableStruct_google_2fprotobuf_2ftype_2eproto;
 };
@@ -1245,7 +1257,12 @@
   }
   inline void Swap(Option* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1259,11 +1276,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Option* New() const final {
-    return new Option();
-  }
-
-  Option* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Option* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Option>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -1278,8 +1291,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -1287,6 +1300,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Option* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Option";
@@ -1318,7 +1333,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_name(ArgT0&& arg0, ArgT... args);
   std::string* mutable_name();
-  PROTOBUF_MUST_USE_RESULT std::string* release_name();
+  PROTOBUF_NODISCARD std::string* release_name();
   void set_allocated_name(std::string* name);
   private:
   const std::string& _internal_name() const;
@@ -1333,7 +1348,7 @@
   public:
   void clear_value();
   const ::PROTOBUF_NAMESPACE_ID::Any& value() const;
-  PROTOBUF_MUST_USE_RESULT ::PROTOBUF_NAMESPACE_ID::Any* release_value();
+  PROTOBUF_NODISCARD ::PROTOBUF_NAMESPACE_ID::Any* release_value();
   ::PROTOBUF_NAMESPACE_ID::Any* mutable_value();
   void set_allocated_value(::PROTOBUF_NAMESPACE_ID::Any* value);
   private:
@@ -1410,6 +1425,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Type.name)
 }
 
@@ -1722,18 +1742,18 @@
 inline void Field::clear_number() {
   number_ = 0;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Field::_internal_number() const {
+inline int32_t Field::_internal_number() const {
   return number_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Field::number() const {
+inline int32_t Field::number() const {
   // @@protoc_insertion_point(field_get:google.protobuf.Field.number)
   return _internal_number();
 }
-inline void Field::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Field::_internal_set_number(int32_t value) {
   
   number_ = value;
 }
-inline void Field::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Field::set_number(int32_t value) {
   _internal_set_number(value);
   // @@protoc_insertion_point(field_set:google.protobuf.Field.number)
 }
@@ -1781,6 +1801,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.name)
 }
 
@@ -1827,6 +1852,11 @@
   }
   type_url_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), type_url,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (type_url_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    type_url_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.type_url)
 }
 
@@ -1834,18 +1864,18 @@
 inline void Field::clear_oneof_index() {
   oneof_index_ = 0;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Field::_internal_oneof_index() const {
+inline int32_t Field::_internal_oneof_index() const {
   return oneof_index_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Field::oneof_index() const {
+inline int32_t Field::oneof_index() const {
   // @@protoc_insertion_point(field_get:google.protobuf.Field.oneof_index)
   return _internal_oneof_index();
 }
-inline void Field::_internal_set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Field::_internal_set_oneof_index(int32_t value) {
   
   oneof_index_ = value;
 }
-inline void Field::set_oneof_index(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Field::set_oneof_index(int32_t value) {
   _internal_set_oneof_index(value);
   // @@protoc_insertion_point(field_set:google.protobuf.Field.oneof_index)
 }
@@ -1953,6 +1983,11 @@
   }
   json_name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), json_name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (json_name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    json_name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.json_name)
 }
 
@@ -1999,6 +2034,11 @@
   }
   default_value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), default_value,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (default_value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    default_value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Field.default_value)
 }
 
@@ -2049,6 +2089,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Enum.name)
 }
 
@@ -2285,6 +2330,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.EnumValue.name)
 }
 
@@ -2292,18 +2342,18 @@
 inline void EnumValue::clear_number() {
   number_ = 0;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValue::_internal_number() const {
+inline int32_t EnumValue::_internal_number() const {
   return number_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 EnumValue::number() const {
+inline int32_t EnumValue::number() const {
   // @@protoc_insertion_point(field_get:google.protobuf.EnumValue.number)
   return _internal_number();
 }
-inline void EnumValue::_internal_set_number(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void EnumValue::_internal_set_number(int32_t value) {
   
   number_ = value;
 }
-inline void EnumValue::set_number(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void EnumValue::set_number(int32_t value) {
   _internal_set_number(value);
   // @@protoc_insertion_point(field_set:google.protobuf.EnumValue.number)
 }
@@ -2395,6 +2445,11 @@
   }
   name_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), name,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (name_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.Option.name)
 }
 
diff --git a/src/google/protobuf/unittest_custom_options.proto b/src/google/protobuf/unittest_custom_options.proto
index f774c76..1812d71 100644
--- a/src/google/protobuf/unittest_custom_options.proto
+++ b/src/google/protobuf/unittest_custom_options.proto
@@ -108,6 +108,8 @@
     int32 oneof_field = 2;
   }
 
+  map<string, string> map_field = 3 [(field_opt1) = 12345];
+
   enum AnEnum {
     option (enum_opt1) = -789;
 
diff --git a/src/google/protobuf/unknown_field_set.cc b/src/google/protobuf/unknown_field_set.cc
index 0d9bf62..423f3e7 100644
--- a/src/google/protobuf/unknown_field_set.cc
+++ b/src/google/protobuf/unknown_field_set.cc
@@ -252,6 +252,7 @@
 }
 
 void UnknownField::DeepCopy(const UnknownField& other) {
+  (void)other;  // Parameter is used by Google-internal code.
   switch (type()) {
     case UnknownField::TYPE_LENGTH_DELIMITED:
       data_.length_delimited_.string_value =
diff --git a/src/google/protobuf/unknown_field_set_unittest.cc b/src/google/protobuf/unknown_field_set_unittest.cc
index bc8db5f..3a6968f 100644
--- a/src/google/protobuf/unknown_field_set_unittest.cc
+++ b/src/google/protobuf/unknown_field_set_unittest.cc
@@ -72,13 +72,13 @@
 
   const UnknownField* GetField(const std::string& name) {
     const FieldDescriptor* field = descriptor_->FindFieldByName(name);
-    if (field == NULL) return NULL;
+    if (field == nullptr) return nullptr;
     for (int i = 0; i < unknown_fields_->field_count(); i++) {
       if (unknown_fields_->field(i).number() == field->number()) {
         return &unknown_fields_->field(i);
       }
     }
-    return NULL;
+    return nullptr;
   }
 
   // Constructs a protocol buffer which contains fields with all the same
@@ -145,7 +145,7 @@
 
 TEST_F(UnknownFieldSetTest, Varint) {
   const UnknownField* field = GetField("optional_int32");
-  ASSERT_TRUE(field != NULL);
+  ASSERT_TRUE(field != nullptr);
 
   ASSERT_EQ(UnknownField::TYPE_VARINT, field->type());
   EXPECT_EQ(all_fields_.optional_int32(), field->varint());
@@ -153,7 +153,7 @@
 
 TEST_F(UnknownFieldSetTest, Fixed32) {
   const UnknownField* field = GetField("optional_fixed32");
-  ASSERT_TRUE(field != NULL);
+  ASSERT_TRUE(field != nullptr);
 
   ASSERT_EQ(UnknownField::TYPE_FIXED32, field->type());
   EXPECT_EQ(all_fields_.optional_fixed32(), field->fixed32());
@@ -161,7 +161,7 @@
 
 TEST_F(UnknownFieldSetTest, Fixed64) {
   const UnknownField* field = GetField("optional_fixed64");
-  ASSERT_TRUE(field != NULL);
+  ASSERT_TRUE(field != nullptr);
 
   ASSERT_EQ(UnknownField::TYPE_FIXED64, field->type());
   EXPECT_EQ(all_fields_.optional_fixed64(), field->fixed64());
@@ -169,7 +169,7 @@
 
 TEST_F(UnknownFieldSetTest, LengthDelimited) {
   const UnknownField* field = GetField("optional_string");
-  ASSERT_TRUE(field != NULL);
+  ASSERT_TRUE(field != nullptr);
 
   ASSERT_EQ(UnknownField::TYPE_LENGTH_DELIMITED, field->type());
   EXPECT_EQ(all_fields_.optional_string(), field->length_delimited());
@@ -177,7 +177,7 @@
 
 TEST_F(UnknownFieldSetTest, Group) {
   const UnknownField* field = GetField("optionalgroup");
-  ASSERT_TRUE(field != NULL);
+  ASSERT_TRUE(field != nullptr);
 
   ASSERT_EQ(UnknownField::TYPE_GROUP, field->type());
   ASSERT_EQ(1, field->group().field_count());
@@ -185,7 +185,7 @@
   const UnknownField& nested_field = field->group().field(0);
   const FieldDescriptor* nested_field_descriptor =
       unittest::TestAllTypes::OptionalGroup::descriptor()->FindFieldByName("a");
-  ASSERT_TRUE(nested_field_descriptor != NULL);
+  ASSERT_TRUE(nested_field_descriptor != nullptr);
 
   EXPECT_EQ(nested_field_descriptor->number(), nested_field.number());
   ASSERT_EQ(UnknownField::TYPE_VARINT, nested_field.type());
@@ -456,8 +456,8 @@
       TestAllTypes::descriptor()->FindFieldByName("optional_nested_enum");
   const FieldDescriptor* repeated_field =
       TestAllTypes::descriptor()->FindFieldByName("repeated_nested_enum");
-  ASSERT_TRUE(singular_field != NULL);
-  ASSERT_TRUE(repeated_field != NULL);
+  ASSERT_TRUE(singular_field != nullptr);
+  ASSERT_TRUE(repeated_field != nullptr);
 
   std::string data;
 
diff --git a/src/google/protobuf/util/field_comparator.cc b/src/google/protobuf/util/field_comparator.cc
index 46d5dba..5d8e865 100644
--- a/src/google/protobuf/util/field_comparator.cc
+++ b/src/google/protobuf/util/field_comparator.cc
@@ -58,7 +58,7 @@
 FieldComparator::ComparisonResult SimpleFieldComparator::SimpleCompare(
     const Message& message_1, const Message& message_2,
     const FieldDescriptor* field, int index_1, int index_2,
-    const util::FieldContext* field_context) {
+    const util::FieldContext* /*field_context*/) {
   const Reflection* reflection_1 = message_1.GetReflection();
   const Reflection* reflection_2 = message_2.GetReflection();
 
@@ -155,7 +155,7 @@
   return CompareDoubleOrFloat(field, value_1, value_2);
 }
 
-bool SimpleFieldComparator::CompareEnum(const FieldDescriptor& field,
+bool SimpleFieldComparator::CompareEnum(const FieldDescriptor& /*field*/,
                                         const EnumValueDescriptor* value_1,
                                         const EnumValueDescriptor* value_2) {
   return value_1->number() == value_2->number();
diff --git a/src/google/protobuf/util/field_mask_util.cc b/src/google/protobuf/util/field_mask_util.cc
index 646f807..c80ae21 100644
--- a/src/google/protobuf/util/field_mask_util.cc
+++ b/src/google/protobuf/util/field_mask_util.cc
@@ -62,7 +62,7 @@
                                          std::string* output) {
   output->clear();
   bool after_underscore = false;
-  for (const char& input_char : input) {
+  for (char input_char : input) {
     if (input_char >= 'A' && input_char <= 'Z') {
       // The field name must not contain uppercase letters.
       return false;
@@ -385,8 +385,8 @@
       if (new_branch_node == nullptr) {
         new_branch_node = node;
       }
-      for (int i = 0; i < current_descriptor->field_count(); ++i) {
-        node->children[current_descriptor->field(i)->name()] = new Node();
+      for (int j = 0; j < current_descriptor->field_count(); ++j) {
+        node->children[current_descriptor->field(j)->name()] = new Node();
       }
     }
     if (ContainsKey(node->children, parts[i])) {
diff --git a/src/google/protobuf/util/field_mask_util.h b/src/google/protobuf/util/field_mask_util.h
index 84cd120..dd8be8d 100644
--- a/src/google/protobuf/util/field_mask_util.h
+++ b/src/google/protobuf/util/field_mask_util.h
@@ -245,7 +245,7 @@
   // When trimming message fields, the default behavior is to trim required
   // fields of the present message if they are not specified in the field mask.
   // If you instead want to keep required fields of the present message even
-  // they are not specified in the field mask, set this flag to true.
+  // when they are not specified in the field mask, set this flag to true.
   void set_keep_required_fields(bool value) { keep_required_fields_ = value; }
   bool keep_required_fields() const { return keep_required_fields_; }
 
diff --git a/src/google/protobuf/util/internal/datapiece.h b/src/google/protobuf/util/internal/datapiece.h
index c27ea5c..efd9aba 100644
--- a/src/google/protobuf/util/internal/datapiece.h
+++ b/src/google/protobuf/util/internal/datapiece.h
@@ -97,7 +97,7 @@
         str_(value),
         use_strict_base64_decoding_(use_strict_base64_decoding) {}
   // Constructor for bytes. The second parameter is not used.
-  DataPiece(StringPiece value, bool dummy, bool use_strict_base64_decoding)
+  DataPiece(StringPiece value, bool /*dummy*/, bool use_strict_base64_decoding)
       : type_(TYPE_BYTES),
         str_(value),
         use_strict_base64_decoding_(use_strict_base64_decoding) {}
diff --git a/src/google/protobuf/util/internal/default_value_objectwriter.cc b/src/google/protobuf/util/internal/default_value_objectwriter.cc
index c9c691a..7f61cda 100644
--- a/src/google/protobuf/util/internal/default_value_objectwriter.cc
+++ b/src/google/protobuf/util/internal/default_value_objectwriter.cc
@@ -423,18 +423,14 @@
       return DataPiece(field.default_value(), true);
     } else {
       const std::string& enum_default_value_name = field.default_value();
-      for (int enum_index = 0;
-          enum_index < enum_type->enumvalue_size();
-          ++enum_index) {
+      for (int enum_index = 0; enum_index < enum_type->enumvalue_size();
+           ++enum_index) {
         auto& enum_value = enum_type->enumvalue(enum_index);
         if (enum_value.name() == enum_default_value_name)
           return DataPiece(enum_value.number());
       }
-      GOOGLE_LOG(WARNING) << "Could not find enum value '"
-                          << enum_default_value_name
-                          << "' with type '"
-                          << field.type_url()
-                          << "'";
+      GOOGLE_LOG(WARNING) << "Could not find enum value '" << enum_default_value_name
+                   << "' with type '" << field.type_url() << "'";
       return DataPiece::NullData();
     }
   }
diff --git a/src/google/protobuf/util/internal/error_listener.h b/src/google/protobuf/util/internal/error_listener.h
index 07cb957..745b66a 100644
--- a/src/google/protobuf/util/internal/error_listener.h
+++ b/src/google/protobuf/util/internal/error_listener.h
@@ -83,16 +83,16 @@
   NoopErrorListener() {}
   ~NoopErrorListener() override {}
 
-  void InvalidName(const LocationTrackerInterface& loc,
-                   StringPiece invalid_name,
-                   StringPiece message) override {}
+  void InvalidName(const LocationTrackerInterface& /*loc*/,
+                   StringPiece /* invalid_name */,
+                   StringPiece /* message */) override {}
 
-  void InvalidValue(const LocationTrackerInterface& loc,
-                    StringPiece type_name,
-                    StringPiece value) override {}
+  void InvalidValue(const LocationTrackerInterface& /*loc*/,
+                    StringPiece /* type_name */,
+                    StringPiece /* value */) override {}
 
-  void MissingField(const LocationTrackerInterface& loc,
-                    StringPiece missing_name) override {}
+  void MissingField(const LocationTrackerInterface& /* loc */,
+                    StringPiece /* missing_name */) override {}
 
  private:
   GOOGLE_DISALLOW_EVIL_CONSTRUCTORS(NoopErrorListener);
diff --git a/src/google/protobuf/util/internal/expecting_objectwriter.h b/src/google/protobuf/util/internal/expecting_objectwriter.h
index 0f2eb1e..b40ef0c 100644
--- a/src/google/protobuf/util/internal/expecting_objectwriter.h
+++ b/src/google/protobuf/util/internal/expecting_objectwriter.h
@@ -93,7 +93,8 @@
               (override));
   MOCK_METHOD(ObjectWriter*, RenderString,
               (StringPiece, StringPiece), (override));
-  MOCK_METHOD(ObjectWriter*, RenderBytes, (StringPiece, StringPiece), (override));
+  MOCK_METHOD(ObjectWriter*, RenderBytes, (StringPiece, StringPiece),
+              (override));
   MOCK_METHOD(ObjectWriter*, RenderNull, (StringPiece), (override));
 };
 
diff --git a/src/google/protobuf/util/internal/json_stream_parser.cc b/src/google/protobuf/util/internal/json_stream_parser.cc
index ff692cd..f52c544 100644
--- a/src/google/protobuf/util/internal/json_stream_parser.cc
+++ b/src/google/protobuf/util/internal/json_stream_parser.cc
@@ -864,6 +864,7 @@
 
 util::Status JsonStreamParser::ReportFailure(StringPiece message,
                                              ParseErrorType parse_code) {
+  (void)parse_code;  // Parameter is used in Google-internal code.
   static const int kContextLength = 20;
   const char* p_start = p_.data();
   const char* json_start = json_.data();
diff --git a/src/google/protobuf/util/internal/protostream_objectsource.cc b/src/google/protobuf/util/internal/protostream_objectsource.cc
index 3a37d9c..221c42f 100644
--- a/src/google/protobuf/util/internal/protostream_objectsource.cc
+++ b/src/google/protobuf/util/internal/protostream_objectsource.cc
@@ -252,7 +252,7 @@
 }
 
 util::StatusOr<uint32_t> ProtoStreamObjectSource::RenderMap(
-    const google::protobuf::Field* field, StringPiece name,
+    const google::protobuf::Field* field, StringPiece /* name */,
     uint32_t list_tag, ObjectWriter* ow) const {
   const google::protobuf::Type* field_type =
       typeinfo_->GetTypeByTypeUrl(field->type_url());
@@ -265,16 +265,16 @@
     std::string map_key;
     for (uint32_t tag = stream_->ReadTag(); tag != 0;
          tag = stream_->ReadTag()) {
-      const google::protobuf::Field* field =
+      const google::protobuf::Field* map_entry_field =
           FindAndVerifyField(*field_type, tag);
-      if (field == nullptr) {
+      if (map_entry_field == nullptr) {
         WireFormat::SkipField(stream_, tag, nullptr);
         continue;
       }
       // Map field numbers are key = 1 and value = 2
-      if (field->number() == 1) {
-        map_key = ReadFieldValueAsString(*field);
-      } else if (field->number() == 2) {
+      if (map_entry_field->number() == 1) {
+        map_key = ReadFieldValueAsString(*map_entry_field);
+      } else if (map_entry_field->number() == 2) {
         if (map_key.empty()) {
           // An absent map key is treated as the default.
           const google::protobuf::Field* key_field =
@@ -286,7 +286,7 @@
           }
           ASSIGN_OR_RETURN(map_key, MapKeyDefaultValueAsString(*key_field));
         }
-        RETURN_IF_ERROR(RenderField(field, map_key, ow));
+        RETURN_IF_ERROR(RenderField(map_entry_field, map_key, ow));
       } else {
         // The Type info for this map entry is incorrect. It should contain
         // exactly two fields with field number 1 and 2.
@@ -375,7 +375,7 @@
 }
 
 util::Status ProtoStreamObjectSource::RenderDouble(
-    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
+    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
     StringPiece field_name, ObjectWriter* ow) {
   uint32_t tag = os->stream_->ReadTag();
   uint64_t buffer64 = 0;  // default value of Double wrapper value
@@ -388,7 +388,7 @@
 }
 
 util::Status ProtoStreamObjectSource::RenderFloat(
-    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
+    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
     StringPiece field_name, ObjectWriter* ow) {
   uint32_t tag = os->stream_->ReadTag();
   uint32_t buffer32 = 0;  // default value of Float wrapper value
@@ -401,7 +401,7 @@
 }
 
 util::Status ProtoStreamObjectSource::RenderInt64(
-    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
+    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
     StringPiece field_name, ObjectWriter* ow) {
   uint32_t tag = os->stream_->ReadTag();
   uint64_t buffer64 = 0;  // default value of Int64 wrapper value
@@ -414,7 +414,7 @@
 }
 
 util::Status ProtoStreamObjectSource::RenderUInt64(
-    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
+    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
     StringPiece field_name, ObjectWriter* ow) {
   uint32_t tag = os->stream_->ReadTag();
   uint64_t buffer64 = 0;  // default value of UInt64 wrapper value
@@ -427,7 +427,7 @@
 }
 
 util::Status ProtoStreamObjectSource::RenderInt32(
-    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
+    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
     StringPiece field_name, ObjectWriter* ow) {
   uint32_t tag = os->stream_->ReadTag();
   uint32_t buffer32 = 0;  // default value of Int32 wrapper value
@@ -440,7 +440,7 @@
 }
 
 util::Status ProtoStreamObjectSource::RenderUInt32(
-    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
+    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
     StringPiece field_name, ObjectWriter* ow) {
   uint32_t tag = os->stream_->ReadTag();
   uint32_t buffer32 = 0;  // default value of UInt32 wrapper value
@@ -453,7 +453,7 @@
 }
 
 util::Status ProtoStreamObjectSource::RenderBool(
-    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
+    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
     StringPiece field_name, ObjectWriter* ow) {
   uint32_t tag = os->stream_->ReadTag();
   uint64_t buffer64 = 0;  // results in 'false' value as default, which is the
@@ -467,7 +467,7 @@
 }
 
 util::Status ProtoStreamObjectSource::RenderString(
-    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
+    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
     StringPiece field_name, ObjectWriter* ow) {
   uint32_t tag = os->stream_->ReadTag();
   uint32_t buffer32;
@@ -482,7 +482,7 @@
 }
 
 util::Status ProtoStreamObjectSource::RenderBytes(
-    const ProtoStreamObjectSource* os, const google::protobuf::Type& type,
+    const ProtoStreamObjectSource* os, const google::protobuf::Type& /*type*/,
     StringPiece field_name, ObjectWriter* ow) {
   uint32_t tag = os->stream_->ReadTag();
   uint32_t buffer32;
diff --git a/src/google/protobuf/util/message_differencer.cc b/src/google/protobuf/util/message_differencer.cc
index 6d7f2f9..bf933ab 100644
--- a/src/google/protobuf/util/message_differencer.cc
+++ b/src/google/protobuf/util/message_differencer.cc
@@ -78,25 +78,28 @@
 
   // Report that a field has been added into Message2.
   void ReportAdded(
-      const google::protobuf::Message& message1, const google::protobuf::Message& message2,
+      const google::protobuf::Message& /* message1 */,
+      const google::protobuf::Message& /* message2 */,
       const std::vector<google::protobuf::util::MessageDifferencer::SpecificField>&
-          field_path) override {
+      /*field_path*/) override {
     ++num_diffs_;
   }
 
   // Report that a field has been deleted from Message1.
   void ReportDeleted(
-      const google::protobuf::Message& message1, const google::protobuf::Message& message2,
+      const google::protobuf::Message& /* message1 */,
+      const google::protobuf::Message& /* message2 */,
       const std::vector<google::protobuf::util::MessageDifferencer::SpecificField>&
-          field_path) override {
+      /*field_path*/) override {
     ++num_diffs_;
   }
 
   // Report that the value of a field has been modified.
   void ReportModified(
-      const google::protobuf::Message& message1, const google::protobuf::Message& message2,
+      const google::protobuf::Message& /* message1 */,
+      const google::protobuf::Message& /* message2 */,
       const std::vector<google::protobuf::util::MessageDifferencer::SpecificField>&
-          field_path) override {
+      /*field_path*/) override {
     ++num_diffs_;
   }
 
@@ -2076,9 +2079,9 @@
 void MessageDifferencer::StreamReporter::PrintMapKey(
     bool left_side, const SpecificField& specific_field) {
   if (message1_ == nullptr || message2_ == nullptr) {
-    GOOGLE_LOG(WARNING) << "PrintPath cannot log map keys; "
-                    "use SetMessages to provide the messages "
-                    "being compared prior to any processing.";
+    GOOGLE_LOG(INFO) << "PrintPath cannot log map keys; "
+                 "use SetMessages to provide the messages "
+                 "being compared prior to any processing.";
     return;
   }
 
@@ -2104,7 +2107,7 @@
 }
 
 void MessageDifferencer::StreamReporter::ReportAdded(
-    const Message& message1, const Message& message2,
+    const Message& /*message1*/, const Message& message2,
     const std::vector<SpecificField>& field_path) {
   printer_->Print("added: ");
   PrintPath(field_path, false);
@@ -2114,7 +2117,7 @@
 }
 
 void MessageDifferencer::StreamReporter::ReportDeleted(
-    const Message& message1, const Message& message2,
+    const Message& message1, const Message& /*message2*/,
     const std::vector<SpecificField>& field_path) {
   printer_->Print("deleted: ");
   PrintPath(field_path, true);
@@ -2153,7 +2156,7 @@
 }
 
 void MessageDifferencer::StreamReporter::ReportMoved(
-    const Message& message1, const Message& message2,
+    const Message& message1, const Message& /*message2*/,
     const std::vector<SpecificField>& field_path) {
   printer_->Print("moved: ");
   PrintPath(field_path, true);
@@ -2165,7 +2168,7 @@
 }
 
 void MessageDifferencer::StreamReporter::ReportMatched(
-    const Message& message1, const Message& message2,
+    const Message& message1, const Message& /*message2*/,
     const std::vector<SpecificField>& field_path) {
   printer_->Print("matched: ");
   PrintPath(field_path, true);
@@ -2179,7 +2182,7 @@
 }
 
 void MessageDifferencer::StreamReporter::ReportIgnored(
-    const Message& message1, const Message& message2,
+    const Message& /*message1*/, const Message& /*message2*/,
     const std::vector<SpecificField>& field_path) {
   printer_->Print("ignored: ");
   PrintPath(field_path, true);
@@ -2197,7 +2200,7 @@
 }
 
 void MessageDifferencer::StreamReporter::ReportUnknownFieldIgnored(
-    const Message& message1, const Message& message2,
+    const Message& /*message1*/, const Message& /*message2*/,
     const std::vector<SpecificField>& field_path) {
   printer_->Print("ignored: ");
   PrintPath(field_path, true);
diff --git a/src/google/protobuf/util/message_differencer.h b/src/google/protobuf/util/message_differencer.h
index 1ee6a38..fbb5d20 100644
--- a/src/google/protobuf/util/message_differencer.h
+++ b/src/google/protobuf/util/message_differencer.h
@@ -212,20 +212,6 @@
     int unknown_field_index2 = -1;
   };
 
-  // Class for processing Any deserialization.  This logic is used by both the
-  // MessageDifferencer and StreamReporter classes.
-  class UnpackAnyField {
-   private:
-    std::unique_ptr<DynamicMessageFactory> dynamic_message_factory_;
-
-   public:
-    UnpackAnyField() = default;
-    ~UnpackAnyField() = default;
-    // If "any" is of type google.protobuf.Any, extract its payload using
-    // DynamicMessageFactory and store in "data".
-    bool UnpackAny(const Message& any, std::unique_ptr<Message>* data);
-  };
-
   // Abstract base class from which all MessageDifferencer
   // reporters derive. The five Report* methods below will be called when
   // a field has been added, deleted, modified, moved, or matched. The third
@@ -628,6 +614,22 @@
   // differences to any previously set reporters or output strings.
   void ReportDifferencesTo(Reporter* reporter);
 
+ private:
+  // Class for processing Any deserialization.  This logic is used by both the
+  // MessageDifferencer and StreamReporter classes.
+  class UnpackAnyField {
+   private:
+    std::unique_ptr<DynamicMessageFactory> dynamic_message_factory_;
+
+   public:
+    UnpackAnyField() = default;
+    ~UnpackAnyField() = default;
+    // If "any" is of type google.protobuf.Any, extract its payload using
+    // DynamicMessageFactory and store in "data".
+    bool UnpackAny(const Message& any, std::unique_ptr<Message>* data);
+  };
+
+ public:
   // An implementation of the MessageDifferencer Reporter that outputs
   // any differences found in human-readable form to the supplied
   // ZeroCopyOutputStream or Printer. If a printer is used, the delimiter
diff --git a/src/google/protobuf/wire_format.cc b/src/google/protobuf/wire_format.cc
index 4b94f68..e68af89 100644
--- a/src/google/protobuf/wire_format.cc
+++ b/src/google/protobuf/wire_format.cc
@@ -92,19 +92,19 @@
     case WireFormatLite::WIRETYPE_VARINT: {
       uint64_t value;
       if (!input->ReadVarint64(&value)) return false;
-      if (unknown_fields != NULL) unknown_fields->AddVarint(number, value);
+      if (unknown_fields != nullptr) unknown_fields->AddVarint(number, value);
       return true;
     }
     case WireFormatLite::WIRETYPE_FIXED64: {
       uint64_t value;
       if (!input->ReadLittleEndian64(&value)) return false;
-      if (unknown_fields != NULL) unknown_fields->AddFixed64(number, value);
+      if (unknown_fields != nullptr) unknown_fields->AddFixed64(number, value);
       return true;
     }
     case WireFormatLite::WIRETYPE_LENGTH_DELIMITED: {
       uint32_t length;
       if (!input->ReadVarint32(&length)) return false;
-      if (unknown_fields == NULL) {
+      if (unknown_fields == nullptr) {
         if (!input->Skip(length)) return false;
       } else {
         if (!input->ReadString(unknown_fields->AddLengthDelimited(number),
@@ -116,8 +116,8 @@
     }
     case WireFormatLite::WIRETYPE_START_GROUP: {
       if (!input->IncrementRecursionDepth()) return false;
-      if (!SkipMessage(input, (unknown_fields == NULL)
-                                  ? NULL
+      if (!SkipMessage(input, (unknown_fields == nullptr)
+                                  ? nullptr
                                   : unknown_fields->AddGroup(number))) {
         return false;
       }
@@ -136,7 +136,7 @@
     case WireFormatLite::WIRETYPE_FIXED32: {
       uint32_t value;
       if (!input->ReadLittleEndian32(&value)) return false;
-      if (unknown_fields != NULL) unknown_fields->AddFixed32(number, value);
+      if (unknown_fields != nullptr) unknown_fields->AddFixed32(number, value);
       return true;
     }
     default: {
@@ -179,7 +179,7 @@
             input, &value)) {
       return false;
     }
-    if (is_valid == NULL || is_valid(value)) {
+    if (is_valid == nullptr || is_valid(value)) {
       values->Add(value);
     } else {
       unknown_fields->AddVarint(field_number, value);
@@ -346,15 +346,15 @@
       return true;
     }
 
-    const FieldDescriptor* field = NULL;
+    const FieldDescriptor* field = nullptr;
 
-    if (descriptor != NULL) {
+    if (descriptor != nullptr) {
       int field_number = WireFormatLite::GetTagFieldNumber(tag);
       field = descriptor->FindFieldByNumber(field_number);
 
       // If that failed, check if the field is an extension.
-      if (field == NULL && descriptor->IsExtensionNumber(field_number)) {
-        if (input->GetExtensionPool() == NULL) {
+      if (field == nullptr && descriptor->IsExtensionNumber(field_number)) {
+        if (input->GetExtensionPool() == nullptr) {
           field = message_reflection->FindKnownExtensionByNumber(field_number);
         } else {
           field = input->GetExtensionPool()->FindExtensionByNumber(
@@ -364,7 +364,7 @@
 
       // If that failed, but we're a MessageSet, and this is the tag for a
       // MessageSet item, then parse that.
-      if (field == NULL && descriptor->options().message_set_wire_format() &&
+      if (field == nullptr && descriptor->options().message_set_wire_format() &&
           tag == WireFormatLite::kMessageSetItemStartTag) {
         if (!ParseAndMergeMessageSetItem(input, message)) {
           return false;
@@ -393,7 +393,7 @@
                                               Message* message,
                                               io::CodedInputStream* input) {
   const Reflection* message_reflection = message->GetReflection();
-  if (field == NULL) {
+  if (field == nullptr) {
     // We store unknown MessageSet extensions as groups.
     return SkipMessageSetField(
         input, field_number, message_reflection->MutableUnknownFields(message));
@@ -416,13 +416,13 @@
 
 bool WireFormat::ParseAndMergeField(
     uint32_t tag,
-    const FieldDescriptor* field,  // May be NULL for unknown
+    const FieldDescriptor* field,  // May be nullptr for unknown
     Message* message, io::CodedInputStream* input) {
   const Reflection* message_reflection = message->GetReflection();
 
   enum { UNKNOWN, NORMAL_FORMAT, PACKED_FORMAT } value_format;
 
-  if (field == NULL) {
+  if (field == nullptr) {
     value_format = UNKNOWN;
   } else if (WireFormatLite::GetTagWireType(tag) ==
              WireTypeForFieldType(field->type())) {
@@ -489,7 +489,7 @@
           } else {
             const EnumValueDescriptor* enum_value =
                 field->enum_type()->FindValueByNumber(value);
-            if (enum_value != NULL) {
+            if (enum_value != nullptr) {
               message_reflection->AddEnum(message, field, enum_value);
             } else {
               // The enum value is not one of the known values.  Add it to the
@@ -642,7 +642,7 @@
     }
 
     bool SkipField(uint32_t tag, io::CodedInputStream* input) {
-      return WireFormat::SkipField(input, tag, NULL);
+      return WireFormat::SkipField(input, tag, nullptr);
     }
 
     const Reflection* message_reflection;
@@ -992,9 +992,9 @@
         }
       }
       if (field->is_repeated()) {
-        reflection->AddString(msg, field, value);
+        reflection->AddString(msg, field, std::move(value));
       } else {
-        reflection->SetString(msg, field, value);
+        reflection->SetString(msg, field, std::move(value));
       }
       return ptr;
     }
diff --git a/src/google/protobuf/wire_format.h b/src/google/protobuf/wire_format.h
index 7ca217a..3628be3 100644
--- a/src/google/protobuf/wire_format.h
+++ b/src/google/protobuf/wire_format.h
@@ -146,17 +146,17 @@
   // Helpers for dealing with unknown fields
 
   // Skips a field value of the given WireType.  The input should start
-  // positioned immediately after the tag.  If unknown_fields is non-NULL,
+  // positioned immediately after the tag.  If unknown_fields is non-nullptr,
   // the contents of the field will be added to it.
   static bool SkipField(io::CodedInputStream* input, uint32_t tag,
                         UnknownFieldSet* unknown_fields);
 
   // Reads and ignores a message from the input.  If unknown_fields is
-  // non-NULL, the contents will be added to it.
+  // non-nullptr, the contents will be added to it.
   static bool SkipMessage(io::CodedInputStream* input,
                           UnknownFieldSet* unknown_fields);
 
-  // Read a packed enum field. If the is_valid function is not NULL, values
+  // Read a packed enum field. If the is_valid function is not nullptr, values
   // for which is_valid(value) returns false are appended to
   // unknown_fields_stream.
   static bool ReadPackedEnumPreserveUnknowns(io::CodedInputStream* input,
@@ -225,24 +225,24 @@
   // after the tag.
   static bool ParseAndMergeField(
       uint32_t tag,
-      const FieldDescriptor* field,  // May be NULL for unknown
+      const FieldDescriptor* field,  // May be nullptr for unknown
       Message* message, io::CodedInputStream* input);
 
   // Serialize a single field.
   static void SerializeFieldWithCachedSizes(
-      const FieldDescriptor* field,  // Cannot be NULL
+      const FieldDescriptor* field,  // Cannot be nullptr
       const Message& message, io::CodedOutputStream* output) {
     output->SetCur(InternalSerializeField(field, message, output->Cur(),
                                           output->EpsCopy()));
   }
   static uint8_t* InternalSerializeField(
-      const FieldDescriptor* field,  // Cannot be NULL
+      const FieldDescriptor* field,  // Cannot be nullptr
       const Message& message, uint8_t* target, io::EpsCopyOutputStream* stream);
 
   // Compute size of a single field.  If the field is a message type, this
   // will call ByteSize() for the embedded message, insuring that it caches
   // its size.
-  static size_t FieldByteSize(const FieldDescriptor* field,  // Cannot be NULL
+  static size_t FieldByteSize(const FieldDescriptor* field,  // Can't be nullptr
                               const Message& message);
 
   // Parse/serialize a MessageSet::Item group.  Used with messages that use
@@ -266,7 +266,7 @@
   // length, but for other length-delimited types, the size of the length is
   // included.
   static size_t FieldDataOnlyByteSize(
-      const FieldDescriptor* field,  // Cannot be NULL
+      const FieldDescriptor* field,  // Cannot be nullptr
       const Message& message);
 
   enum Operation {
@@ -357,7 +357,7 @@
                                          WireFormat::Operation op) {
 #ifdef GOOGLE_PROTOBUF_UTF8_VALIDATION_ENABLED
   WireFormatLite::VerifyUtf8String(
-      data, size, static_cast<WireFormatLite::Operation>(op), NULL);
+      data, size, static_cast<WireFormatLite::Operation>(op), nullptr);
 #else
   // Avoid the compiler warning about unused variables.
   (void)data;
diff --git a/src/google/protobuf/wire_format_lite.cc b/src/google/protobuf/wire_format_lite.cc
index f61f4e5..b16edb4 100644
--- a/src/google/protobuf/wire_format_lite.cc
+++ b/src/google/protobuf/wire_format_lite.cc
@@ -34,6 +34,7 @@
 
 #include <google/protobuf/wire_format_lite.h>
 
+#include <limits>
 #include <stack>
 #include <string>
 #include <vector>
@@ -52,7 +53,7 @@
 namespace protobuf {
 namespace internal {
 
-#if !defined(_MSC_VER) || _MSC_VER >= 1900
+#if !defined(_MSC_VER) || (_MSC_VER >= 1900 && _MSC_VER < 1912)
 // Old version of MSVC doesn't like definitions of inline constants, GCC
 // requires them.
 const int WireFormatLite::kMessageSetItemStartTag;
@@ -303,7 +304,7 @@
     if (!ReadPrimitive<int, WireFormatLite::TYPE_ENUM>(input, &value)) {
       return false;
     }
-    if (is_valid == NULL || is_valid(value)) {
+    if (is_valid == nullptr || is_valid(value)) {
       values->Add(value);
     } else {
       uint32_t tag = WireFormatLite::MakeTag(field_number,
@@ -475,11 +476,13 @@
   WriteEnumNoTag(value, output);
 }
 
+constexpr size_t kInt32MaxSize = std::numeric_limits<int32_t>::max();
+
 void WireFormatLite::WriteString(int field_number, const std::string& value,
                                  io::CodedOutputStream* output) {
   // String is for UTF-8 text only
   WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output);
-  GOOGLE_CHECK_LE(value.size(), static_cast<size_t>(kint32max));
+  GOOGLE_CHECK_LE(value.size(), kInt32MaxSize);
   output->WriteVarint32(value.size());
   output->WriteString(value);
 }
@@ -488,14 +491,14 @@
                                              io::CodedOutputStream* output) {
   // String is for UTF-8 text only
   WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output);
-  GOOGLE_CHECK_LE(value.size(), static_cast<size_t>(kint32max));
+  GOOGLE_CHECK_LE(value.size(), kInt32MaxSize);
   output->WriteVarint32(value.size());
   output->WriteRawMaybeAliased(value.data(), value.size());
 }
 void WireFormatLite::WriteBytes(int field_number, const std::string& value,
                                 io::CodedOutputStream* output) {
   WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output);
-  GOOGLE_CHECK_LE(value.size(), static_cast<size_t>(kint32max));
+  GOOGLE_CHECK_LE(value.size(), kInt32MaxSize);
   output->WriteVarint32(value.size());
   output->WriteString(value);
 }
@@ -503,7 +506,7 @@
                                             const std::string& value,
                                             io::CodedOutputStream* output) {
   WriteTag(field_number, WIRETYPE_LENGTH_DELIMITED, output);
-  GOOGLE_CHECK_LE(value.size(), static_cast<size_t>(kint32max));
+  GOOGLE_CHECK_LE(value.size(), kInt32MaxSize);
   output->WriteVarint32(value.size());
   output->WriteRawMaybeAliased(value.data(), value.size());
 }
@@ -525,7 +528,7 @@
 }
 
 void WireFormatLite::WriteSubMessageMaybeToArray(
-    int size, const MessageLite& value, io::CodedOutputStream* output) {
+    int /*size*/, const MessageLite& value, io::CodedOutputStream* output) {
   output->SetCur(value._InternalSerialize(output->Cur(), output->EpsCopy()));
 }
 
@@ -570,6 +573,7 @@
 void PrintUTF8ErrorLog(const char* field_name, const char* operation_str,
                        bool emit_stacktrace) {
   std::string stacktrace;
+  (void)emit_stacktrace;  // Parameter is used by Google-internal code.
   std::string quoted_field_name = "";
   if (field_name != nullptr) {
     quoted_field_name = StringPrintf(" '%s'", field_name);
@@ -583,7 +587,7 @@
 bool WireFormatLite::VerifyUtf8String(const char* data, int size, Operation op,
                                       const char* field_name) {
   if (!IsStructurallyValidUTF8(data, size)) {
-    const char* operation_str = NULL;
+    const char* operation_str = nullptr;
     switch (op) {
       case PARSE:
         operation_str = "parsing";
diff --git a/src/google/protobuf/wire_format_lite.h b/src/google/protobuf/wire_format_lite.h
index 83668e9..b04d17b 100644
--- a/src/google/protobuf/wire_format_lite.h
+++ b/src/google/protobuf/wire_format_lite.h
@@ -66,6 +66,7 @@
 // #pragma pop_macro("TYPE_BOOL")
 #undef TYPE_BOOL
 
+
 #include <google/protobuf/port_def.inc>
 
 namespace google {
@@ -293,14 +294,15 @@
   static bool ReadPackedPrimitiveNoInline(io::CodedInputStream* input,
                                           RepeatedField<CType>* value);
 
-  // Read a packed enum field. If the is_valid function is not NULL, values for
-  // which is_valid(value) returns false are silently dropped.
+  // Read a packed enum field. If the is_valid function is not nullptr, values
+  // for which is_valid(value) returns false are silently dropped.
   static bool ReadPackedEnumNoInline(io::CodedInputStream* input,
                                      bool (*is_valid)(int),
                                      RepeatedField<int>* values);
 
-  // Read a packed enum field. If the is_valid function is not NULL, values for
-  // which is_valid(value) returns false are appended to unknown_fields_stream.
+  // Read a packed enum field. If the is_valid function is not nullptr, values
+  // for which is_valid(value) returns false are appended to
+  // unknown_fields_stream.
   static bool ReadPackedEnumPreserveUnknowns(
       io::CodedInputStream* input, int field_number, bool (*is_valid)(int),
       io::CodedOutputStream* unknown_fields_stream, RepeatedField<int>* values);
@@ -1105,7 +1107,7 @@
     int num_read = 0;
     while (num_read < elements_available &&
            (buffer = io::CodedInputStream::ExpectTagFromArray(buffer, tag)) !=
-               NULL) {
+               nullptr) {
       buffer = ReadPrimitiveFromArray<CType, DeclaredType>(buffer, &value);
       values->AddAlreadyReserved(value);
       ++num_read;
diff --git a/src/google/protobuf/wrappers.pb.cc b/src/google/protobuf/wrappers.pb.cc
index d1322e9..2ce0df1 100644
--- a/src/google/protobuf/wrappers.pb.cc
+++ b/src/google/protobuf/wrappers.pb.cc
@@ -130,7 +130,7 @@
 static constexpr ::PROTOBUF_NAMESPACE_ID::EnumDescriptor const** file_level_enum_descriptors_google_2fprotobuf_2fwrappers_2eproto = nullptr;
 static constexpr ::PROTOBUF_NAMESPACE_ID::ServiceDescriptor const** file_level_service_descriptors_google_2fprotobuf_2fwrappers_2eproto = nullptr;
 
-const ::PROTOBUF_NAMESPACE_ID::uint32 TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
+const uint32_t TableStruct_google_2fprotobuf_2fwrappers_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
   ~0u,  // no _has_bits_
   PROTOBUF_FIELD_OFFSET(::PROTOBUF_NAMESPACE_ID::DoubleValue, _internal_metadata_),
   ~0u,  // no _extensions_
@@ -270,7 +270,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.DoubleValue)
 }
 
-void DoubleValue::SharedCtor() {
+inline void DoubleValue::SharedCtor() {
 value_ = 0;
 }
 
@@ -297,7 +297,7 @@
 
 void DoubleValue::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.DoubleValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -308,12 +308,12 @@
 const char* DoubleValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // double value = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 9)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 9)) {
           value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<double>(ptr);
           ptr += sizeof(double);
         } else
@@ -342,14 +342,18 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* DoubleValue::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* DoubleValue::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.DoubleValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // double value = 1;
-  if (!(this->_internal_value() <= 0 && this->_internal_value() >= 0)) {
+  static_assert(sizeof(uint64_t) == sizeof(double), "Code assumes uint64_t and double are the same size.");
+  double tmp_value = this->_internal_value();
+  uint64_t raw_value;
+  memcpy(&raw_value, &tmp_value, sizeof(tmp_value));
+  if (raw_value != 0) {
     target = stream->EnsureSpace(target);
     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteDoubleToArray(1, this->_internal_value(), target);
   }
@@ -366,12 +370,16 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.DoubleValue)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
   // double value = 1;
-  if (!(this->_internal_value() <= 0 && this->_internal_value() >= 0)) {
+  static_assert(sizeof(uint64_t) == sizeof(double), "Code assumes uint64_t and double are the same size.");
+  double tmp_value = this->_internal_value();
+  uint64_t raw_value;
+  memcpy(&raw_value, &tmp_value, sizeof(tmp_value));
+  if (raw_value != 0) {
     total_size += 1 + 8;
   }
 
@@ -394,10 +402,14 @@
 void DoubleValue::MergeFrom(const DoubleValue& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.DoubleValue)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
-  if (!(from._internal_value() <= 0 && from._internal_value() >= 0)) {
+  static_assert(sizeof(uint64_t) == sizeof(double), "Code assumes uint64_t and double are the same size.");
+  double tmp_value = from._internal_value();
+  uint64_t raw_value;
+  memcpy(&raw_value, &tmp_value, sizeof(tmp_value));
+  if (raw_value != 0) {
     _internal_set_value(from._internal_value());
   }
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
@@ -448,7 +460,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.FloatValue)
 }
 
-void FloatValue::SharedCtor() {
+inline void FloatValue::SharedCtor() {
 value_ = 0;
 }
 
@@ -475,7 +487,7 @@
 
 void FloatValue::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.FloatValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -486,12 +498,12 @@
 const char* FloatValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // float value = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 13)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 13)) {
           value_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
           ptr += sizeof(float);
         } else
@@ -520,14 +532,18 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* FloatValue::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* FloatValue::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.FloatValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // float value = 1;
-  if (!(this->_internal_value() <= 0 && this->_internal_value() >= 0)) {
+  static_assert(sizeof(uint32_t) == sizeof(float), "Code assumes uint32_t and float are the same size.");
+  float tmp_value = this->_internal_value();
+  uint32_t raw_value;
+  memcpy(&raw_value, &tmp_value, sizeof(tmp_value));
+  if (raw_value != 0) {
     target = stream->EnsureSpace(target);
     target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteFloatToArray(1, this->_internal_value(), target);
   }
@@ -544,12 +560,16 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.FloatValue)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
   // float value = 1;
-  if (!(this->_internal_value() <= 0 && this->_internal_value() >= 0)) {
+  static_assert(sizeof(uint32_t) == sizeof(float), "Code assumes uint32_t and float are the same size.");
+  float tmp_value = this->_internal_value();
+  uint32_t raw_value;
+  memcpy(&raw_value, &tmp_value, sizeof(tmp_value));
+  if (raw_value != 0) {
     total_size += 1 + 4;
   }
 
@@ -572,10 +592,14 @@
 void FloatValue::MergeFrom(const FloatValue& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.FloatValue)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
-  if (!(from._internal_value() <= 0 && from._internal_value() >= 0)) {
+  static_assert(sizeof(uint32_t) == sizeof(float), "Code assumes uint32_t and float are the same size.");
+  float tmp_value = from._internal_value();
+  uint32_t raw_value;
+  memcpy(&raw_value, &tmp_value, sizeof(tmp_value));
+  if (raw_value != 0) {
     _internal_set_value(from._internal_value());
   }
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
@@ -626,7 +650,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Int64Value)
 }
 
-void Int64Value::SharedCtor() {
+inline void Int64Value::SharedCtor() {
 value_ = int64_t{0};
 }
 
@@ -653,7 +677,7 @@
 
 void Int64Value::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Int64Value)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -664,12 +688,12 @@
 const char* Int64Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // int64 value = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
         } else
@@ -698,10 +722,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Int64Value::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Int64Value::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int64Value)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // int64 value = 1;
@@ -722,7 +746,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Int64Value)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -750,7 +774,7 @@
 void Int64Value::MergeFrom(const Int64Value& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Int64Value)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (from._internal_value() != 0) {
@@ -804,7 +828,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.UInt64Value)
 }
 
-void UInt64Value::SharedCtor() {
+inline void UInt64Value::SharedCtor() {
 value_ = uint64_t{0u};
 }
 
@@ -831,7 +855,7 @@
 
 void UInt64Value::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.UInt64Value)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -842,12 +866,12 @@
 const char* UInt64Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // uint64 value = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
         } else
@@ -876,10 +900,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* UInt64Value::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* UInt64Value::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt64Value)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // uint64 value = 1;
@@ -900,7 +924,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UInt64Value)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -928,7 +952,7 @@
 void UInt64Value::MergeFrom(const UInt64Value& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UInt64Value)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (from._internal_value() != 0) {
@@ -982,7 +1006,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.Int32Value)
 }
 
-void Int32Value::SharedCtor() {
+inline void Int32Value::SharedCtor() {
 value_ = 0;
 }
 
@@ -1009,7 +1033,7 @@
 
 void Int32Value::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.Int32Value)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1020,13 +1044,13 @@
 const char* Int32Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // int32 value = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
-          value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
+          value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
           goto handle_unusual;
@@ -1054,10 +1078,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* Int32Value::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* Int32Value::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.Int32Value)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // int32 value = 1;
@@ -1078,7 +1102,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.Int32Value)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1106,7 +1130,7 @@
 void Int32Value::MergeFrom(const Int32Value& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.Int32Value)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (from._internal_value() != 0) {
@@ -1160,7 +1184,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.UInt32Value)
 }
 
-void UInt32Value::SharedCtor() {
+inline void UInt32Value::SharedCtor() {
 value_ = 0u;
 }
 
@@ -1187,7 +1211,7 @@
 
 void UInt32Value::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.UInt32Value)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1198,12 +1222,12 @@
 const char* UInt32Value::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // uint32 value = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint32(&ptr);
           CHK_(ptr);
         } else
@@ -1232,10 +1256,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* UInt32Value::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* UInt32Value::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.UInt32Value)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // uint32 value = 1;
@@ -1256,7 +1280,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.UInt32Value)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1284,7 +1308,7 @@
 void UInt32Value::MergeFrom(const UInt32Value& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.UInt32Value)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (from._internal_value() != 0) {
@@ -1338,7 +1362,7 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.BoolValue)
 }
 
-void BoolValue::SharedCtor() {
+inline void BoolValue::SharedCtor() {
 value_ = false;
 }
 
@@ -1365,7 +1389,7 @@
 
 void BoolValue::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.BoolValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1376,12 +1400,12 @@
 const char* BoolValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // bool value = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 8)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 8)) {
           value_ = ::PROTOBUF_NAMESPACE_ID::internal::ReadVarint64(&ptr);
           CHK_(ptr);
         } else
@@ -1410,10 +1434,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* BoolValue::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* BoolValue::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BoolValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // bool value = 1;
@@ -1434,7 +1458,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.BoolValue)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1462,7 +1486,7 @@
 void BoolValue::MergeFrom(const BoolValue& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.BoolValue)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (from._internal_value() != 0) {
@@ -1513,6 +1537,9 @@
   : ::PROTOBUF_NAMESPACE_ID::Message() {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_value().empty()) {
     value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(), 
       GetArenaForAllocation());
@@ -1520,8 +1547,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.StringValue)
 }
 
-void StringValue::SharedCtor() {
+inline void StringValue::SharedCtor() {
 value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 }
 
 StringValue::~StringValue() {
@@ -1548,7 +1578,7 @@
 
 void StringValue::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.StringValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1559,12 +1589,12 @@
 const char* StringValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // string value = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_value();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(::PROTOBUF_NAMESPACE_ID::internal::VerifyUTF8(str, "google.protobuf.StringValue.value"));
@@ -1595,10 +1625,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* StringValue::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* StringValue::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.StringValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // string value = 1;
@@ -1623,7 +1653,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.StringValue)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1653,7 +1683,7 @@
 void StringValue::MergeFrom(const StringValue& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.StringValue)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (!from._internal_value().empty()) {
@@ -1710,6 +1740,9 @@
   : ::PROTOBUF_NAMESPACE_ID::Message() {
   _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
   value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+  #ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+    value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  #endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   if (!from._internal_value().empty()) {
     value_.Set(::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr::EmptyDefault{}, from._internal_value(), 
       GetArenaForAllocation());
@@ -1717,8 +1750,11 @@
   // @@protoc_insertion_point(copy_constructor:google.protobuf.BytesValue)
 }
 
-void BytesValue::SharedCtor() {
+inline void BytesValue::SharedCtor() {
 value_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
 }
 
 BytesValue::~BytesValue() {
@@ -1745,7 +1781,7 @@
 
 void BytesValue::Clear() {
 // @@protoc_insertion_point(message_clear_start:google.protobuf.BytesValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1756,12 +1792,12 @@
 const char* BytesValue::_InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) {
 #define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
   while (!ctx->Done(&ptr)) {
-    ::PROTOBUF_NAMESPACE_ID::uint32 tag;
+    uint32_t tag;
     ptr = ::PROTOBUF_NAMESPACE_ID::internal::ReadTag(ptr, &tag);
     switch (tag >> 3) {
       // bytes value = 1;
       case 1:
-        if (PROTOBUF_PREDICT_TRUE(static_cast<::PROTOBUF_NAMESPACE_ID::uint8>(tag) == 10)) {
+        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
           auto str = _internal_mutable_value();
           ptr = ::PROTOBUF_NAMESPACE_ID::internal::InlineGreedyStringParser(str, ptr, ctx);
           CHK_(ptr);
@@ -1791,10 +1827,10 @@
 #undef CHK_
 }
 
-::PROTOBUF_NAMESPACE_ID::uint8* BytesValue::_InternalSerialize(
-    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
+uint8_t* BytesValue::_InternalSerialize(
+    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
   // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.BytesValue)
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   // bytes value = 1;
@@ -1815,7 +1851,7 @@
 // @@protoc_insertion_point(message_byte_size_start:google.protobuf.BytesValue)
   size_t total_size = 0;
 
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   // Prevent compiler warnings about cached_has_bits being unused
   (void) cached_has_bits;
 
@@ -1845,7 +1881,7 @@
 void BytesValue::MergeFrom(const BytesValue& from) {
 // @@protoc_insertion_point(class_specific_merge_from_start:google.protobuf.BytesValue)
   GOOGLE_DCHECK_NE(&from, this);
-  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
+  uint32_t cached_has_bits = 0;
   (void) cached_has_bits;
 
   if (!from._internal_value().empty()) {
diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h
index 5794557..36e906c 100644
--- a/src/google/protobuf/wrappers.pb.h
+++ b/src/google/protobuf/wrappers.pb.h
@@ -8,12 +8,12 @@
 #include <string>
 
 #include <google/protobuf/port_def.inc>
-#if PROTOBUF_VERSION < 3018000
+#if PROTOBUF_VERSION < 3019000
 #error This file was generated by a newer version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please update
 #error your headers.
 #endif
-#if 3018001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3019004 < PROTOBUF_MIN_PROTOC_VERSION
 #error This file was generated by an older version of protoc which is
 #error incompatible with your Protocol Buffer headers. Please
 #error regenerate this file with a newer version of protoc.
@@ -50,7 +50,7 @@
     PROTOBUF_SECTION_VARIABLE(protodesc_cold);
   static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
   static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
-  static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
+  static const uint32_t offsets[];
 };
 PROTOBUF_EXPORT extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_google_2fprotobuf_2fwrappers_2eproto;
 PROTOBUF_NAMESPACE_OPEN
@@ -152,7 +152,12 @@
   }
   inline void Swap(DoubleValue* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -166,11 +171,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline DoubleValue* New() const final {
-    return new DoubleValue();
-  }
-
-  DoubleValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  DoubleValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<DoubleValue>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -185,8 +186,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -194,6 +195,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(DoubleValue* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.DoubleValue";
@@ -295,7 +298,12 @@
   }
   inline void Swap(FloatValue* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -309,11 +317,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline FloatValue* New() const final {
-    return new FloatValue();
-  }
-
-  FloatValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  FloatValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<FloatValue>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -328,8 +332,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -337,6 +341,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(FloatValue* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.FloatValue";
@@ -438,7 +444,12 @@
   }
   inline void Swap(Int64Value* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -452,11 +463,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Int64Value* New() const final {
-    return new Int64Value();
-  }
-
-  Int64Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Int64Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Int64Value>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -471,8 +478,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -480,6 +487,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Int64Value* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Int64Value";
@@ -506,11 +515,11 @@
   };
   // int64 value = 1;
   void clear_value();
-  ::PROTOBUF_NAMESPACE_ID::int64 value() const;
-  void set_value(::PROTOBUF_NAMESPACE_ID::int64 value);
+  int64_t value() const;
+  void set_value(int64_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int64 _internal_value() const;
-  void _internal_set_value(::PROTOBUF_NAMESPACE_ID::int64 value);
+  int64_t _internal_value() const;
+  void _internal_set_value(int64_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.Int64Value)
@@ -520,7 +529,7 @@
   template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
   typedef void InternalArenaConstructable_;
   typedef void DestructorSkippable_;
-  ::PROTOBUF_NAMESPACE_ID::int64 value_;
+  int64_t value_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
   friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto;
 };
@@ -581,7 +590,12 @@
   }
   inline void Swap(UInt64Value* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -595,11 +609,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline UInt64Value* New() const final {
-    return new UInt64Value();
-  }
-
-  UInt64Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  UInt64Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<UInt64Value>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -614,8 +624,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -623,6 +633,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(UInt64Value* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.UInt64Value";
@@ -649,11 +661,11 @@
   };
   // uint64 value = 1;
   void clear_value();
-  ::PROTOBUF_NAMESPACE_ID::uint64 value() const;
-  void set_value(::PROTOBUF_NAMESPACE_ID::uint64 value);
+  uint64_t value() const;
+  void set_value(uint64_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::uint64 _internal_value() const;
-  void _internal_set_value(::PROTOBUF_NAMESPACE_ID::uint64 value);
+  uint64_t _internal_value() const;
+  void _internal_set_value(uint64_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.UInt64Value)
@@ -663,7 +675,7 @@
   template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
   typedef void InternalArenaConstructable_;
   typedef void DestructorSkippable_;
-  ::PROTOBUF_NAMESPACE_ID::uint64 value_;
+  uint64_t value_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
   friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto;
 };
@@ -724,7 +736,12 @@
   }
   inline void Swap(Int32Value* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -738,11 +755,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline Int32Value* New() const final {
-    return new Int32Value();
-  }
-
-  Int32Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  Int32Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<Int32Value>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -757,8 +770,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -766,6 +779,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(Int32Value* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.Int32Value";
@@ -792,11 +807,11 @@
   };
   // int32 value = 1;
   void clear_value();
-  ::PROTOBUF_NAMESPACE_ID::int32 value() const;
-  void set_value(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t value() const;
+  void set_value(int32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::int32 _internal_value() const;
-  void _internal_set_value(::PROTOBUF_NAMESPACE_ID::int32 value);
+  int32_t _internal_value() const;
+  void _internal_set_value(int32_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.Int32Value)
@@ -806,7 +821,7 @@
   template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
   typedef void InternalArenaConstructable_;
   typedef void DestructorSkippable_;
-  ::PROTOBUF_NAMESPACE_ID::int32 value_;
+  int32_t value_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
   friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto;
 };
@@ -867,7 +882,12 @@
   }
   inline void Swap(UInt32Value* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -881,11 +901,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline UInt32Value* New() const final {
-    return new UInt32Value();
-  }
-
-  UInt32Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  UInt32Value* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<UInt32Value>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -900,8 +916,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -909,6 +925,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(UInt32Value* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.UInt32Value";
@@ -935,11 +953,11 @@
   };
   // uint32 value = 1;
   void clear_value();
-  ::PROTOBUF_NAMESPACE_ID::uint32 value() const;
-  void set_value(::PROTOBUF_NAMESPACE_ID::uint32 value);
+  uint32_t value() const;
+  void set_value(uint32_t value);
   private:
-  ::PROTOBUF_NAMESPACE_ID::uint32 _internal_value() const;
-  void _internal_set_value(::PROTOBUF_NAMESPACE_ID::uint32 value);
+  uint32_t _internal_value() const;
+  void _internal_set_value(uint32_t value);
   public:
 
   // @@protoc_insertion_point(class_scope:google.protobuf.UInt32Value)
@@ -949,7 +967,7 @@
   template <typename T> friend class ::PROTOBUF_NAMESPACE_ID::Arena::InternalHelper;
   typedef void InternalArenaConstructable_;
   typedef void DestructorSkippable_;
-  ::PROTOBUF_NAMESPACE_ID::uint32 value_;
+  uint32_t value_;
   mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
   friend struct ::TableStruct_google_2fprotobuf_2fwrappers_2eproto;
 };
@@ -1010,7 +1028,12 @@
   }
   inline void Swap(BoolValue* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1024,11 +1047,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline BoolValue* New() const final {
-    return new BoolValue();
-  }
-
-  BoolValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  BoolValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<BoolValue>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -1043,8 +1062,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -1052,6 +1071,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(BoolValue* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.BoolValue";
@@ -1153,7 +1174,12 @@
   }
   inline void Swap(StringValue* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1167,11 +1193,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline StringValue* New() const final {
-    return new StringValue();
-  }
-
-  StringValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  StringValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<StringValue>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -1186,8 +1208,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -1195,6 +1217,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(StringValue* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.StringValue";
@@ -1225,7 +1249,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_value(ArgT0&& arg0, ArgT... args);
   std::string* mutable_value();
-  PROTOBUF_MUST_USE_RESULT std::string* release_value();
+  PROTOBUF_NODISCARD std::string* release_value();
   void set_allocated_value(std::string* value);
   private:
   const std::string& _internal_value() const;
@@ -1301,7 +1325,12 @@
   }
   inline void Swap(BytesValue* other) {
     if (other == this) return;
+  #ifdef PROTOBUF_FORCE_COPY_IN_SWAP
+    if (GetOwningArena() != nullptr &&
+        GetOwningArena() == other->GetOwningArena()) {
+   #else  // PROTOBUF_FORCE_COPY_IN_SWAP
     if (GetOwningArena() == other->GetOwningArena()) {
+  #endif  // !PROTOBUF_FORCE_COPY_IN_SWAP
       InternalSwap(other);
     } else {
       ::PROTOBUF_NAMESPACE_ID::internal::GenericSwap(this, other);
@@ -1315,11 +1344,7 @@
 
   // implements Message ----------------------------------------------
 
-  inline BytesValue* New() const final {
-    return new BytesValue();
-  }
-
-  BytesValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
+  BytesValue* New(::PROTOBUF_NAMESPACE_ID::Arena* arena = nullptr) const final {
     return CreateMaybeMessage<BytesValue>(arena);
   }
   using ::PROTOBUF_NAMESPACE_ID::Message::CopyFrom;
@@ -1334,8 +1359,8 @@
 
   size_t ByteSizeLong() const final;
   const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
-  ::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
-      ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
+  uint8_t* _InternalSerialize(
+      uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
   int GetCachedSize() const final { return _cached_size_.Get(); }
 
   private:
@@ -1343,6 +1368,8 @@
   void SharedDtor();
   void SetCachedSize(int size) const final;
   void InternalSwap(BytesValue* other);
+
+  private:
   friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
   static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
     return "google.protobuf.BytesValue";
@@ -1373,7 +1400,7 @@
   template <typename ArgT0 = const std::string&, typename... ArgT>
   void set_value(ArgT0&& arg0, ArgT... args);
   std::string* mutable_value();
-  PROTOBUF_MUST_USE_RESULT std::string* release_value();
+  PROTOBUF_NODISCARD std::string* release_value();
   void set_allocated_value(std::string* value);
   private:
   const std::string& _internal_value() const;
@@ -1455,18 +1482,18 @@
 inline void Int64Value::clear_value() {
   value_ = int64_t{0};
 }
-inline ::PROTOBUF_NAMESPACE_ID::int64 Int64Value::_internal_value() const {
+inline int64_t Int64Value::_internal_value() const {
   return value_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int64 Int64Value::value() const {
+inline int64_t Int64Value::value() const {
   // @@protoc_insertion_point(field_get:google.protobuf.Int64Value.value)
   return _internal_value();
 }
-inline void Int64Value::_internal_set_value(::PROTOBUF_NAMESPACE_ID::int64 value) {
+inline void Int64Value::_internal_set_value(int64_t value) {
   
   value_ = value;
 }
-inline void Int64Value::set_value(::PROTOBUF_NAMESPACE_ID::int64 value) {
+inline void Int64Value::set_value(int64_t value) {
   _internal_set_value(value);
   // @@protoc_insertion_point(field_set:google.protobuf.Int64Value.value)
 }
@@ -1479,18 +1506,18 @@
 inline void UInt64Value::clear_value() {
   value_ = uint64_t{0u};
 }
-inline ::PROTOBUF_NAMESPACE_ID::uint64 UInt64Value::_internal_value() const {
+inline uint64_t UInt64Value::_internal_value() const {
   return value_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::uint64 UInt64Value::value() const {
+inline uint64_t UInt64Value::value() const {
   // @@protoc_insertion_point(field_get:google.protobuf.UInt64Value.value)
   return _internal_value();
 }
-inline void UInt64Value::_internal_set_value(::PROTOBUF_NAMESPACE_ID::uint64 value) {
+inline void UInt64Value::_internal_set_value(uint64_t value) {
   
   value_ = value;
 }
-inline void UInt64Value::set_value(::PROTOBUF_NAMESPACE_ID::uint64 value) {
+inline void UInt64Value::set_value(uint64_t value) {
   _internal_set_value(value);
   // @@protoc_insertion_point(field_set:google.protobuf.UInt64Value.value)
 }
@@ -1503,18 +1530,18 @@
 inline void Int32Value::clear_value() {
   value_ = 0;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Int32Value::_internal_value() const {
+inline int32_t Int32Value::_internal_value() const {
   return value_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::int32 Int32Value::value() const {
+inline int32_t Int32Value::value() const {
   // @@protoc_insertion_point(field_get:google.protobuf.Int32Value.value)
   return _internal_value();
 }
-inline void Int32Value::_internal_set_value(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Int32Value::_internal_set_value(int32_t value) {
   
   value_ = value;
 }
-inline void Int32Value::set_value(::PROTOBUF_NAMESPACE_ID::int32 value) {
+inline void Int32Value::set_value(int32_t value) {
   _internal_set_value(value);
   // @@protoc_insertion_point(field_set:google.protobuf.Int32Value.value)
 }
@@ -1527,18 +1554,18 @@
 inline void UInt32Value::clear_value() {
   value_ = 0u;
 }
-inline ::PROTOBUF_NAMESPACE_ID::uint32 UInt32Value::_internal_value() const {
+inline uint32_t UInt32Value::_internal_value() const {
   return value_;
 }
-inline ::PROTOBUF_NAMESPACE_ID::uint32 UInt32Value::value() const {
+inline uint32_t UInt32Value::value() const {
   // @@protoc_insertion_point(field_get:google.protobuf.UInt32Value.value)
   return _internal_value();
 }
-inline void UInt32Value::_internal_set_value(::PROTOBUF_NAMESPACE_ID::uint32 value) {
+inline void UInt32Value::_internal_set_value(uint32_t value) {
   
   value_ = value;
 }
-inline void UInt32Value::set_value(::PROTOBUF_NAMESPACE_ID::uint32 value) {
+inline void UInt32Value::set_value(uint32_t value) {
   _internal_set_value(value);
   // @@protoc_insertion_point(field_set:google.protobuf.UInt32Value.value)
 }
@@ -1614,6 +1641,11 @@
   }
   value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.StringValue.value)
 }
 
@@ -1664,6 +1696,11 @@
   }
   value_.SetAllocated(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value,
       GetArenaForAllocation());
+#ifdef PROTOBUF_FORCE_COPY_DEFAULT_STRING
+  if (value_.IsDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited())) {
+    value_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), "", GetArenaForAllocation());
+  }
+#endif // PROTOBUF_FORCE_COPY_DEFAULT_STRING
   // @@protoc_insertion_point(field_set_allocated:google.protobuf.BytesValue.value)
 }
 
diff --git a/tests.sh b/tests.sh
index 71635f9..176bc5f 100755
--- a/tests.sh
+++ b/tests.sh
@@ -214,13 +214,20 @@
 # --batch-mode suppresses download progress output that spams the logs.
 MVN="mvn --batch-mode"
 
-build_java() {
+internal_build_java() {
   version=$1
   dir=java_$version
   # Java build needs `protoc`.
   internal_build_cpp
   cp -r java $dir
   cd $dir && $MVN clean
+  # Skip tests here - callers will decide what tests they want to run
+  $MVN install -pl core -Dmaven.test.skip=true
+}
+
+build_java() {
+  version=$1
+  internal_build_java $version
   # Skip the Kotlin tests on Oracle 7
   if [ "$version" == "oracle7" ]; then
     $MVN test -pl bom,lite,core,util
@@ -368,6 +375,10 @@
   build_python_version py39-python
 }
 
+build_python310() {
+  build_python_version py310-python
+}
+
 build_python_cpp() {
   internal_build_cpp
   export LD_LIBRARY_PATH=../src/.libs # for Linux
@@ -420,6 +431,11 @@
   build_python_cpp_version py39-cpp
 }
 
+build_python310_cpp() {
+  build_python_cpp_version py310-cpp
+}
+
+
 build_ruby23() {
   internal_build_cpp  # For conformance tests.
   cd ruby && bash travis-test.sh ruby-2.3.8 && cd ..
@@ -445,9 +461,16 @@
   cd ruby && bash travis-test.sh ruby-3.0.2 && cd ..
 }
 
-build_jruby() {
-  internal_build_cpp  # For conformance tests.
-  cd ruby && bash travis-test.sh jruby-9.2.11.1 && cd ..
+build_jruby92() {
+  internal_build_cpp                # For conformance tests.
+  internal_build_java jdk8 && cd .. # For Maven protobuf jar with local changes
+  cd ruby && bash travis-test.sh jruby-9.2.19.0 && cd ..
+}
+
+build_jruby93() {
+  internal_build_cpp                # For conformance tests.
+  internal_build_java jdk8 && cd .. # For Maven protobuf jar with local changes
+  cd ruby && bash travis-test.sh jruby-9.3.0.0 && cd ..
 }
 
 build_javascript() {
@@ -602,7 +625,8 @@
             ruby26 |
             ruby27 |
             ruby30 |
-            jruby |
+            jruby92 |
+            jruby93 |
             ruby_all |
             php_all |
             php_all_32 |
diff --git a/third_party/BUILD b/third_party/BUILD
index b66101a..a8b35ef 100644
--- a/third_party/BUILD
+++ b/third_party/BUILD
@@ -1 +1 @@
-exports_files(["six.BUILD", "zlib.BUILD"])
+exports_files(["zlib.BUILD"])
diff --git a/third_party/six.BUILD b/third_party/six.BUILD
deleted file mode 100644
index 041c72c..0000000
--- a/third_party/six.BUILD
+++ /dev/null
@@ -1,19 +0,0 @@
-load("@rules_python//python:defs.bzl", "py_library")
-
-# Consume `six.py` as `__init__.py` for compatibility
-# with `--incompatible_default_to_explicit_init_py`.
-# https://github.com/protocolbuffers/protobuf/pull/6795#issuecomment-546060749
-# https://github.com/bazelbuild/bazel/issues/10076
-genrule(
-    name = "copy_six",
-    srcs = ["six-1.12.0/six.py"],
-    outs = ["__init__.py"],
-    cmd = "cp $< $(@)",
-)
-
-py_library(
-    name = "six",
-    srcs = ["__init__.py"],
-    srcs_version = "PY2AND3",
-    visibility = ["//visibility:public"],
-)
diff --git a/toolchain/BUILD b/toolchain/BUILD
new file mode 100644
index 0000000..f5c3853
--- /dev/null
+++ b/toolchain/BUILD
@@ -0,0 +1,84 @@
+load(":cc_toolchain_config.bzl", "cc_toolchain_config")
+
+package(default_visibility = ["//visibility:public"])
+
+filegroup(name = "empty")
+
+LINUX_TOOLCHAINS = {
+    "linux-aarch_64": "cc-compiler-linux-aarch_64",
+    "linux-ppcle_64": "cc-compiler-linux-ppcle_64",
+    "linux-s390_64": "cc-compiler-linux-s390_64",
+    "linux-x86_32": "cc-compiler-linux-x86_32",
+    "linux-x86_64": "cc-compiler-linux-x86_64",
+}
+
+cc_toolchain_suite(
+    name = "clang_suite",
+    toolchains = LINUX_TOOLCHAINS
+)
+
+[
+    cc_toolchain(
+        name = toolchain,
+        all_files = ":empty",
+        compiler_files = ":empty",
+        dwp_files = ":empty",
+        dynamic_runtime_lib = ":empty",
+        linker_files = ":empty",
+        objcopy_files = ":empty",
+        output_licenses = ["restricted"],
+        static_runtime_lib = ":empty",
+        strip_files = ":empty",
+        toolchain_config = ":" + cpu + "-config",
+        toolchain_identifier = toolchain,
+    )
+    for cpu, toolchain in LINUX_TOOLCHAINS.items()
+]
+
+cc_toolchain_config(
+    name = "linux-aarch_64-config",
+    bit_flag = "-m64",
+    include_flag = "-I/usr/aarch64-linux-gnu/include/c++/8/aarch64-linux-gnu/",
+    target_cpu = "aarch64",
+    target_full_name = "aarch64-linux-gnu",
+    toolchain_dir = "/usr/aarch64-linux-gnu/include",
+    toolchain_name = "linux_aarch_64",
+)
+
+cc_toolchain_config(
+    name = "linux-ppcle_64-config",
+    bit_flag = "-m64",
+    include_flag = "-I/usr/powerpc64le-linux-gnu/include/c++/8/powerpc64le-linux-gnu/",
+    target_cpu = "ppc64",
+    target_full_name = "powerpc64le-linux-gnu",
+    toolchain_dir = "/usr/powerpc64le-linux-gnu/include",
+    toolchain_name = "linux_ppcle_64",
+)
+
+cc_toolchain_config(
+    name = "linux-s390_64-config",
+    bit_flag = "-m64",
+    include_flag = "-I/usr/s390x-linux-gnu/include/c++/8/s390x-linux-gnu/",
+    target_cpu = "systemz",
+    target_full_name = "s390x-linux-gnu",
+    toolchain_dir = "/usr/s390x-linux-gnu/include",
+    toolchain_name = "linux_s390_64",
+)
+
+cc_toolchain_config(
+    name = "linux-x86_32-config",
+    bit_flag = "-m32",
+    target_cpu = "x86_32",
+    target_full_name = "i386-linux-gnu",
+    toolchain_dir = "/usr/include/i386-linux-gnu",
+    toolchain_name = "linux_x86_32",
+)
+
+cc_toolchain_config(
+    name = "linux-x86_64-config",
+    bit_flag = "-m64",
+    target_cpu = "x86_64",
+    target_full_name = "x86_64-linux-gnu",
+    toolchain_dir = "/usr/include/x86_64-linux-gnu",
+    toolchain_name = "linux_x86_64",
+)
diff --git a/toolchain/cc_toolchain_config.bzl b/toolchain/cc_toolchain_config.bzl
new file mode 100644
index 0000000..4478a11
--- /dev/null
+++ b/toolchain/cc_toolchain_config.bzl
@@ -0,0 +1,148 @@
+load("@bazel_tools//tools/build_defs/cc:action_names.bzl", "ACTION_NAMES")
+load(
+    "@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl",
+    "feature",
+    "flag_group",
+    "flag_set",
+    "tool",
+    "tool_path",
+)
+
+all_link_actions = [
+    ACTION_NAMES.cpp_link_executable,
+    ACTION_NAMES.cpp_link_dynamic_library,
+    ACTION_NAMES.cpp_link_nodeps_dynamic_library,
+]
+
+all_compile_actions = [
+    ACTION_NAMES.assemble,
+    ACTION_NAMES.preprocess_assemble,
+    ACTION_NAMES.linkstamp_compile,
+    ACTION_NAMES.c_compile,
+    ACTION_NAMES.cpp_compile,
+    ACTION_NAMES.cpp_header_parsing,
+    ACTION_NAMES.cpp_module_codegen,
+    ACTION_NAMES.cpp_module_compile,
+    ACTION_NAMES.clif_match,
+    ACTION_NAMES.lto_backend,
+]
+
+def _impl(ctx):
+  tool_paths = [
+      tool_path(
+          name = "gcc",
+          path = "/usr/local/bin/clang",
+      ),
+      tool_path(
+          name = "ld",
+          path = "/usr/bin/ld",
+      ),
+      tool_path(
+          name = "ar",
+          path = "/usr/bin/ar",
+      ),
+      tool_path(
+          name = "compat-ld",
+          path = "/usr/bin/ld",
+      ),
+      tool_path(
+          name = "cpp",
+          path = "/bin/false",
+      ),
+      tool_path(
+          name = "dwp",
+          path = "/bin/false",
+      ),
+      tool_path(
+          name = "gcov",
+          path = "/bin/false",
+      ),
+      tool_path(
+          name = "nm",
+          path = "/bin/false",
+      ),
+      tool_path(
+          name = "objcopy",
+          path = "/bin/false",
+      ),
+      tool_path(
+          name = "objdump",
+          path = "/bin/false",
+      ),
+      tool_path(
+          name = "strip",
+          path = "/bin/false",
+      ),
+  ]
+
+  linker_flags = feature(
+      name = "default_linker_flags",
+      enabled = True,
+      flag_sets = [
+          flag_set(
+              actions = all_link_actions,
+              flag_groups = [
+                  flag_group(
+                      flags = [
+                          "-lstdc++",
+                          "--target=" + ctx.attr.target_full_name,
+                      ],
+                  ),
+              ],
+          ),
+      ],
+  )
+  compiler_flags = feature(
+      name = "default_compile_flags",
+      enabled = True,
+      flag_sets = [
+          flag_set(
+              actions = all_compile_actions,
+              flag_groups = [
+                  flag_group(
+                      flags = [
+                          ctx.attr.bit_flag,
+                          "-Wall",
+                          "-no-canonical-prefixes",
+                          "--target=" + ctx.attr.target_full_name,
+                          "-isystem",
+                          ctx.attr.toolchain_dir,
+                          ctx.attr.include_flag,
+                      ],
+                  ),
+              ],
+          ),
+      ],
+  )
+
+  return cc_common.create_cc_toolchain_config_info(
+      abi_libc_version = ctx.attr.target_cpu,
+      abi_version = ctx.attr.target_cpu,
+      ctx = ctx,
+      compiler = "clang",
+      cxx_builtin_include_directories = [
+          ctx.attr.toolchain_dir,
+          "/usr/include",
+          "/usr/local/lib/clang",
+      ],
+      features = [linker_flags, compiler_flags],
+      host_system_name = "local",
+      target_cpu = ctx.attr.target_cpu,
+      target_libc = ctx.attr.target_cpu,
+      target_system_name = ctx.attr.target_full_name,
+      toolchain_identifier = ctx.attr.toolchain_name,
+      tool_paths = tool_paths,
+  )
+
+cc_toolchain_config = rule(
+    implementation = _impl,
+    attrs = {
+        "bit_flag": attr.string(mandatory = True, values = ["-m32", "-m64"]),
+        "include_flag": attr.string(mandatory = False),
+        "target_cpu": attr.string(mandatory = True, values = ["aarch64", "ppc64", "systemz", "x86_32", "x86_64"]),
+        "target_full_name": attr.string(mandatory = True),
+        "toolchain_dir": attr.string(mandatory = True),
+        "toolchain_name": attr.string(mandatory = True),
+    },
+    provides = [CcToolchainConfigInfo],
+)
diff --git a/toolchain/toolchains.bazelrc b/toolchain/toolchains.bazelrc
new file mode 100644
index 0000000..f56e4ce
--- /dev/null
+++ b/toolchain/toolchains.bazelrc
@@ -0,0 +1,8 @@
+build:cross_config --crosstool_top=//toolchain:clang_suite
+build:cross_config --host_crosstool_top=@bazel_tools//tools/cpp:toolchain
+
+build:linux-aarch_64 --config=cross_config --cpu=linux-aarch_64
+build:linux-ppcle_64 --config=cross_config --cpu=linux-ppcle_64
+build:linux-s390_64 --config=cross_config --cpu=linux-s390_64
+build:linux-x86_32 --config=cross_config --cpu=linux-x86_32
+build:linux-x86_64 --config=cross_config --cpu=linux-x86_64
diff --git a/update_file_lists.sh b/update_file_lists.sh
index e0b446f..1ec1195 100755
--- a/update_file_lists.sh
+++ b/update_file_lists.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/bash -u
 
 # This script copies source file lists from src/Makefile.am to cmake files.
 
@@ -50,12 +50,12 @@
 
 # Extract file lists from src/Makefile.am
 GZHEADERS=$(get_variable_value $MAKEFILE GZHEADERS)
-HEADERS=$(get_variable_value $MAKEFILE nobase_include_HEADERS)
-PUBLIC_HEADERS=$(sort_files $GZHEADERS $HEADERS)
+LIBPROTOBUF_HEADERS=$(get_variable_value $MAKEFILE nobase_include_HEADERS | grep -v /compiler/)
+LIBPROTOBUF_HEADERS=$(sort_files $GZHEADERS $LIBPROTOBUF_HEADERS)
 LIBPROTOBUF_LITE_SOURCES=$(get_source_files $MAKEFILE libprotobuf_lite_la_SOURCES)
 LIBPROTOBUF_SOURCES=$(get_source_files $MAKEFILE libprotobuf_la_SOURCES)
 LIBPROTOC_SOURCES=$(get_source_files $MAKEFILE libprotoc_la_SOURCES)
-LIBPROTOC_HEADERS=$(get_header_files $MAKEFILE libprotoc_la_SOURCES)
+LIBPROTOC_HEADERS=$(get_variable_value $MAKEFILE nobase_include_HEADERS | grep /compiler/)
 LITE_PROTOS=$(get_proto_files $MAKEFILE protoc_lite_outputs)
 PROTOS=$(get_proto_files $MAKEFILE protoc_outputs)
 PROTOS_BLACKLISTED=$(get_proto_files_blacklisted $MAKEFILE protoc_outputs)
@@ -98,7 +98,11 @@
       print \$0;
       len = split(values, vlist, \" \");
       for (i = 1; i <= len; ++i) {
-        printf(\"  %s%s\\n\", prefix, vlist[i]);
+        printf(\"  \");
+        if (vlist[i] !~ /^\\\$/) {
+          printf(\"%s\", prefix);
+        }
+        printf(\"%s\\n\", vlist[i]);
       }
       next;
     }
@@ -121,7 +125,7 @@
 set_cmake_value $CMAKE_DIR/libprotoc.cmake libprotoc_headers $CMAKE_PREFIX $LIBPROTOC_HEADERS
 set_cmake_value $CMAKE_DIR/tests.cmake lite_test_protos "" $LITE_PROTOS
 set_cmake_value $CMAKE_DIR/tests.cmake tests_protos "" $PROTOS_BLACKLISTED
-set_cmake_value $CMAKE_DIR/tests.cmake common_test_files $CMAKE_PREFIX $COMMON_TEST_SOURCES
+set_cmake_value $CMAKE_DIR/tests.cmake common_test_files $CMAKE_PREFIX '${common_lite_test_files}' $COMMON_TEST_SOURCES
 set_cmake_value $CMAKE_DIR/tests.cmake common_lite_test_files $CMAKE_PREFIX $COMMON_LITE_TEST_SOURCES
 set_cmake_value $CMAKE_DIR/tests.cmake tests_files $CMAKE_PREFIX $TEST_SOURCES
 set_cmake_value $CMAKE_DIR/tests.cmake non_msvc_tests_files $CMAKE_PREFIX $NON_MSVC_TEST_SOURCES
@@ -130,14 +134,14 @@
 
 # Generate extract_includes.bat
 echo "mkdir include" > $EXTRACT_INCLUDES_BAT
-for INCLUDE in $PUBLIC_HEADERS $WKT_PROTOS; do
+for INCLUDE in $LIBPROTOBUF_HEADERS $LIBPROTOC_HEADERS $WKT_PROTOS; do
   INCLUDE_DIR=$(dirname "$INCLUDE")
   while [ ! "$INCLUDE_DIR" = "." ]; do
     echo "mkdir include\\${INCLUDE_DIR//\//\\}"
     INCLUDE_DIR=$(dirname "$INCLUDE_DIR")
   done
 done | sort | uniq >> $EXTRACT_INCLUDES_BAT
-for INCLUDE in $PUBLIC_HEADERS $WKT_PROTOS; do
+for INCLUDE in $(sort_files $LIBPROTOBUF_HEADERS $LIBPROTOC_HEADERS) $WKT_PROTOS; do
   WINPATH=${INCLUDE//\//\\}
   echo "copy \"\${PROTOBUF_SOURCE_WIN32_PATH}\\..\\src\\$WINPATH\" include\\$WINPATH" >> $EXTRACT_INCLUDES_BAT
 done
@@ -186,7 +190,7 @@
   set_bazel_value $BAZEL_BUILD lite_test_protos "" $LITE_PROTOS
   set_bazel_value $BAZEL_BUILD well_known_protos "" $WKT_PROTOS
   set_bazel_value $BAZEL_BUILD test_protos "" $PROTOS
-  set_bazel_value $BAZEL_BUILD common_test_srcs $BAZEL_PREFIX $COMMON_TEST_SOURCES
+  set_bazel_value $BAZEL_BUILD common_test_srcs $BAZEL_PREFIX $COMMON_LITE_TEST_SOURCES $COMMON_TEST_SOURCES
   set_bazel_value $BAZEL_BUILD test_srcs $BAZEL_PREFIX $TEST_SOURCES
   set_bazel_value $BAZEL_BUILD non_msvc_test_srcs $BAZEL_PREFIX $NON_MSVC_TEST_SOURCES
   set_bazel_value $BAZEL_BUILD test_plugin_srcs $BAZEL_PREFIX $TEST_PLUGIN_SOURCES
diff --git a/update_version.py b/update_version.py
index 9cf1dbf..2c2b489 100755
--- a/update_version.py
+++ b/update_version.py
@@ -241,6 +241,24 @@
   RewriteXml('protoc-artifacts/pom.xml',
     lambda document : ReplaceText(
       Find(document.documentElement, 'version'), GetFullVersion()))
+  
+  RewriteTextFile('java/README.md',
+    lambda line : re.sub(
+      r'<version>.*</version>',
+      '<version>%s</version>' % GetFullVersion(),
+      line))
+
+  RewriteTextFile('java/README.md',
+    lambda line : re.sub(
+      r'implementation \'com.google.protobuf:protobuf-java:.*\'',
+      'implementation \'com.google.protobuf:protobuf-java:%s\'' % GetFullVersion(),
+      line))
+
+  RewriteTextFile('java/lite.md',
+    lambda line : re.sub(
+      r'<version>.*</version>',
+      '<version>%s</version>' % GetFullVersion(),
+      line))
 
 
 def UpdateJavaScript():
@@ -358,6 +376,13 @@
       line))
 
 def UpdateRuby():
+  RewriteXml('ruby/pom.xml',
+             lambda document : ReplaceText(
+                 Find(document.documentElement, 'version'), GetFullVersion()))
+  RewriteXml('ruby/pom.xml',
+             lambda document : ReplaceText(
+                 Find(Find(Find(document.documentElement, 'dependencies'), 'dependency'), 'version'),
+                 GetFullVersion()))
   RewriteTextFile('ruby/google-protobuf.gemspec',
     lambda line : re.sub(
       r'^  s.version     = ".*"$',