From bb5094881c6a496a458cb5d1c939ac4d0e822964 Mon Sep 17 00:00:00 2001 From: Jie Luo Date: Thu, 16 Dec 2021 21:38:42 -0800 Subject: [PATCH 01/12] Update python 3.10 install MD5 Sum (#9322) https://www.python.org/downloads/release/python-3100/ --- kokoro/release/python/windows/install_python_interpreters.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kokoro/release/python/windows/install_python_interpreters.ps1 b/kokoro/release/python/windows/install_python_interpreters.ps1 index f193eedeb0..e541fc2cf1 100644 --- a/kokoro/release/python/windows/install_python_interpreters.ps1 +++ b/kokoro/release/python/windows/install_python_interpreters.ps1 @@ -101,7 +101,7 @@ $Python39x86Config = @{ PythonVersion = "3.10.0" PythonInstaller = "python-3.10.0" PythonInstallPath = "C:\python310_32bit" - PythonInstallerHash = "6de353f2f7422aa030d4ccc788ffa75e" + PythonInstallerHash = "133aa48145032e341ad2a000cd3bff50" } Install-Python @Python310x86Config @@ -109,6 +109,6 @@ $Python39x64Config = @{ PythonVersion = "3.10.0" PythonInstaller = "python-3.10.0-amd64" PythonInstallPath = "C:\python310" - PythonInstallerHash = "39135519b044757f0a3b09d63612b0da" + PythonInstallerHash = "c3917c08a7fe85db7203da6dcaa99a70" } Install-Python @Python310x64Config From cb1f49ae73cf26dd61368f8bd1297e11c62a5f03 Mon Sep 17 00:00:00 2001 From: Jie Luo Date: Fri, 17 Dec 2021 10:50:45 -0800 Subject: [PATCH 02/12] Cherry-pick Python 3.10 fix to 3.19.x (#9323) --- kokoro/release/python/windows/install_python_interpreters.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kokoro/release/python/windows/install_python_interpreters.ps1 b/kokoro/release/python/windows/install_python_interpreters.ps1 index e541fc2cf1..3f8db95b7a 100644 --- a/kokoro/release/python/windows/install_python_interpreters.ps1 +++ b/kokoro/release/python/windows/install_python_interpreters.ps1 @@ -97,7 +97,7 @@ $Python39x64Config = @{ Install-Python @Python39x64Config # Python 3.10 -$Python39x86Config = @{ +$Python310x86Config = @{ PythonVersion = "3.10.0" PythonInstaller = "python-3.10.0" PythonInstallPath = "C:\python310_32bit" @@ -105,7 +105,7 @@ $Python39x86Config = @{ } Install-Python @Python310x86Config -$Python39x64Config = @{ +$Python310x64Config = @{ PythonVersion = "3.10.0" PythonInstaller = "python-3.10.0-amd64" PythonInstallPath = "C:\python310" From 1fe07f9ce2e98ca66a403b989d78a060f3153d5b Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Wed, 22 Dec 2021 15:01:34 -0800 Subject: [PATCH 03/12] Cherry-pick fix from #9311 into 3.18.x (#9320) * Dropped Ruby 2.4 support for CI and releases. * Removed Kokoro configs for old Ruby versions. * Update Dockerfile to allow it to be rebuilt Co-authored-by: Joshua Haberman --- kokoro/linux/dockerfile/test/ruby/Dockerfile | 6 ++---- kokoro/linux/ruby23/build.sh | 18 ------------------ kokoro/linux/ruby23/continuous.cfg | 11 ----------- kokoro/linux/ruby23/presubmit.cfg | 11 ----------- kokoro/linux/ruby24/build.sh | 18 ------------------ kokoro/linux/ruby24/continuous.cfg | 11 ----------- kokoro/linux/ruby24/presubmit.cfg | 11 ----------- kokoro/macos/ruby23/build.sh | 12 ------------ kokoro/macos/ruby23/continuous.cfg | 5 ----- kokoro/macos/ruby23/presubmit.cfg | 5 ----- kokoro/macos/ruby24/build.sh | 12 ------------ kokoro/macos/ruby24/continuous.cfg | 5 ----- kokoro/macos/ruby24/presubmit.cfg | 5 ----- .../ruby/macos/ruby/ruby_build_environment.sh | 2 +- ruby/Gemfile | 2 -- ruby/Rakefile | 4 ++-- 16 files changed, 5 insertions(+), 133 deletions(-) delete mode 100755 kokoro/linux/ruby23/build.sh delete mode 100644 kokoro/linux/ruby23/continuous.cfg delete mode 100644 kokoro/linux/ruby23/presubmit.cfg delete mode 100755 kokoro/linux/ruby24/build.sh delete mode 100644 kokoro/linux/ruby24/continuous.cfg delete mode 100644 kokoro/linux/ruby24/presubmit.cfg delete mode 100755 kokoro/macos/ruby23/build.sh delete mode 100644 kokoro/macos/ruby23/continuous.cfg delete mode 100644 kokoro/macos/ruby23/presubmit.cfg delete mode 100755 kokoro/macos/ruby24/build.sh delete mode 100644 kokoro/macos/ruby24/continuous.cfg delete mode 100644 kokoro/macos/ruby24/presubmit.cfg diff --git a/kokoro/linux/dockerfile/test/ruby/Dockerfile b/kokoro/linux/dockerfile/test/ruby/Dockerfile index b73bf84095..e8a70d5fee 100644 --- a/kokoro/linux/dockerfile/test/ruby/Dockerfile +++ b/kokoro/linux/dockerfile/test/ruby/Dockerfile @@ -23,13 +23,11 @@ RUN apt-get update && apt-get install -y \ && 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" diff --git a/kokoro/linux/ruby23/build.sh b/kokoro/linux/ruby23/build.sh deleted file mode 100755 index 503a320de2..0000000000 --- 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 f5c64988bf..0000000000 --- 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 f5c64988bf..0000000000 --- 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/build.sh b/kokoro/linux/ruby24/build.sh deleted file mode 100755 index 68585aabc0..0000000000 --- a/kokoro/linux/ruby24/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="ruby24" -./kokoro/linux/build_and_run_docker.sh diff --git a/kokoro/linux/ruby24/continuous.cfg b/kokoro/linux/ruby24/continuous.cfg deleted file mode 100644 index a1ccfc0b8b..0000000000 --- a/kokoro/linux/ruby24/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/ruby24/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 a1ccfc0b8b..0000000000 --- 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/ruby23/build.sh b/kokoro/macos/ruby23/build.sh deleted file mode 100755 index 5a29a997fc..0000000000 --- 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 c9b1f61284..0000000000 --- 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 c9b1f61284..0000000000 --- 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 10ac85f7a4..0000000000 --- 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 fada028fc5..0000000000 --- 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 fada028fc5..0000000000 --- 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/ruby/macos/ruby/ruby_build_environment.sh b/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh index 046b604b40..8d9308d57d 100755 --- a/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh +++ b/kokoro/release/ruby/macos/ruby/ruby_build_environment.sh @@ -66,7 +66,7 @@ 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" done diff --git a/ruby/Gemfile b/ruby/Gemfile index 76b23ad91d..fa75df1563 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 c7187a6a89..5e788c7810 100644 --- a/ruby/Rakefile +++ b/ruby/Rakefile @@ -100,7 +100,7 @@ else ['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,7 +108,7 @@ else 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'] From 0e02f95b876c40ecb04a76e729dd3f0d9185431e Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Wed, 5 Jan 2022 08:26:20 -0800 Subject: [PATCH 04/12] Fix Ruby release build by pinning rake-compiler-dock version (#9372) Our Ruby release build broke at some point in the past day or so, and I strongly suspect it is due to a new version (1.2.0) of rake-compiler-dock. This commit pins the version to 1.1.0 as a temporary fix. --- ruby/google-protobuf.gemspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index 7e2dd14aae..810c6fff88 100644 --- a/ruby/google-protobuf.gemspec +++ b/ruby/google-protobuf.gemspec @@ -17,7 +17,7 @@ Gem::Specification.new do |s| 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", From 9638a5e5315bf73f5e7148c16181676372321892 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Wed, 5 Jan 2022 08:50:29 -0800 Subject: [PATCH 05/12] Improve performance of parsing unknown fields in Java (#9371) Credit should go to @elharo for most of these Java changes--I am just cherry-picking them from our internal codebase. The one thing I did change was to give the UTF-8 validation tests their own Bazel test target. This makes it possible to give the other tests a shorter timeout, which is important for UnknownFieldSetPerformanceTest in particular. --- Makefile.am | 1 + java/core/BUILD | 24 +- .../com/google/protobuf/UnknownFieldSet.java | 427 +++++++++--------- .../UnknownFieldSetPerformanceTest.java | 78 ++++ .../google/protobuf/UnknownFieldSetTest.java | 182 +++++++- java/lite/pom.xml | 1 + 6 files changed, 499 insertions(+), 214 deletions(-) create mode 100644 java/core/src/test/java/com/google/protobuf/UnknownFieldSetPerformanceTest.java diff --git a/Makefile.am b/Makefile.am index 178c124b5e..41d4061a98 100644 --- a/Makefile.am +++ b/Makefile.am @@ -493,6 +493,7 @@ java_EXTRA_DIST= 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 \ diff --git a/java/core/BUILD b/java/core/BUILD index 1a37b4e820..419eafb58a 100644 --- a/java/core/BUILD +++ b/java/core/BUILD @@ -224,6 +224,7 @@ test_suite( "conformance_test", "core_build_test", "core_tests", + "utf8_tests", ], ) @@ -243,10 +244,12 @@ conformance_test( junit_tests( name = "core_tests", - size = "large", + 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", ], @@ -264,6 +267,24 @@ junit_tests( ], ) +# 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( name = "generic_test_protos_java_proto_lite", visibility = [ @@ -346,6 +367,7 @@ LITE_TEST_EXCLUSIONS = [ "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", 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 ba2f9df08e..5c482d62da 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.Map; 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. * *

Every {@link Message} contains an {@code UnknownFieldSet} (and every {@link Message.Builder} - * contains an {@link Builder}). + * contains a {@link Builder}). * *

Most users will never need to use this class. * @@ -57,9 +57,13 @@ import java.util.TreeMap; */ public final class UnknownFieldSet implements MessageLite { - private UnknownFieldSet() { - fields = null; - fieldsDescending = null; + private final TreeMap fields; + + /** + * Construct an {@code UnknownFieldSet} around the given map. + */ + UnknownFieldSet(TreeMap fields) { + this.fields = fields; } /** Create a new {@link Builder}. */ @@ -68,7 +72,7 @@ public final class UnknownFieldSet implements MessageLite { } /** 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 @@ public final class UnknownFieldSet implements MessageLite { } private static final UnknownFieldSet defaultInstance = - new UnknownFieldSet( - Collections.emptyMap(), Collections.emptyMap()); - - /** - * Construct an {@code UnknownFieldSet} around the given map. The map is expected to be immutable. - */ - UnknownFieldSet(final Map fields, final Map fieldsDescending) { - this.fields = fields; - this.fieldsDescending = fieldsDescending; - } - - private final Map fields; - - /** A copy of {@link #fields} who's iterator order is reversed. */ - private final Map fieldsDescending; + new UnknownFieldSet(new TreeMap()); @Override - public boolean equals(final Object other) { + public boolean equals(Object other) { if (this == other) { return true; } @@ -110,29 +100,33 @@ public final class UnknownFieldSet implements MessageLite { @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 asMap() { - return fields; + return (Map) 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 entry : fields.entrySet()) { + public void writeTo(CodedOutputStream output) throws IOException { + for (Map.Entry entry : fields.entrySet()) { Field field = entry.getValue(); field.writeTo(entry.getKey(), output); } @@ -154,10 +148,10 @@ public final class UnknownFieldSet implements MessageLite { @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 @@ public final class UnknownFieldSet implements MessageLite { @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 @@ public final class UnknownFieldSet implements MessageLite { * {@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 @@ public final class UnknownFieldSet implements MessageLite { @Override public int getSerializedSize() { int result = 0; - for (final Map.Entry entry : fields.entrySet()) { - result += entry.getValue().getSerializedSize(entry.getKey()); + if (!fields.isEmpty()) { + for (Map.Entry 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 entry : fields.entrySet()) { + public void writeAsMessageSetTo(CodedOutputStream output) throws IOException { + for (Map.Entry entry : fields.entrySet()) { entry.getValue().writeAsMessageSetExtensionTo(entry.getKey(), output); } } @@ -221,7 +217,7 @@ public final class UnknownFieldSet implements MessageLite { void writeTo(Writer writer) throws IOException { if (writer.fieldOrder() == Writer.FieldOrder.DESCENDING) { // Write fields in descending order. - for (Map.Entry entry : fieldsDescending.entrySet()) { + for (Map.Entry entry : fields.descendingMap().entrySet()) { entry.getValue().writeTo(entry.getKey(), writer); } } else { @@ -233,15 +229,15 @@ public final class UnknownFieldSet implements MessageLite { } /** 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 entry : fieldsDescending.entrySet()) { + for (Map.Entry entry : fields.descendingMap().entrySet()) { entry.getValue().writeAsMessageSetExtensionTo(entry.getKey(), writer); } } else { // Write fields in ascending order. - for (final Map.Entry entry : fields.entrySet()) { + for (Map.Entry entry : fields.entrySet()) { entry.getValue().writeAsMessageSetExtensionTo(entry.getKey(), writer); } } @@ -250,7 +246,7 @@ public final class UnknownFieldSet implements MessageLite { /** 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 entry : fields.entrySet()) { + for (Map.Entry entry : fields.entrySet()) { result += entry.getValue().getSerializedSizeAsMessageSetExtension(entry.getKey()); } return result; @@ -264,23 +260,23 @@ public final class UnknownFieldSet implements MessageLite { } /** 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 @@ public final class UnknownFieldSet implements MessageLite { // This constructor should never be called directly (except from 'create'). private Builder() {} - private Map 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 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. - * - *

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 descendingFields = null; - descendingFields = - Collections.unmodifiableMap(((TreeMap) fields).descendingMap()); - result = new UnknownFieldSet(Collections.unmodifiableMap(fields), descendingFields); + TreeMap fields = new TreeMap<>(); + for (Map.Entry entry : fieldBuilders.entrySet()) { + fields.put(entry.getKey(), entry.getValue().build()); + } + result = new UnknownFieldSet(fields); } - fields = null; return result; } @@ -378,11 +353,13 @@ public final class UnknownFieldSet implements MessageLite { @Override public Builder clone() { - getFieldBuilder(0); // Force lastField to be built. - Map descendingFields = null; - descendingFields = - Collections.unmodifiableMap(((TreeMap) fields).descendingMap()); - return UnknownFieldSet.newBuilder().mergeFrom(new UnknownFieldSet(fields, descendingFields)); + Builder clone = UnknownFieldSet.newBuilder(); + for (Map.Entry 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 @@ public final class UnknownFieldSet implements MessageLite { 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."); - } - if (lastField != null && lastFieldNumber == number) { - // Discard this. - lastField = null; - lastFieldNumber = 0; + /** + * 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 (fields.containsKey(number)) { - fields.remove(number); + if (fieldBuilders.containsKey(number)) { + fieldBuilders.remove(number); } return this; } @@ -423,9 +393,9 @@ public final class UnknownFieldSet implements MessageLite { * 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 entry : other.fields.entrySet()) { + for (Map.Entry entry : other.fields.entrySet()) { mergeField(entry.getKey(), entry.getValue()); } } @@ -435,10 +405,12 @@ public final class UnknownFieldSet implements MessageLite { /** * 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 @@ public final class UnknownFieldSet implements MessageLite { /** * 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 @@ public final class UnknownFieldSet implements MessageLite { * Convenience method for merging a length-delimited field. * *

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."); - } - if (lastField != null && lastFieldNumber == number) { - // Discard this. - lastField = null; - lastFieldNumber = 0; + public Builder addField(int number, Field field) { + if (number <= 0) { + throw new IllegalArgumentException(number + " is not a valid field number."); } - if (fields.isEmpty()) { - fields = new TreeMap(); - } - fields.put(number, field); + fieldBuilders.put(number, Field.newBuilder(field)); return this; } @@ -509,15 +476,18 @@ public final class UnknownFieldSet implements MessageLite { * changes may or may not be reflected in this map. */ public Map asMap() { - getFieldBuilder(0); // Force lastField to be built. + TreeMap fields = new TreeMap<>(); + for (Map.Entry 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 @@ public final class UnknownFieldSet implements MessageLite { * @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 @@ public final class UnknownFieldSet implements MessageLite { 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 @@ public final class UnknownFieldSet implements MessageLite { * 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 @@ public final class UnknownFieldSet implements MessageLite { * 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 @@ public final class UnknownFieldSet implements MessageLite { * 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 @@ public final class UnknownFieldSet implements MessageLite { @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 @@ public final class UnknownFieldSet implements MessageLite { @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 @@ public final class UnknownFieldSet implements MessageLite { } /** 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 @@ public final class UnknownFieldSet implements MessageLite { } @Override - public boolean equals(final Object other) { + public boolean equals(Object other) { if (this == other) { return true; } @@ -785,7 +755,7 @@ public final class UnknownFieldSet implements MessageLite { 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 @@ public final class UnknownFieldSet implements MessageLite { } /** 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 @@ public final class UnknownFieldSet implements MessageLite { * 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 @@ public final class UnknownFieldSet implements MessageLite { * 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 @@ public final class UnknownFieldSet implements MessageLite { } } else { // Write in ascending field order. - for (final ByteString value : lengthDelimited) { + for (ByteString value : lengthDelimited) { writer.writeMessageSetItem(fieldNumber, value); } } @@ -892,9 +862,9 @@ public final class UnknownFieldSet implements MessageLite { * 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 @@ public final class UnknownFieldSet implements MessageLite { *

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; + @Override + public Builder clone() { + Field copy = new Field(); + if (result.varint == null) { + copy.varint = null; + } else { + copy.varint = new ArrayList<>(result.varint); + } + if (result.fixed32 == null) { + copy.fixed32 = null; + } else { + copy.fixed32 = new ArrayList<>(result.fixed32); + } + if (result.fixed64 == null) { + copy.fixed64 = null; + } else { + copy.fixed64 = new ArrayList<>(result.fixed64); + } + if (result.lengthDelimited == null) { + copy.lengthDelimited = null; + } else { + copy.lengthDelimited = new ArrayList<>(result.lengthDelimited); + } + if (result.group == null) { + copy.group = null; + } else { + copy.group = new ArrayList<>(result.group); + } + + Builder clone = new Builder(); + clone.result = copy; + return clone; + } + /** - * 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. + * Build the field. */ public Field build() { + Field built = new Field(); if (result.varint == null) { - result.varint = Collections.emptyList(); + built.varint = Collections.emptyList(); } else { - result.varint = Collections.unmodifiableList(result.varint); + built.varint = Collections.unmodifiableList(new ArrayList<>(result.varint)); } if (result.fixed32 == null) { - result.fixed32 = Collections.emptyList(); + built.fixed32 = Collections.emptyList(); } else { - result.fixed32 = Collections.unmodifiableList(result.fixed32); + built.fixed32 = Collections.unmodifiableList(new ArrayList<>(result.fixed32)); } if (result.fixed64 == null) { - result.fixed64 = Collections.emptyList(); + built.fixed64 = Collections.emptyList(); } else { - result.fixed64 = Collections.unmodifiableList(result.fixed64); + built.fixed64 = Collections.unmodifiableList(new ArrayList<>(result.fixed64)); } if (result.lengthDelimited == null) { - result.lengthDelimited = Collections.emptyList(); + built.lengthDelimited = Collections.emptyList(); } else { - result.lengthDelimited = Collections.unmodifiableList(result.lengthDelimited); + built.lengthDelimited = Collections.unmodifiableList( + new ArrayList<>(result.lengthDelimited)); } if (result.group == null) { - result.group = Collections.emptyList(); + built.group = Collections.emptyList(); } else { - result.group = Collections.unmodifiableList(result.group); + built.group = Collections.unmodifiableList(new ArrayList<>(result.group)); } - final Field returnMe = result; - result = null; - return returnMe; + return built; } /** Discard the field's contents. */ @@ -970,7 +973,7 @@ public final class UnknownFieldSet implements MessageLite { * 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(); @@ -985,19 +988,19 @@ public final class UnknownFieldSet implements MessageLite { } if (!other.fixed64.isEmpty()) { if (result.fixed64 == null) { - result.fixed64 = new ArrayList(); + result.fixed64 = new ArrayList<>(); } result.fixed64.addAll(other.fixed64); } if (!other.lengthDelimited.isEmpty()) { if (result.lengthDelimited == null) { - result.lengthDelimited = new ArrayList(); + result.lengthDelimited = new ArrayList<>(); } result.lengthDelimited.addAll(other.lengthDelimited); } if (!other.group.isEmpty()) { if (result.group == null) { - result.group = new ArrayList(); + result.group = new ArrayList<>(); } result.group.addAll(other.group); } @@ -1005,45 +1008,45 @@ public final class UnknownFieldSet implements MessageLite { } /** Add a varint value. */ - public Builder addVarint(final long value) { + public Builder addVarint(long value) { if (result.varint == null) { - result.varint = new ArrayList(); + 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(); + 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(); + 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(); + 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(); + result.group = new ArrayList<>(); } result.group.add(value); return this; 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 0000000000..6ce0fc7e34 --- /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 1e5bc9649a..fbc3bb8fcf 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.TestEmptyMessageWithExtensions; 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 @@ public class UnknownFieldSetTest { 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()); @@ -100,6 +102,174 @@ public class UnknownFieldSetTest { // ================================================================= + @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 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 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 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"); @@ -185,6 +355,16 @@ public class UnknownFieldSetTest { assertThat(destination.toString()).isEqualTo("1: 1\n2: 2\n3: 3\n3: 4\n"); } + @Test + public void testAsMap() throws Exception { + UnknownFieldSet.Builder builder = UnknownFieldSet.newBuilder().mergeFrom(unknownFields); + Map mapFromBuilder = builder.asMap(); + assertThat(mapFromBuilder).isNotEmpty(); + UnknownFieldSet fields = builder.build(); + Map mapFromFieldSet = fields.asMap(); + assertThat(mapFromFieldSet).containsExactlyEntriesIn(mapFromBuilder); + } + @Test public void testClear() throws Exception { UnknownFieldSet fields = UnknownFieldSet.newBuilder().mergeFrom(unknownFields).clear().build(); diff --git a/java/lite/pom.xml b/java/lite/pom.xml index cfd5707f9b..6f7f53afa1 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -232,6 +232,7 @@ TypeRegistryTest.java UnknownEnumValueTest.java UnknownFieldSetLiteTest.java + UnknownFieldSetPerformanceTest.java UnknownFieldSetTest.java WellKnownTypesTest.java WireFormatTest.java From ea9a01a0f5c259e9597c199e447d99eaab19930b Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Wed, 5 Jan 2022 16:24:38 +0000 Subject: [PATCH 06/12] Update CHANGES.txt for 3.19.2 release --- CHANGES.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGES.txt b/CHANGES.txt index 926eff72da..00e1b92bcb 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,11 @@ +2022-01-05 version 3.19.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) + + Python + * Fix missing Windows wheel for Python 3.10 on PyPI + + Java + * Change implementation of UnknownFieldSet (#9371) + 2021-10-28 version 3.19.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) Bazel From eb94f17a8b8babc4851fb9bb27f9fb1919fe9cfc Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Wed, 5 Jan 2022 17:05:38 +0000 Subject: [PATCH 07/12] Update protobuf version --- Protobuf-C++.podspec | 2 +- Protobuf.podspec | 2 +- configure.ac | 2 +- csharp/Google.Protobuf.Tools.nuspec | 2 +- .../Google.Protobuf/Google.Protobuf.csproj | 2 +- java/README.md | 6 ++--- java/bom/pom.xml | 2 +- java/core/pom.xml | 2 +- java/kotlin-lite/pom.xml | 2 +- java/kotlin/pom.xml | 2 +- java/lite.md | 2 +- java/lite/pom.xml | 2 +- java/pom.xml | 2 +- java/util/pom.xml | 2 +- js/package.json | 2 +- php/ext/google/protobuf/package.xml | 27 ++++++++++++++----- php/ext/google/protobuf/protobuf.h | 2 +- protobuf_version.bzl | 2 +- protoc-artifacts/pom.xml | 2 +- python/google/protobuf/__init__.py | 2 +- ruby/google-protobuf.gemspec | 2 +- ruby/pom.xml | 4 +-- src/Makefile.am | 2 +- src/google/protobuf/any.pb.h | 2 +- src/google/protobuf/api.pb.h | 2 +- src/google/protobuf/compiler/plugin.pb.h | 2 +- src/google/protobuf/descriptor.pb.h | 2 +- src/google/protobuf/duration.pb.h | 2 +- src/google/protobuf/empty.pb.h | 2 +- src/google/protobuf/field_mask.pb.h | 2 +- src/google/protobuf/port_def.inc | 2 +- src/google/protobuf/source_context.pb.h | 2 +- src/google/protobuf/struct.pb.h | 2 +- src/google/protobuf/stubs/common.h | 2 +- src/google/protobuf/timestamp.pb.h | 2 +- src/google/protobuf/type.pb.h | 2 +- src/google/protobuf/wrappers.pb.h | 2 +- 37 files changed, 60 insertions(+), 45 deletions(-) diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index c6f5511cdb..d6f2c00f07 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.19.1' + s.version = '3.19.2' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = '3-Clause BSD License' diff --git a/Protobuf.podspec b/Protobuf.podspec index ee63ffcb07..f8c8c65b83 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.19.1' + s.version = '3.19.2' 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/configure.ac b/configure.ac index fb5f9d09f3..6bec81022d 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_PREREQ(2.59) # In the SVN trunk, the version should always be the next anticipated release # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed # the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.19.1],[protobuf@googlegroups.com],[protobuf]) +AC_INIT([Protocol Buffers],[3.19.2],[protobuf@googlegroups.com],[protobuf]) AM_MAINTAINER_MODE([enable]) diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index b2d1417b6c..b653766268 100644 --- a/csharp/Google.Protobuf.Tools.nuspec +++ b/csharp/Google.Protobuf.Tools.nuspec @@ -5,7 +5,7 @@ Google Protocol Buffers tools

Tools for Protocol Buffers - Google's data interchange format. See project site for more info. - 3.19.1 + 3.19.2 Google Inc. protobuf-packages https://github.com/protocolbuffers/protobuf/blob/master/LICENSE diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj index ad6f57999b..68c14bf58a 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -4,7 +4,7 @@ C# runtime library for Protocol Buffers - Google's data interchange format. Copyright 2015, Google Inc. Google Protocol Buffers - 3.19.1 + 3.19.2 7.2 Google Inc. diff --git a/java/README.md b/java/README.md index 456ba1c976..c1c3614063 100644 --- a/java/README.md +++ b/java/README.md @@ -23,7 +23,7 @@ If you are using Maven, use the following: com.google.protobuf protobuf-java - 3.19.1 + 3.19.2 ``` @@ -37,7 +37,7 @@ protobuf-java-util package: com.google.protobuf protobuf-java-util - 3.19.1 + 3.19.2 ``` @@ -45,7 +45,7 @@ protobuf-java-util package: If you are using Gradle, add the following to your `build.gradle` file's dependencies: ``` - implementation 'com.google.protobuf:protobuf-java:3.19.1' + implementation 'com.google.protobuf:protobuf-java:3.19.2' ``` 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 348ea57fcc..68aded500c 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-bom - 3.19.1 + 3.19.2 pom Protocol Buffers [BOM] diff --git a/java/core/pom.xml b/java/core/pom.xml index 9c020f98dc..b77a5c422d 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.19.1 + 3.19.2 protobuf-java diff --git a/java/kotlin-lite/pom.xml b/java/kotlin-lite/pom.xml index 23dfc77cc3..4be6c73a91 100644 --- a/java/kotlin-lite/pom.xml +++ b/java/kotlin-lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.19.1 + 3.19.2 protobuf-kotlin-lite diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml index 0455d114ed..90d12f6a0d 100644 --- a/java/kotlin/pom.xml +++ b/java/kotlin/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.19.1 + 3.19.2 protobuf-kotlin diff --git a/java/lite.md b/java/lite.md index 8f3ef1e49b..bb22fb9f91 100644 --- a/java/lite.md +++ b/java/lite.md @@ -30,7 +30,7 @@ protobuf Java runtime. If you are using Maven, use the following: com.google.protobuf protobuf-javalite - 3.19.1 + 3.19.2 ``` diff --git a/java/lite/pom.xml b/java/lite/pom.xml index 6f7f53afa1..a8ae75cc3b 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.19.1 + 3.19.2 protobuf-javalite diff --git a/java/pom.xml b/java/pom.xml index 127fa6287f..1932c9e89f 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.19.1 + 3.19.2 pom Protocol Buffers [Parent] diff --git a/java/util/pom.xml b/java/util/pom.xml index c9ada55804..e5a4b412c2 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.19.1 + 3.19.2 protobuf-java-util diff --git a/js/package.json b/js/package.json index edccba6097..2c9ac58721 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "google-protobuf", - "version": "3.19.1", + "version": "3.19.2", "description": "Protocol Buffers for JavaScript", "main": "google-protobuf.js", "files": [ diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index 12c899ef85..dc35b7d593 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -1,5 +1,5 @@ - + protobuf pecl.php.net Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data. @@ -10,11 +10,11 @@ protobuf-opensource@google.com yes - 2021-10-28 - + 2022-01-05 + - 3.19.1 - 3.19.1 + 3.19.2 + 3.19.2 stable @@ -22,7 +22,7 @@ 3-Clause BSD License - * No new changes in 3.19.1 + * No new changes in 3.19.2 @@ -1158,5 +1158,20 @@ G A release. + + + 3.19.2 + 3.19.2 + + + stable + stable + + 2022-01-05 + + 3-Clause BSD License + + + diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 7cbad84861..87aeeea59d 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -91,7 +91,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setter, 0, 0, 1) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() -#define PHP_PROTOBUF_VERSION "3.19.1" +#define PHP_PROTOBUF_VERSION "3.19.2" // ptr -> PHP object cache. This is a weak map that caches lazily-created // wrapper objects around upb types: diff --git a/protobuf_version.bzl b/protobuf_version.bzl index 31ce2e3bac..436086e0da 100644 --- a/protobuf_version.bzl +++ b/protobuf_version.bzl @@ -1 +1 @@ -PROTOBUF_VERSION = '3.19.1' +PROTOBUF_VERSION = '3.19.2' diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml index 7e5eca83ed..7bb58f6dfc 100644 --- a/protoc-artifacts/pom.xml +++ b/protoc-artifacts/pom.xml @@ -8,7 +8,7 @@ com.google.protobuf protoc - 3.19.1 + 3.19.2 pom Protobuf Compiler diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index 52101b6fe4..fc8d7ae1d9 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.19.1' +__version__ = '3.19.2' diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index 810c6fff88..6a82dc1b41 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.19.1" + s.version = "3.19.2" 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" diff --git a/ruby/pom.xml b/ruby/pom.xml index f4c8f66d1e..395b957696 100644 --- a/ruby/pom.xml +++ b/ruby/pom.xml @@ -9,7 +9,7 @@ com.google.protobuf.jruby protobuf-jruby - 3.19.1 + 3.19.2 Protocol Buffer JRuby native extension Protocol Buffers are a way of encoding structured data in an efficient yet @@ -76,7 +76,7 @@ com.google.protobuf protobuf-java-util - 3.19.1 + 3.19.2 org.jruby diff --git a/src/Makefile.am b/src/Makefile.am index 2d6034a0de..e897cc8eed 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,7 +18,7 @@ else PTHREAD_DEF = endif -PROTOBUF_VERSION = 30:1:0 +PROTOBUF_VERSION = 30:2:0 if GCC # Turn on all warnings except for sign comparison (we ignore sign comparison diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index ab07cc70d2..9e04bfb296 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019002 < 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. diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index 26e1946f85..69d4cad776 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019002 < 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. diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index 569bb30a69..320011e98a 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019002 < 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. diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 66d7e264d6..a0a96821af 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019002 < 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. diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index 6440e9d331..d1962b736c 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019002 < 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. diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index ba97255ed0..eaee816b33 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019002 < 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. diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index 4114740bbe..103dfa377b 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019002 < 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. diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 71325c3872..631b143623 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -153,7 +153,7 @@ #ifdef PROTOBUF_VERSION #error PROTOBUF_VERSION was previously defined #endif -#define PROTOBUF_VERSION 3019001 +#define PROTOBUF_VERSION 3019002 #ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC #error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index 5f91f3eb8d..589f4de006 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019002 < 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. diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index 6e54bee65b..b6429e6083 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019002 < 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. diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index c32503a6de..d3b32c381f 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -82,7 +82,7 @@ namespace internal { // The current version, represented as a single integer to make comparison // easier: major * 10^6 + minor * 10^3 + micro -#define GOOGLE_PROTOBUF_VERSION 3019001 +#define GOOGLE_PROTOBUF_VERSION 3019002 // A suffix string for alpha, beta or rc releases. Empty for stable releases. #define GOOGLE_PROTOBUF_VERSION_SUFFIX "" diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index 95036fdea6..ea0cb201fe 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019002 < 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. diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index b91ab7ce58..ce17016ba9 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019002 < 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. diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index 42ffda2eeb..9e32a6609f 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019001 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019002 < 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. From cb46755e6405e083b45481f5ea4754b180705529 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Wed, 5 Jan 2022 18:03:53 +0000 Subject: [PATCH 08/12] Tweak wording of CHANGES.txt --- CHANGES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 00e1b92bcb..19720f972a 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -4,7 +4,7 @@ * Fix missing Windows wheel for Python 3.10 on PyPI Java - * Change implementation of UnknownFieldSet (#9371) + * Improve performance characteristics of UnknownFieldSet parsing (#9371) 2021-10-28 version 3.19.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) From 922a7ec18926aa2612d14a2b4abb8689477e97a4 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Wed, 20 Oct 2021 14:51:07 -0700 Subject: [PATCH 09/12] Fix Python 3.10 C++ tests (#9128) The first change is to make sure we always define PY_SSIZE_T_CLEAN before including Python.h. Starting from Python 3.10 this is required. Otherwise we get errors like this: SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats The second change is to update reflection_test.py to account for the fact that with Python 3.10, we get a TypeError even with the C++ implementation when trying to assign a float to a bool field. I'm not sure why this changed with Python 3.10, but it seems like a good thing since this is the desired behavior anyway. --- python/google/protobuf/internal/api_implementation.cc | 1 + python/google/protobuf/internal/reflection_test.py | 4 +++- python/google/protobuf/proto_api.h | 1 + python/google/protobuf/pyext/descriptor.cc | 1 + python/google/protobuf/pyext/descriptor.h | 1 + python/google/protobuf/pyext/descriptor_containers.cc | 1 + python/google/protobuf/pyext/descriptor_containers.h | 1 + python/google/protobuf/pyext/descriptor_database.h | 1 + python/google/protobuf/pyext/descriptor_pool.cc | 1 + python/google/protobuf/pyext/descriptor_pool.h | 1 + python/google/protobuf/pyext/extension_dict.h | 1 + python/google/protobuf/pyext/field.h | 1 + python/google/protobuf/pyext/map_container.h | 1 + python/google/protobuf/pyext/message.h | 1 + python/google/protobuf/pyext/message_factory.cc | 1 + python/google/protobuf/pyext/message_factory.h | 1 + python/google/protobuf/pyext/message_module.cc | 1 + python/google/protobuf/pyext/repeated_composite_container.h | 1 + python/google/protobuf/pyext/repeated_scalar_container.h | 1 + python/google/protobuf/pyext/scoped_pyobject_ptr.h | 1 + python/google/protobuf/pyext/unknown_fields.cc | 1 + python/google/protobuf/pyext/unknown_fields.h | 1 + python/google/protobuf/python_protobuf.h | 1 + 23 files changed, 25 insertions(+), 1 deletion(-) diff --git a/python/google/protobuf/internal/api_implementation.cc b/python/google/protobuf/internal/api_implementation.cc index 6532a81405..802322424e 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 namespace google { diff --git a/python/google/protobuf/internal/reflection_test.py b/python/google/protobuf/internal/reflection_test.py index 9343389ed5..d1d595625d 100644 --- a/python/google/protobuf/internal/reflection_test.py +++ b/python/google/protobuf/internal/reflection_test.py @@ -37,6 +37,7 @@ import copy import gc import operator import struct +import sys import warnings import unittest @@ -376,7 +377,8 @@ class ReflectionTest(unittest.TestCase): 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/proto_api.h b/python/google/protobuf/proto_api.h index 2e2156a56e..9969a91f44 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 #include diff --git a/python/google/protobuf/pyext/descriptor.cc b/python/google/protobuf/pyext/descriptor.cc index 9708b84013..a2993d908b 100644 --- a/python/google/protobuf/pyext/descriptor.cc +++ b/python/google/protobuf/pyext/descriptor.cc @@ -32,6 +32,7 @@ #include +#define PY_SSIZE_T_CLEAN #include #include diff --git a/python/google/protobuf/pyext/descriptor.h b/python/google/protobuf/pyext/descriptor.h index b99209dd19..d97e2f8103 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 #include diff --git a/python/google/protobuf/pyext/descriptor_containers.cc b/python/google/protobuf/pyext/descriptor_containers.cc index b084f5b812..4caff6941a 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 #include diff --git a/python/google/protobuf/pyext/descriptor_containers.h b/python/google/protobuf/pyext/descriptor_containers.h index 4e05c58e2b..cf2cf4ad0b 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 namespace google { diff --git a/python/google/protobuf/pyext/descriptor_database.h b/python/google/protobuf/pyext/descriptor_database.h index d2d9f8e506..3bc99e7dbc 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 #include diff --git a/python/google/protobuf/pyext/descriptor_pool.cc b/python/google/protobuf/pyext/descriptor_pool.cc index 5ec6269cd4..f6bdb6e4c8 100644 --- a/python/google/protobuf/pyext/descriptor_pool.cc +++ b/python/google/protobuf/pyext/descriptor_pool.cc @@ -32,6 +32,7 @@ #include +#define PY_SSIZE_T_CLEAN #include #include diff --git a/python/google/protobuf/pyext/descriptor_pool.h b/python/google/protobuf/pyext/descriptor_pool.h index 48658d3e88..5d3c3a95cc 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 #include diff --git a/python/google/protobuf/pyext/extension_dict.h b/python/google/protobuf/pyext/extension_dict.h index c9da443161..a0581941bd 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 #include diff --git a/python/google/protobuf/pyext/field.h b/python/google/protobuf/pyext/field.h index 7b4660cab5..f9f94c4983 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 namespace google { diff --git a/python/google/protobuf/pyext/map_container.h b/python/google/protobuf/pyext/map_container.h index 842602e79f..e14136efab 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 #include diff --git a/python/google/protobuf/pyext/message.h b/python/google/protobuf/pyext/message.h index 29af255154..b17daa5806 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 #include diff --git a/python/google/protobuf/pyext/message_factory.cc b/python/google/protobuf/pyext/message_factory.cc index 30dfab88dc..5098379f35 100644 --- a/python/google/protobuf/pyext/message_factory.cc +++ b/python/google/protobuf/pyext/message_factory.cc @@ -30,6 +30,7 @@ #include +#define PY_SSIZE_T_CLEAN #include #include diff --git a/python/google/protobuf/pyext/message_factory.h b/python/google/protobuf/pyext/message_factory.h index 515c29cdb8..7dfe425dd5 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 #include diff --git a/python/google/protobuf/pyext/message_module.cc b/python/google/protobuf/pyext/message_module.cc index 971d2bad70..a0806a3160 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 #include diff --git a/python/google/protobuf/pyext/repeated_composite_container.h b/python/google/protobuf/pyext/repeated_composite_container.h index e241827ef5..30536eabd4 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 #include diff --git a/python/google/protobuf/pyext/repeated_scalar_container.h b/python/google/protobuf/pyext/repeated_scalar_container.h index f9f0ea8f31..372b6f0a35 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 #include diff --git a/python/google/protobuf/pyext/scoped_pyobject_ptr.h b/python/google/protobuf/pyext/scoped_pyobject_ptr.h index 6f7fc29813..985df2c3bb 100644 --- a/python/google/protobuf/pyext/scoped_pyobject_ptr.h +++ b/python/google/protobuf/pyext/scoped_pyobject_ptr.h @@ -35,6 +35,7 @@ #include +#define PY_SSIZE_T_CLEAN #include namespace google { namespace protobuf { diff --git a/python/google/protobuf/pyext/unknown_fields.cc b/python/google/protobuf/pyext/unknown_fields.cc index 7f4fb23edf..b9ca6ad3b0 100644 --- a/python/google/protobuf/pyext/unknown_fields.cc +++ b/python/google/protobuf/pyext/unknown_fields.cc @@ -30,6 +30,7 @@ #include +#define PY_SSIZE_T_CLEAN #include #include #include diff --git a/python/google/protobuf/pyext/unknown_fields.h b/python/google/protobuf/pyext/unknown_fields.h index 94d55e148d..e7b0b35c41 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 #include diff --git a/python/google/protobuf/python_protobuf.h b/python/google/protobuf/python_protobuf.h index 8db1ffb750..4fcf065404 100644 --- a/python/google/protobuf/python_protobuf.h +++ b/python/google/protobuf/python_protobuf.h @@ -36,6 +36,7 @@ #ifndef GOOGLE_PROTOBUF_PYTHON_PYTHON_PROTOBUF_H__ #define GOOGLE_PROTOBUF_PYTHON_PYTHON_PROTOBUF_H__ +#define PY_SSIZE_T_CLEAN #include namespace google { From 203c593b9681d98e7e05f3d8f862aa183f5d9c91 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Mon, 10 Jan 2022 21:40:56 +0000 Subject: [PATCH 10/12] Fix build error with Python 3.10 build on Windows The Windows build for Python 3.10 is giving us an error about ssize_t being undefined, so this commit fixes the problem by replacing it with Py_ssize_t, which is consistent with what we do elsewhere in the file. --- python/google/protobuf/pyext/unknown_fields.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/google/protobuf/pyext/unknown_fields.cc b/python/google/protobuf/pyext/unknown_fields.cc index b9ca6ad3b0..6d919b361a 100644 --- a/python/google/protobuf/pyext/unknown_fields.cc +++ b/python/google/protobuf/pyext/unknown_fields.cc @@ -219,7 +219,7 @@ const UnknownField* GetUnknownField(PyUnknownFieldRef* self) { "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. " From ee432e55b808a57e44115178e41cd5ceae91b205 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Tue, 11 Jan 2022 01:05:54 +0000 Subject: [PATCH 11/12] Update CHANGES.txt for 3.19.3 The 3.19.2 release was supposed to fix the missing Python 3.10 wheel for Windows, but this turned out to need some more fixes. This commit updates CHANGES.txt to reflect that this fix will happen in 3.19.3 instead of 3.19.2. --- CHANGES.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index 19720f972a..92d220f35b 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,8 +1,10 @@ -2022-01-05 version 3.19.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript) +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) From cc7b1b53234cd7a8f50d90ac3933b240dcf4cd97 Mon Sep 17 00:00:00 2001 From: Adam Cozzette Date: Tue, 11 Jan 2022 01:02:49 +0000 Subject: [PATCH 12/12] Update protobuf version --- Protobuf-C++.podspec | 2 +- Protobuf.podspec | 2 +- configure.ac | 2 +- csharp/Google.Protobuf.Tools.nuspec | 2 +- .../Google.Protobuf/Google.Protobuf.csproj | 2 +- java/README.md | 6 ++--- java/bom/pom.xml | 2 +- java/core/pom.xml | 2 +- java/kotlin-lite/pom.xml | 2 +- java/kotlin/pom.xml | 2 +- java/lite.md | 2 +- java/lite/pom.xml | 2 +- java/pom.xml | 2 +- java/util/pom.xml | 2 +- js/package.json | 2 +- php/ext/google/protobuf/package.xml | 25 +++++++++++++++---- php/ext/google/protobuf/protobuf.h | 2 +- protobuf_version.bzl | 2 +- protoc-artifacts/pom.xml | 2 +- python/google/protobuf/__init__.py | 2 +- ruby/google-protobuf.gemspec | 2 +- ruby/pom.xml | 4 +-- src/Makefile.am | 2 +- src/google/protobuf/any.pb.h | 2 +- src/google/protobuf/api.pb.h | 2 +- src/google/protobuf/compiler/plugin.pb.h | 2 +- src/google/protobuf/descriptor.pb.h | 2 +- src/google/protobuf/duration.pb.h | 2 +- src/google/protobuf/empty.pb.h | 2 +- src/google/protobuf/field_mask.pb.h | 2 +- src/google/protobuf/port_def.inc | 2 +- src/google/protobuf/source_context.pb.h | 2 +- src/google/protobuf/struct.pb.h | 2 +- src/google/protobuf/stubs/common.h | 2 +- src/google/protobuf/timestamp.pb.h | 2 +- src/google/protobuf/type.pb.h | 2 +- src/google/protobuf/wrappers.pb.h | 2 +- 37 files changed, 59 insertions(+), 44 deletions(-) diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec index d6f2c00f07..ab241b9432 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.19.2' + s.version = '3.19.3' s.summary = 'Protocol Buffers v3 runtime library for C++.' s.homepage = 'https://github.com/google/protobuf' s.license = '3-Clause BSD License' diff --git a/Protobuf.podspec b/Protobuf.podspec index f8c8c65b83..39f83393fa 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.19.2' + s.version = '3.19.3' 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/configure.ac b/configure.ac index 6bec81022d..02085ca809 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ AC_PREREQ(2.59) # In the SVN trunk, the version should always be the next anticipated release # version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed # the size of one file name in the dist tarfile over the 99-char limit.) -AC_INIT([Protocol Buffers],[3.19.2],[protobuf@googlegroups.com],[protobuf]) +AC_INIT([Protocol Buffers],[3.19.3],[protobuf@googlegroups.com],[protobuf]) AM_MAINTAINER_MODE([enable]) diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec index b653766268..b57bab299a 100644 --- a/csharp/Google.Protobuf.Tools.nuspec +++ b/csharp/Google.Protobuf.Tools.nuspec @@ -5,7 +5,7 @@ Google Protocol Buffers tools Tools for Protocol Buffers - Google's data interchange format. See project site for more info. - 3.19.2 + 3.19.3 Google Inc. protobuf-packages https://github.com/protocolbuffers/protobuf/blob/master/LICENSE diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj index 68c14bf58a..1caa7de93c 100644 --- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj +++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj @@ -4,7 +4,7 @@ C# runtime library for Protocol Buffers - Google's data interchange format. Copyright 2015, Google Inc. Google Protocol Buffers - 3.19.2 + 3.19.3 7.2 Google Inc. diff --git a/java/README.md b/java/README.md index c1c3614063..46b3f563d4 100644 --- a/java/README.md +++ b/java/README.md @@ -23,7 +23,7 @@ If you are using Maven, use the following: com.google.protobuf protobuf-java - 3.19.2 + 3.19.3 ``` @@ -37,7 +37,7 @@ protobuf-java-util package: com.google.protobuf protobuf-java-util - 3.19.2 + 3.19.3 ``` @@ -45,7 +45,7 @@ protobuf-java-util package: If you are using Gradle, add the following to your `build.gradle` file's dependencies: ``` - implementation 'com.google.protobuf:protobuf-java:3.19.2' + implementation 'com.google.protobuf:protobuf-java:3.19.3' ``` 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 68aded500c..cb0fad22c3 100644 --- a/java/bom/pom.xml +++ b/java/bom/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-bom - 3.19.2 + 3.19.3 pom Protocol Buffers [BOM] diff --git a/java/core/pom.xml b/java/core/pom.xml index b77a5c422d..f288746711 100644 --- a/java/core/pom.xml +++ b/java/core/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.19.2 + 3.19.3 protobuf-java diff --git a/java/kotlin-lite/pom.xml b/java/kotlin-lite/pom.xml index 4be6c73a91..0348bddf20 100644 --- a/java/kotlin-lite/pom.xml +++ b/java/kotlin-lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.19.2 + 3.19.3 protobuf-kotlin-lite diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml index 90d12f6a0d..a275f24bd9 100644 --- a/java/kotlin/pom.xml +++ b/java/kotlin/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.19.2 + 3.19.3 protobuf-kotlin diff --git a/java/lite.md b/java/lite.md index bb22fb9f91..cbb5960793 100644 --- a/java/lite.md +++ b/java/lite.md @@ -30,7 +30,7 @@ protobuf Java runtime. If you are using Maven, use the following: com.google.protobuf protobuf-javalite - 3.19.2 + 3.19.3 ``` diff --git a/java/lite/pom.xml b/java/lite/pom.xml index a8ae75cc3b..ee8c73ca51 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.19.2 + 3.19.3 protobuf-javalite diff --git a/java/pom.xml b/java/pom.xml index 1932c9e89f..16df630384 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.19.2 + 3.19.3 pom Protocol Buffers [Parent] diff --git a/java/util/pom.xml b/java/util/pom.xml index e5a4b412c2..606c445321 100644 --- a/java/util/pom.xml +++ b/java/util/pom.xml @@ -4,7 +4,7 @@ com.google.protobuf protobuf-parent - 3.19.2 + 3.19.3 protobuf-java-util diff --git a/js/package.json b/js/package.json index 2c9ac58721..aecbbc1c84 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "google-protobuf", - "version": "3.19.2", + "version": "3.19.3", "description": "Protocol Buffers for JavaScript", "main": "google-protobuf.js", "files": [ diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index dc35b7d593..2986347904 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -10,11 +10,11 @@ protobuf-opensource@google.com yes - 2022-01-05 - + 2022-01-11 + - 3.19.2 - 3.19.2 + 3.19.3 + 3.19.3 stable @@ -22,7 +22,7 @@ 3-Clause BSD License - * No new changes in 3.19.2 + * No new changes in 3.19.3 @@ -1173,5 +1173,20 @@ G A release. + + + 3.19.3 + 3.19.3 + + + stable + stable + + 2022-01-11 + + 3-Clause BSD License + + + diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index 87aeeea59d..df52892111 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -91,7 +91,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setter, 0, 0, 1) ZEND_ARG_INFO(0, value) ZEND_END_ARG_INFO() -#define PHP_PROTOBUF_VERSION "3.19.2" +#define PHP_PROTOBUF_VERSION "3.19.3" // ptr -> PHP object cache. This is a weak map that caches lazily-created // wrapper objects around upb types: diff --git a/protobuf_version.bzl b/protobuf_version.bzl index 436086e0da..3a5a72dec6 100644 --- a/protobuf_version.bzl +++ b/protobuf_version.bzl @@ -1 +1 @@ -PROTOBUF_VERSION = '3.19.2' +PROTOBUF_VERSION = '3.19.3' diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml index 7bb58f6dfc..8c2948c586 100644 --- a/protoc-artifacts/pom.xml +++ b/protoc-artifacts/pom.xml @@ -8,7 +8,7 @@ com.google.protobuf protoc - 3.19.2 + 3.19.3 pom Protobuf Compiler diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py index fc8d7ae1d9..07a4d94fd2 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.19.2' +__version__ = '3.19.3' diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec index 6a82dc1b41..1c151a5983 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.19.2" + s.version = "3.19.3" 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" diff --git a/ruby/pom.xml b/ruby/pom.xml index 395b957696..255d840bb9 100644 --- a/ruby/pom.xml +++ b/ruby/pom.xml @@ -9,7 +9,7 @@ com.google.protobuf.jruby protobuf-jruby - 3.19.2 + 3.19.3 Protocol Buffer JRuby native extension Protocol Buffers are a way of encoding structured data in an efficient yet @@ -76,7 +76,7 @@ com.google.protobuf protobuf-java-util - 3.19.2 + 3.19.3 org.jruby diff --git a/src/Makefile.am b/src/Makefile.am index e897cc8eed..3312e5db33 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -18,7 +18,7 @@ else PTHREAD_DEF = endif -PROTOBUF_VERSION = 30:2:0 +PROTOBUF_VERSION = 30:3:0 if GCC # Turn on all warnings except for sign comparison (we ignore sign comparison diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h index 9e04bfb296..a04547b453 100644 --- a/src/google/protobuf/any.pb.h +++ b/src/google/protobuf/any.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019003 < 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. diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h index 69d4cad776..c13eaab1ea 100644 --- a/src/google/protobuf/api.pb.h +++ b/src/google/protobuf/api.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019003 < 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. diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h index 320011e98a..3e9d7c5b6e 100644 --- a/src/google/protobuf/compiler/plugin.pb.h +++ b/src/google/protobuf/compiler/plugin.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019003 < 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. diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index a0a96821af..71b018eb83 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019003 < 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. diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h index d1962b736c..4f04a0b83a 100644 --- a/src/google/protobuf/duration.pb.h +++ b/src/google/protobuf/duration.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019003 < 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. diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h index eaee816b33..658ceea0f6 100644 --- a/src/google/protobuf/empty.pb.h +++ b/src/google/protobuf/empty.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019003 < 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. diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h index 103dfa377b..c641a4acc2 100644 --- a/src/google/protobuf/field_mask.pb.h +++ b/src/google/protobuf/field_mask.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019003 < 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. diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc index 631b143623..2c71f9b5e5 100644 --- a/src/google/protobuf/port_def.inc +++ b/src/google/protobuf/port_def.inc @@ -153,7 +153,7 @@ #ifdef PROTOBUF_VERSION #error PROTOBUF_VERSION was previously defined #endif -#define PROTOBUF_VERSION 3019002 +#define PROTOBUF_VERSION 3019003 #ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC #error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h index 589f4de006..58b1cb8f62 100644 --- a/src/google/protobuf/source_context.pb.h +++ b/src/google/protobuf/source_context.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019003 < 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. diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h index b6429e6083..f2beaef09c 100644 --- a/src/google/protobuf/struct.pb.h +++ b/src/google/protobuf/struct.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019003 < 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. diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h index d3b32c381f..44d680a197 100644 --- a/src/google/protobuf/stubs/common.h +++ b/src/google/protobuf/stubs/common.h @@ -82,7 +82,7 @@ namespace internal { // The current version, represented as a single integer to make comparison // easier: major * 10^6 + minor * 10^3 + micro -#define GOOGLE_PROTOBUF_VERSION 3019002 +#define GOOGLE_PROTOBUF_VERSION 3019003 // A suffix string for alpha, beta or rc releases. Empty for stable releases. #define GOOGLE_PROTOBUF_VERSION_SUFFIX "" diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h index ea0cb201fe..671961edd5 100644 --- a/src/google/protobuf/timestamp.pb.h +++ b/src/google/protobuf/timestamp.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019003 < 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. diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h index ce17016ba9..d3c198a3e3 100644 --- a/src/google/protobuf/type.pb.h +++ b/src/google/protobuf/type.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019003 < 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. diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h index 9e32a6609f..a4ac2896bc 100644 --- a/src/google/protobuf/wrappers.pb.h +++ b/src/google/protobuf/wrappers.pb.h @@ -13,7 +13,7 @@ #error incompatible with your Protocol Buffer headers. Please update #error your headers. #endif -#if 3019002 < PROTOBUF_MIN_PROTOC_VERSION +#if 3019003 < 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.