Merge branch '21.x' into fix-21x-ruby

pull/15149/head
Joshua Haberman 1 year ago
commit ec0e40425c
  1. 31
      BUILD.bazel
  2. 8
      CHANGES.txt
  3. 1
      Makefile.am
  4. 2
      Protobuf-C++.podspec
  5. 2
      Protobuf.podspec
  6. 2
      configure.ac
  7. 2
      csharp/Google.Protobuf.Tools.nuspec
  8. 2
      csharp/src/Google.Protobuf/Google.Protobuf.csproj
  9. 6
      java/README.md
  10. 2
      java/bom/pom.xml
  11. 1
      java/core/BUILD.bazel
  12. 2
      java/core/pom.xml
  13. 2
      java/core/src/main/java/com/google/protobuf/AllocatedBuffer.java
  14. 28
      java/core/src/main/java/com/google/protobuf/BinaryWriter.java
  15. 2
      java/core/src/main/java/com/google/protobuf/ByteBufferWriter.java
  16. 28
      java/core/src/main/java/com/google/protobuf/CodedOutputStream.java
  17. 8
      java/core/src/main/java/com/google/protobuf/Internal.java
  18. 4
      java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java
  19. 67
      java/core/src/main/java/com/google/protobuf/Java8Compatibility.java
  20. 6
      java/core/src/main/java/com/google/protobuf/MessageSchema.java
  21. 11
      java/core/src/main/java/com/google/protobuf/NioByteString.java
  22. 2
      java/core/src/main/java/com/google/protobuf/TextFormat.java
  23. 10
      java/core/src/main/java/com/google/protobuf/Utf8.java
  24. 2
      java/kotlin-lite/pom.xml
  25. 2
      java/kotlin/pom.xml
  26. 2
      java/lite.md
  27. 3
      java/lite/pom.xml
  28. 24
      java/lite/src/test/java/com/google/protobuf/LiteTest.java
  29. 2
      java/pom.xml
  30. 2
      java/util/pom.xml
  31. 4
      kokoro/macos/prepare_build_macos_rc
  32. 38
      kokoro/release/collect_all_artifacts.sh
  33. 3
      kokoro/release/python/macos/build_artifacts.sh
  34. 2
      kokoro/release/python/macos/continuous.cfg
  35. 2
      kokoro/release/python/macos/presubmit.cfg
  36. 2
      kokoro/release/python/macos/release.cfg
  37. 5
      kokoro/release/ruby/macos/build_artifacts.sh
  38. 2
      kokoro/release/ruby/macos/continuous.cfg
  39. 2
      kokoro/release/ruby/macos/presubmit.cfg
  40. 2
      kokoro/release/ruby/macos/release.cfg
  41. 4
      kokoro/release/ruby/macos/ruby/ruby_build_environment.sh
  42. 5
      php/ext/google/protobuf/php-upb.c
  43. 2
      php/ext/google/protobuf/protobuf.h
  44. 4
      protobuf_deps.bzl
  45. 8
      protobuf_version.bzl
  46. 2
      protoc-artifacts/pom.xml
  47. 2
      python/google/protobuf/__init__.py
  48. 5
      ruby/ext/google/protobuf_c/ruby-upb.c
  49. 2
      ruby/google-protobuf.gemspec
  50. 4
      ruby/pom.xml
  51. 3
      ruby/travis-test.sh
  52. 2
      src/Makefile.am
  53. 2
      src/google/protobuf/any.pb.h
  54. 2
      src/google/protobuf/api.pb.h
  55. 2
      src/google/protobuf/compiler/plugin.pb.h
  56. 2
      src/google/protobuf/descriptor.pb.h
  57. 2
      src/google/protobuf/duration.pb.h
  58. 2
      src/google/protobuf/empty.pb.h
  59. 2
      src/google/protobuf/field_mask.pb.h
  60. 40
      src/google/protobuf/port_def.inc
  61. 4
      src/google/protobuf/port_undef.inc
  62. 2
      src/google/protobuf/source_context.pb.h
  63. 2
      src/google/protobuf/struct.pb.h
  64. 2
      src/google/protobuf/stubs/common.h
  65. 2
      src/google/protobuf/timestamp.pb.h
  66. 2
      src/google/protobuf/type.pb.h
  67. 1
      src/google/protobuf/unittest_lite.proto
  68. 2
      src/google/protobuf/wrappers.pb.h
  69. 20
      version.json

@ -158,16 +158,17 @@ cc_library(
# DEPRECATED: Prefer :well_known_type_protos for the Well-Known Types # DEPRECATED: Prefer :well_known_type_protos for the Well-Known Types
# (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf) # (https://developers.google.com/protocol-buffers/docs/reference/google.protobuf)
# or :descriptor_proto(_srcs) for descriptor.proto (source), or # or :descriptor_proto_srcs for descriptor.proto, or :compiler_plugin_proto_srcs
# :compiler_plugin_proto for compiler/plugin.proto. # for compiler/plugin.proto.
filegroup( filegroup(
name = "well_known_protos", name = "well_known_protos",
srcs = [ srcs = [
"src/google/protobuf/compiler/plugin.proto", ":compiler_plugin_proto_srcs",
"src/google/protobuf/descriptor.proto", ":descriptor_proto_srcs",
":well_known_type_protos", ":well_known_type_protos",
], ],
deprecation = "Prefer :well_known_type_protos instead.", deprecation = "Prefer :well_known_type_protos, :compiler_plugin_proto, " +
"and :descriptor_proto instead.",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )
@ -191,12 +192,24 @@ filegroup(
filegroup( filegroup(
name = "built_in_runtime_protos", name = "built_in_runtime_protos",
srcs = [ srcs = [
"src/google/protobuf/compiler/plugin.proto", ":descriptor_proto_srcs",
"src/google/protobuf/descriptor.proto", ":compiler_plugin_proto_srcs",
], ],
visibility = ["//:__subpackages__"], visibility = ["//:__subpackages__"],
) )
filegroup(
name = "descriptor_proto_srcs",
srcs = ["src/google/protobuf/descriptor.proto"],
visibility = ["//visibility:public"],
)
filegroup(
name = "compiler_plugin_proto_srcs",
srcs = ["src/google/protobuf/compiler/plugin.proto"],
visibility = ["//visibility:public"],
)
exports_files( exports_files(
srcs = [ srcs = [
"src/google/protobuf/any.proto", "src/google/protobuf/any.proto",
@ -342,7 +355,7 @@ proto_library(
proto_library( proto_library(
name = "compiler_plugin_proto", name = "compiler_plugin_proto",
srcs = ["src/google/protobuf/compiler/plugin.proto"], srcs = [":compiler_plugin_proto_srcs"],
strip_import_prefix = "src", strip_import_prefix = "src",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
deps = ["//:descriptor_proto"], deps = ["//:descriptor_proto"],
@ -350,7 +363,7 @@ proto_library(
proto_library( proto_library(
name = "descriptor_proto", name = "descriptor_proto",
srcs = ["src/google/protobuf/descriptor.proto"], srcs = [":descriptor_proto_srcs"],
strip_import_prefix = "src", strip_import_prefix = "src",
visibility = ["//visibility:public"], visibility = ["//visibility:public"],
) )

@ -1,3 +1,11 @@
2022-12-13 version 21.12 (C++/Java/Python/PHP/Objective-C/C#/Ruby)
Python
* Fix broken enum ranges (#11171)
* Stop requiring extension fields to have a sythetic oneof (#11091)
* Python runtime 4.21.10 not works generated code can not load valid proto.
(#11171)
2022-12-07 version 21.11 (C++/Java/Python/PHP/Objective-C/C#/Ruby) 2022-12-07 version 21.11 (C++/Java/Python/PHP/Objective-C/C#/Ruby)
Python Python
* Add license file to pypi wheels (#10936) * Add license file to pypi wheels (#10936)

@ -343,6 +343,7 @@ java_EXTRA_DIST=
java/core/src/main/java/com/google/protobuf/Internal.java \ java/core/src/main/java/com/google/protobuf/Internal.java \
java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java \ java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java \
java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java \ java/core/src/main/java/com/google/protobuf/IterableByteBufferInputStream.java \
java/core/src/main/java/com/google/protobuf/Java8Compatibility.java \
java/core/src/main/java/com/google/protobuf/JavaType.java \ java/core/src/main/java/com/google/protobuf/JavaType.java \
java/core/src/main/java/com/google/protobuf/LazyField.java \ java/core/src/main/java/com/google/protobuf/LazyField.java \
java/core/src/main/java/com/google/protobuf/LazyFieldLite.java \ java/core/src/main/java/com/google/protobuf/LazyFieldLite.java \

@ -1,6 +1,6 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Protobuf-C++' s.name = 'Protobuf-C++'
s.version = '3.21.11' s.version = '3.21.12'
s.summary = 'Protocol Buffers v3 runtime library for C++.' s.summary = 'Protocol Buffers v3 runtime library for C++.'
s.homepage = 'https://github.com/google/protobuf' s.homepage = 'https://github.com/google/protobuf'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'

@ -5,7 +5,7 @@
# dependent projects use the :git notation to refer to the library. # dependent projects use the :git notation to refer to the library.
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Protobuf' s.name = 'Protobuf'
s.version = '3.21.11' s.version = '3.21.12'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.' s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/protocolbuffers/protobuf' s.homepage = 'https://github.com/protocolbuffers/protobuf'
s.license = 'BSD-3-Clause' s.license = 'BSD-3-Clause'

@ -17,7 +17,7 @@ AC_PREREQ(2.59)
# In the SVN trunk, the version should always be the next anticipated release # 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 # 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.) # the size of one file name in the dist tarfile over the 99-char limit.)
AC_INIT([Protocol Buffers],[3.21.11],[protobuf@googlegroups.com],[protobuf]) AC_INIT([Protocol Buffers],[3.21.12],[protobuf@googlegroups.com],[protobuf])
AM_MAINTAINER_MODE([enable]) AM_MAINTAINER_MODE([enable])

@ -5,7 +5,7 @@
<title>Google Protocol Buffers tools</title> <title>Google Protocol Buffers tools</title>
<summary>Tools for Protocol Buffers - Google's data interchange format.</summary> <summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
<description>See project site for more info.</description> <description>See project site for more info.</description>
<version>3.21.11</version> <version>3.21.12</version>
<authors>Google Inc.</authors> <authors>Google Inc.</authors>
<owners>protobuf-packages</owners> <owners>protobuf-packages</owners>
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/main/LICENSE</licenseUrl> <licenseUrl>https://github.com/protocolbuffers/protobuf/blob/main/LICENSE</licenseUrl>

@ -4,7 +4,7 @@
<Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description> <Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description>
<Copyright>Copyright 2015, Google Inc.</Copyright> <Copyright>Copyright 2015, Google Inc.</Copyright>
<AssemblyTitle>Google Protocol Buffers</AssemblyTitle> <AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
<VersionPrefix>3.21.11</VersionPrefix> <VersionPrefix>3.21.12</VersionPrefix>
<!-- C# 7.2 is required for Span/BufferWriter/ReadOnlySequence --> <!-- C# 7.2 is required for Span/BufferWriter/ReadOnlySequence -->
<LangVersion>7.2</LangVersion> <LangVersion>7.2</LangVersion>
<Authors>Google Inc.</Authors> <Authors>Google Inc.</Authors>

@ -23,7 +23,7 @@ If you are using Maven, use the following:
<dependency> <dependency>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId> <artifactId>protobuf-java</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
</dependency> </dependency>
``` ```
@ -37,7 +37,7 @@ protobuf-java-util package:
<dependency> <dependency>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId> <artifactId>protobuf-java-util</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
</dependency> </dependency>
``` ```
@ -45,7 +45,7 @@ protobuf-java-util package:
If you are using Gradle, add the following to your `build.gradle` file's dependencies: If you are using Gradle, add the following to your `build.gradle` file's dependencies:
``` ```
implementation 'com.google.protobuf:protobuf-java:3.21.11' implementation 'com.google.protobuf:protobuf-java:3.21.12'
``` ```
Again, be sure to check that the version number matches (or is newer than) the version number of protoc that you are using. Again, be sure to check that the version number matches (or is newer than) the version number of protoc that you are using.

@ -4,7 +4,7 @@
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-bom</artifactId> <artifactId>protobuf-bom</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Protocol Buffers [BOM]</name> <name>Protocol Buffers [BOM]</name>

@ -49,6 +49,7 @@ LITE_SRCS = [
"src/main/java/com/google/protobuf/Internal.java", "src/main/java/com/google/protobuf/Internal.java",
"src/main/java/com/google/protobuf/InvalidProtocolBufferException.java", "src/main/java/com/google/protobuf/InvalidProtocolBufferException.java",
"src/main/java/com/google/protobuf/IterableByteBufferInputStream.java", "src/main/java/com/google/protobuf/IterableByteBufferInputStream.java",
"src/main/java/com/google/protobuf/Java8Compatibility.java",
"src/main/java/com/google/protobuf/JavaType.java", "src/main/java/com/google/protobuf/JavaType.java",
"src/main/java/com/google/protobuf/LazyField.java", "src/main/java/com/google/protobuf/LazyField.java",
"src/main/java/com/google/protobuf/LazyFieldLite.java", "src/main/java/com/google/protobuf/LazyFieldLite.java",

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId> <artifactId>protobuf-parent</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
</parent> </parent>
<artifactId>protobuf-java</artifactId> <artifactId>protobuf-java</artifactId>

@ -189,7 +189,7 @@ abstract class AllocatedBuffer {
@Override @Override
public AllocatedBuffer position(int position) { public AllocatedBuffer position(int position) {
buffer.position(position); Java8Compatibility.position(buffer, position);
return this; return this;
} }

@ -2019,8 +2019,8 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
buffers.addFirst(allocatedBuffer); buffers.addFirst(allocatedBuffer);
buffer = nioBuffer; buffer = nioBuffer;
buffer.limit(buffer.capacity()); Java8Compatibility.limit(buffer, buffer.capacity());
buffer.position(0); Java8Compatibility.position(buffer, 0);
// Set byte order to little endian for fast writing of fixed 32/64. // Set byte order to little endian for fast writing of fixed 32/64.
buffer.order(ByteOrder.LITTLE_ENDIAN); buffer.order(ByteOrder.LITTLE_ENDIAN);
@ -2046,7 +2046,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
if (buffer != null) { if (buffer != null) {
totalDoneBytes += bytesWrittenToCurrentBuffer(); totalDoneBytes += bytesWrittenToCurrentBuffer();
// Update the indices on the netty buffer. // Update the indices on the netty buffer.
buffer.position(pos + 1); Java8Compatibility.position(buffer, pos + 1);
buffer = null; buffer = null;
pos = 0; pos = 0;
limitMinusOne = 0; limitMinusOne = 0;
@ -2475,7 +2475,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
} }
pos -= length; pos -= length;
buffer.position(pos + 1); Java8Compatibility.position(buffer, pos + 1);
buffer.put(value, offset, length); buffer.put(value, offset, length);
} }
@ -2494,7 +2494,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
} }
pos -= length; pos -= length;
buffer.position(pos + 1); Java8Compatibility.position(buffer, pos + 1);
buffer.put(value, offset, length); buffer.put(value, offset, length);
} }
@ -2506,7 +2506,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
} }
pos -= length; pos -= length;
buffer.position(pos + 1); Java8Compatibility.position(buffer, pos + 1);
buffer.put(value); buffer.put(value);
} }
@ -2526,7 +2526,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
} }
pos -= length; pos -= length;
buffer.position(pos + 1); Java8Compatibility.position(buffer, pos + 1);
buffer.put(value); buffer.put(value);
} }
@ -2576,8 +2576,8 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
buffers.addFirst(allocatedBuffer); buffers.addFirst(allocatedBuffer);
buffer = nioBuffer; buffer = nioBuffer;
buffer.limit(buffer.capacity()); Java8Compatibility.limit(buffer, buffer.capacity());
buffer.position(0); Java8Compatibility.position(buffer, 0);
bufferOffset = UnsafeUtil.addressOffset(buffer); bufferOffset = UnsafeUtil.addressOffset(buffer);
limitMinusOne = bufferOffset + (buffer.limit() - 1); limitMinusOne = bufferOffset + (buffer.limit() - 1);
@ -2602,7 +2602,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
if (buffer != null) { if (buffer != null) {
totalDoneBytes += bytesWrittenToCurrentBuffer(); totalDoneBytes += bytesWrittenToCurrentBuffer();
// Update the indices on the netty buffer. // Update the indices on the netty buffer.
buffer.position(bufferPos() + 1); Java8Compatibility.position(buffer, bufferPos() + 1);
buffer = null; buffer = null;
pos = 0; pos = 0;
limitMinusOne = 0; limitMinusOne = 0;
@ -3016,7 +3016,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
} }
pos -= length; pos -= length;
buffer.position(bufferPos() + 1); Java8Compatibility.position(buffer, bufferPos() + 1);
buffer.put(value, offset, length); buffer.put(value, offset, length);
} }
@ -3035,7 +3035,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
} }
pos -= length; pos -= length;
buffer.position(bufferPos() + 1); Java8Compatibility.position(buffer, bufferPos() + 1);
buffer.put(value, offset, length); buffer.put(value, offset, length);
} }
@ -3047,7 +3047,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
} }
pos -= length; pos -= length;
buffer.position(bufferPos() + 1); Java8Compatibility.position(buffer, bufferPos() + 1);
buffer.put(value); buffer.put(value);
} }
@ -3067,7 +3067,7 @@ abstract class BinaryWriter extends ByteOutput implements Writer {
} }
pos -= length; pos -= length;
buffer.position(bufferPos() + 1); Java8Compatibility.position(buffer, bufferPos() + 1);
buffer.put(value); buffer.put(value);
} }

@ -107,7 +107,7 @@ final class ByteBufferWriter {
} }
} finally { } finally {
// Restore the initial position. // Restore the initial position.
buffer.position(initialPos); Java8Compatibility.position(buffer, initialPos);
} }
} }

@ -1271,7 +1271,7 @@ public abstract class CodedOutputStream extends ByteOutput {
write(value.array(), value.arrayOffset(), value.capacity()); write(value.array(), value.arrayOffset(), value.capacity());
} else { } else {
ByteBuffer duplicated = value.duplicate(); ByteBuffer duplicated = value.duplicate();
duplicated.clear(); Java8Compatibility.clear(duplicated);
write(duplicated); write(duplicated);
} }
} }
@ -1522,7 +1522,7 @@ public abstract class CodedOutputStream extends ByteOutput {
@Override @Override
public void flush() { public void flush() {
// Update the position on the buffer. // Update the position on the buffer.
byteBuffer.position(initialPosition + getTotalBytesWritten()); Java8Compatibility.position(byteBuffer, initialPosition + getTotalBytesWritten());
} }
} }
@ -1684,7 +1684,7 @@ public abstract class CodedOutputStream extends ByteOutput {
write(value.array(), value.arrayOffset(), value.capacity()); write(value.array(), value.arrayOffset(), value.capacity());
} else { } else {
ByteBuffer duplicated = value.duplicate(); ByteBuffer duplicated = value.duplicate();
duplicated.clear(); Java8Compatibility.clear(duplicated);
write(duplicated); write(duplicated);
} }
} }
@ -1794,18 +1794,18 @@ public abstract class CodedOutputStream extends ByteOutput {
// Save the current position and increment past the length field. We'll come back // Save the current position and increment past the length field. We'll come back
// and write the length field after the encoding is complete. // and write the length field after the encoding is complete.
final int startOfBytes = buffer.position() + minLengthVarIntSize; final int startOfBytes = buffer.position() + minLengthVarIntSize;
buffer.position(startOfBytes); Java8Compatibility.position(buffer, startOfBytes);
// Encode the string. // Encode the string.
encode(value); encode(value);
// Now go back to the beginning and write the length. // Now go back to the beginning and write the length.
int endOfBytes = buffer.position(); int endOfBytes = buffer.position();
buffer.position(startPos); Java8Compatibility.position(buffer, startPos);
writeUInt32NoTag(endOfBytes - startOfBytes); writeUInt32NoTag(endOfBytes - startOfBytes);
// Reposition the buffer past the written data. // Reposition the buffer past the written data.
buffer.position(endOfBytes); Java8Compatibility.position(buffer, endOfBytes);
} else { } else {
final int length = Utf8.encodedLength(value); final int length = Utf8.encodedLength(value);
writeUInt32NoTag(length); writeUInt32NoTag(length);
@ -1813,7 +1813,7 @@ public abstract class CodedOutputStream extends ByteOutput {
} }
} catch (UnpairedSurrogateException e) { } catch (UnpairedSurrogateException e) {
// Roll back the change and convert to an IOException. // Roll back the change and convert to an IOException.
buffer.position(startPos); Java8Compatibility.position(buffer, startPos);
// TODO(nathanmittler): We should throw an IOException here instead. // TODO(nathanmittler): We should throw an IOException here instead.
inefficientWriteStringNoTag(value, e); inefficientWriteStringNoTag(value, e);
@ -1826,7 +1826,7 @@ public abstract class CodedOutputStream extends ByteOutput {
@Override @Override
public void flush() { public void flush() {
// Update the position of the original buffer. // Update the position of the original buffer.
originalBuffer.position(buffer.position()); Java8Compatibility.position(originalBuffer, buffer.position());
} }
@Override @Override
@ -2014,7 +2014,7 @@ public abstract class CodedOutputStream extends ByteOutput {
write(value.array(), value.arrayOffset(), value.capacity()); write(value.array(), value.arrayOffset(), value.capacity());
} else { } else {
ByteBuffer duplicated = value.duplicate(); ByteBuffer duplicated = value.duplicate();
duplicated.clear(); Java8Compatibility.clear(duplicated);
write(duplicated); write(duplicated);
} }
} }
@ -2150,7 +2150,7 @@ public abstract class CodedOutputStream extends ByteOutput {
// Save the current position and increment past the length field. We'll come back // Save the current position and increment past the length field. We'll come back
// and write the length field after the encoding is complete. // and write the length field after the encoding is complete.
int stringStart = bufferPos(position) + minLengthVarIntSize; int stringStart = bufferPos(position) + minLengthVarIntSize;
buffer.position(stringStart); Java8Compatibility.position(buffer, stringStart);
// Encode the string. // Encode the string.
Utf8.encodeUtf8(value, buffer); Utf8.encodeUtf8(value, buffer);
@ -2187,7 +2187,7 @@ public abstract class CodedOutputStream extends ByteOutput {
@Override @Override
public void flush() { public void flush() {
// Update the position of the original buffer. // Update the position of the original buffer.
originalBuffer.position(bufferPos(position)); Java8Compatibility.position(originalBuffer, bufferPos(position));
} }
@Override @Override
@ -2201,7 +2201,7 @@ public abstract class CodedOutputStream extends ByteOutput {
} }
private void repositionBuffer(long pos) { private void repositionBuffer(long pos) {
buffer.position(bufferPos(pos)); Java8Compatibility.position(buffer, bufferPos(pos));
} }
private int bufferPos(long pos) { private int bufferPos(long pos) {
@ -2478,7 +2478,7 @@ public abstract class CodedOutputStream extends ByteOutput {
write(value.array(), value.arrayOffset(), value.capacity()); write(value.array(), value.arrayOffset(), value.capacity());
} else { } else {
ByteBuffer duplicated = value.duplicate(); ByteBuffer duplicated = value.duplicate();
duplicated.clear(); Java8Compatibility.clear(duplicated);
write(duplicated); write(duplicated);
} }
} }
@ -2792,7 +2792,7 @@ public abstract class CodedOutputStream extends ByteOutput {
write(value.array(), value.arrayOffset(), value.capacity()); write(value.array(), value.arrayOffset(), value.capacity());
} else { } else {
ByteBuffer duplicated = value.duplicate(); ByteBuffer duplicated = value.duplicate();
duplicated.clear(); Java8Compatibility.clear(duplicated);
write(duplicated); write(duplicated);
} }
} }

@ -313,7 +313,11 @@ public final class Internal {
} }
// ByteBuffer.equals() will only compare the remaining bytes, but we want to // ByteBuffer.equals() will only compare the remaining bytes, but we want to
// compare all the content. // compare all the content.
return a.duplicate().clear().equals(b.duplicate().clear()); ByteBuffer aDuplicate = a.duplicate();
Java8Compatibility.clear(aDuplicate);
ByteBuffer bDuplicate = b.duplicate();
Java8Compatibility.clear(bDuplicate);
return aDuplicate.equals(bDuplicate);
} }
/** Helper method for implementing {@link Message#equals(Object)} for bytes field. */ /** Helper method for implementing {@link Message#equals(Object)} for bytes field. */
@ -353,7 +357,7 @@ public final class Internal {
bytes.capacity() > DEFAULT_BUFFER_SIZE ? DEFAULT_BUFFER_SIZE : bytes.capacity(); bytes.capacity() > DEFAULT_BUFFER_SIZE ? DEFAULT_BUFFER_SIZE : bytes.capacity();
final byte[] buffer = new byte[bufferSize]; final byte[] buffer = new byte[bufferSize];
final ByteBuffer duplicated = bytes.duplicate(); final ByteBuffer duplicated = bytes.duplicate();
duplicated.clear(); Java8Compatibility.clear(duplicated);
int h = bytes.capacity(); int h = bytes.capacity();
while (duplicated.remaining() > 0) { while (duplicated.remaining() > 0) {
final int length = final int length =

@ -140,9 +140,9 @@ class IterableByteBufferInputStream extends InputStream {
updateCurrentByteBufferPos(length); updateCurrentByteBufferPos(length);
} else { } else {
int prevPos = currentByteBuffer.position(); int prevPos = currentByteBuffer.position();
currentByteBuffer.position(currentByteBufferPos); Java8Compatibility.position(currentByteBuffer, currentByteBufferPos);
currentByteBuffer.get(output, offset, length); currentByteBuffer.get(output, offset, length);
currentByteBuffer.position(prevPos); Java8Compatibility.position(currentByteBuffer, prevPos);
updateCurrentByteBufferPos(length); updateCurrentByteBufferPos(length);
} }
return length; return length;

@ -0,0 +1,67 @@
// 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 java.nio.Buffer;
/**
* Wrappers around {@link Buffer} methods that are covariantly overridden in Java 9+. See
* https://github.com/protocolbuffers/protobuf/issues/11393
*
* <p>TODO(b/270454719) remove when Java 8 support is no longer needed.
*/
final class Java8Compatibility {
static void clear(Buffer b) {
b.clear();
}
static void flip(Buffer b) {
b.flip();
}
static void limit(Buffer b, int limit) {
b.limit(limit);
}
static void mark(Buffer b) {
b.mark();
}
static void position(Buffer b, int position) {
b.position(position);
}
static void reset(Buffer b) {
b.reset();
}
private Java8Compatibility() {}
}

@ -5510,6 +5510,12 @@ final class MessageSchema<T> implements Schema<T> {
getMessageFieldSchema(pos).makeImmutable(UNSAFE.getObject(message, offset)); getMessageFieldSchema(pos).makeImmutable(UNSAFE.getObject(message, offset));
} }
break; break;
case 60: // ONEOF_MESSAGE
case 68: // ONEOF_GROUP
if (isOneofPresent(message, numberAt(pos), pos)) {
getMessageFieldSchema(pos).makeImmutable(UNSAFE.getObject(message, offset));
}
break;
case 18: // DOUBLE_LIST: case 18: // DOUBLE_LIST:
case 19: // FLOAT_LIST: case 19: // FLOAT_LIST:
case 20: // INT64_LIST: case 20: // INT64_LIST:

@ -37,7 +37,6 @@ import java.io.InputStream;
import java.io.InvalidObjectException; import java.io.InvalidObjectException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.nio.Buffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.ByteOrder; import java.nio.ByteOrder;
import java.nio.InvalidMarkException; import java.nio.InvalidMarkException;
@ -110,7 +109,7 @@ final class NioByteString extends ByteString.LeafByteString {
protected void copyToInternal( protected void copyToInternal(
byte[] target, int sourceOffset, int targetOffset, int numberToCopy) { byte[] target, int sourceOffset, int targetOffset, int numberToCopy) {
ByteBuffer slice = buffer.slice(); ByteBuffer slice = buffer.slice();
((Buffer) slice).position(sourceOffset); Java8Compatibility.position(slice, sourceOffset);
slice.get(target, targetOffset, numberToCopy); slice.get(target, targetOffset, numberToCopy);
} }
@ -224,7 +223,7 @@ final class NioByteString extends ByteString.LeafByteString {
@Override @Override
public void mark(int readlimit) { public void mark(int readlimit) {
buf.mark(); Java8Compatibility.mark(buf);
} }
@Override @Override
@ -235,7 +234,7 @@ final class NioByteString extends ByteString.LeafByteString {
@Override @Override
public void reset() throws IOException { public void reset() throws IOException {
try { try {
buf.reset(); Java8Compatibility.reset(buf);
} catch (InvalidMarkException e) { } catch (InvalidMarkException e) {
throw new IOException(e); throw new IOException(e);
} }
@ -286,8 +285,8 @@ final class NioByteString extends ByteString.LeafByteString {
} }
ByteBuffer slice = buffer.slice(); ByteBuffer slice = buffer.slice();
((Buffer) slice).position(beginIndex - buffer.position()); Java8Compatibility.position(slice, beginIndex - buffer.position());
((Buffer) slice).limit(endIndex - buffer.position()); Java8Compatibility.limit(slice, endIndex - buffer.position());
return slice; return slice;
} }
} }

@ -1717,7 +1717,7 @@ public final class TextFormat {
if (n == -1) { if (n == -1) {
break; break;
} }
buffer.flip(); Java8Compatibility.flip(buffer);
text.append(buffer, 0, n); text.append(buffer, 0, n);
} }
return text; return text;

@ -770,7 +770,7 @@ final class Utf8 {
if (out.hasArray()) { if (out.hasArray()) {
final int offset = out.arrayOffset(); final int offset = out.arrayOffset();
int endIndex = Utf8.encode(in, out.array(), offset + out.position(), out.remaining()); int endIndex = Utf8.encode(in, out.array(), offset + out.position(), out.remaining());
out.position(endIndex - offset); Java8Compatibility.position(out, endIndex - offset);
} else if (out.isDirect()) { } else if (out.isDirect()) {
encodeUtf8Direct(in, out); encodeUtf8Direct(in, out);
} else { } else {
@ -801,7 +801,7 @@ final class Utf8 {
} }
if (inIx == inLength) { if (inIx == inLength) {
// Successfully encoded the entire string. // Successfully encoded the entire string.
out.position(outIx + inIx); Java8Compatibility.position(out, outIx + inIx);
return; return;
} }
@ -844,7 +844,7 @@ final class Utf8 {
} }
// Successfully encoded the entire string. // Successfully encoded the entire string.
out.position(outIx); Java8Compatibility.position(out, outIx);
} catch (IndexOutOfBoundsException e) { } catch (IndexOutOfBoundsException e) {
// TODO(nathanmittler): Consider making the API throw IndexOutOfBoundsException instead. // TODO(nathanmittler): Consider making the API throw IndexOutOfBoundsException instead.
@ -1545,7 +1545,7 @@ final class Utf8 {
} }
if (inIx == inLimit) { if (inIx == inLimit) {
// We're done, it was ASCII encoded. // We're done, it was ASCII encoded.
out.position((int) (outIx - address)); Java8Compatibility.position(out, (int) (outIx - address));
return; return;
} }
@ -1585,7 +1585,7 @@ final class Utf8 {
} }
// All bytes have been encoded. // All bytes have been encoded.
out.position((int) (outIx - address)); Java8Compatibility.position(out, (int) (outIx - address));
} }
/** /**

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId> <artifactId>protobuf-parent</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
</parent> </parent>
<artifactId>protobuf-kotlin-lite</artifactId> <artifactId>protobuf-kotlin-lite</artifactId>

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId> <artifactId>protobuf-parent</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
</parent> </parent>
<artifactId>protobuf-kotlin</artifactId> <artifactId>protobuf-kotlin</artifactId>

@ -29,7 +29,7 @@ protobuf Java Lite runtime. If you are using Maven, include the following:
<dependency> <dependency>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-javalite</artifactId> <artifactId>protobuf-javalite</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
</dependency> </dependency>
``` ```

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId> <artifactId>protobuf-parent</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
</parent> </parent>
<artifactId>protobuf-javalite</artifactId> <artifactId>protobuf-javalite</artifactId>
@ -125,6 +125,7 @@
<include>Internal.java</include> <include>Internal.java</include>
<include>InvalidProtocolBufferException.java</include> <include>InvalidProtocolBufferException.java</include>
<include>IterableByteBufferInputStream.java</include> <include>IterableByteBufferInputStream.java</include>
<include>Java8Compatibility.java</include>
<include>JavaType.java</include> <include>JavaType.java</include>
<include>LazyField.java</include> <include>LazyField.java</include>
<include>LazyFieldLite.java</include> <include>LazyFieldLite.java</include>

@ -189,6 +189,18 @@ public class LiteTest {
} }
} }
@Test
public void testParsedOneofSubMessageIsImmutable() throws InvalidProtocolBufferException {
TestAllTypesLite message =
TestAllTypesLite.parseFrom(
TestAllTypesLite.newBuilder()
.setOneofNestedMessage(NestedMessage.newBuilder().addDd(1234).build())
.build()
.toByteArray());
IntArrayList subList = (IntArrayList) message.getOneofNestedMessage().getDdList();
assertThat(subList.isModifiable()).isFalse();
}
@Test @Test
public void testMemoization() throws Exception { public void testMemoization() throws Exception {
GeneratedMessageLite<?, ?> message = TestUtilLite.getAllLiteExtensionsSet(); GeneratedMessageLite<?, ?> message = TestUtilLite.getAllLiteExtensionsSet();
@ -2349,8 +2361,7 @@ public class LiteTest {
Foo fooWithOnlyValue = Foo.newBuilder().setValue(1).build(); Foo fooWithOnlyValue = Foo.newBuilder().setValue(1).build();
Foo fooWithValueAndExtension = Foo fooWithValueAndExtension =
fooWithOnlyValue fooWithOnlyValue.toBuilder()
.toBuilder()
.setValue(1) .setValue(1)
.setExtension(Bar.fooExt, Bar.newBuilder().setName("name").build()) .setExtension(Bar.fooExt, Bar.newBuilder().setName("name").build())
.build(); .build();
@ -2366,8 +2377,7 @@ public class LiteTest {
Foo fooWithOnlyValue = Foo.newBuilder().setValue(1).build(); Foo fooWithOnlyValue = Foo.newBuilder().setValue(1).build();
Foo fooWithValueAndExtension = Foo fooWithValueAndExtension =
fooWithOnlyValue fooWithOnlyValue.toBuilder()
.toBuilder()
.setValue(1) .setValue(1)
.setExtension(Bar.fooExt, Bar.newBuilder().setName("name").build()) .setExtension(Bar.fooExt, Bar.newBuilder().setName("name").build())
.build(); .build();
@ -2499,9 +2509,9 @@ public class LiteTest {
assertWithMessage("expected exception").fail(); assertWithMessage("expected exception").fail();
} catch (InvalidProtocolBufferException expected) { } catch (InvalidProtocolBufferException expected) {
assertThat( assertThat(
TestAllExtensionsLite.newBuilder() TestAllExtensionsLite.newBuilder()
.setExtension(UnittestLite.optionalInt32ExtensionLite, 123) .setExtension(UnittestLite.optionalInt32ExtensionLite, 123)
.build()) .build())
.isEqualTo(expected.getUnfinishedMessage()); .isEqualTo(expected.getUnfinishedMessage());
} }
} }

@ -4,7 +4,7 @@
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId> <artifactId>protobuf-parent</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Protocol Buffers [Parent]</name> <name>Protocol Buffers [Parent]</name>

@ -4,7 +4,7 @@
<parent> <parent>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId> <artifactId>protobuf-parent</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
</parent> </parent>
<artifactId>protobuf-java-util</artifactId> <artifactId>protobuf-java-util</artifactId>

@ -26,7 +26,6 @@ export CXX=g++
## ##
# Install Python 2 by default # Install Python 2 by default
eval "$(pyenv init -)" eval "$(pyenv init -)"
pyenv install -v -s 2.7.18 && pyenv global 2.7.18 pyenv install -v -s 2.7.18 && pyenv global 2.7.18
@ -34,6 +33,9 @@ pyenv install -v -s 2.7.18 && pyenv global 2.7.18
# Install Tox # Install Tox
if [[ "${KOKORO_INSTALL_TOX:-}" == "yes" ]] ; then if [[ "${KOKORO_INSTALL_TOX:-}" == "yes" ]] ; then
# pyenv needs to be directed towards its dependencies.
CFLAGS="-I$(brew --prefix zlib)/include" \
LDFLAGS="-L$(brew --prefix zlib)/lib" \
pyenv install -v -s 3.7.13 pyenv install -v -s 3.7.13
pyenv global 3.7.13 pyenv global 3.7.13
sudo python -m pip install --upgrade pip 'tox==3.27.1' tox-pyenv sudo python -m pip install --upgrade pip 'tox==3.27.1' tox-pyenv

@ -6,6 +6,7 @@ set -ex
cd $(dirname $0)/../.. cd $(dirname $0)/../..
# Initialize any submodules. # Initialize any submodules.
git config --global --add safe.directory '*'
git submodule update --init --recursive git submodule update --init --recursive
# The directory with all resulting artifacts # The directory with all resulting artifacts
@ -23,40 +24,3 @@ ls -R ${INPUT_ARTIFACTS_DIR}
# TODO(jtattermusch): the directory layout of the artifact builds is pretty messy, # TODO(jtattermusch): the directory layout of the artifact builds is pretty messy,
# so will be the output artifacts of this job. # so will be the output artifacts of this job.
cp -r ${INPUT_ARTIFACTS_DIR}/* artifacts cp -r ${INPUT_ARTIFACTS_DIR}/* artifacts
# ====================================
# Build Google.Protobuf.Tools C# nuget
# The reason it's being done in this script is that we need access to protoc binaries
# built on multiple platform (the build is performed by the "build artifact" step)
# and adding and extra chained build just for building the Google.Protobuf.Tools
# nuget seems like an overkill.
cd csharp
mkdir -p protoc/windows_x86
mkdir -p protoc/windows_x64
cp ${INPUT_ARTIFACTS_DIR}/build32/Release/protoc.exe protoc/windows_x86/protoc.exe
cp ${INPUT_ARTIFACTS_DIR}/build64/Release/protoc.exe protoc/windows_x64/protoc.exe
mkdir -p protoc/linux_x86
mkdir -p protoc/linux_x64
# Because of maven unrelated reasonse the linux protoc binaries have a dummy .exe extension.
# For the Google.Protobuf.Tools nuget, we don't want that exception, so we just remove it.
cp ${INPUT_ARTIFACTS_DIR}/protoc-artifacts/target/linux/x86_32/protoc.exe protoc/linux_x86/protoc
cp ${INPUT_ARTIFACTS_DIR}/protoc-artifacts/target/linux/x86_64/protoc.exe protoc/linux_x64/protoc
mkdir -p protoc/macosx_x64
cp ${INPUT_ARTIFACTS_DIR}/build64/src/protoc protoc/macosx_x64/protoc
# Install nuget (will also install mono)
# TODO(jtattermusch): use "mono:5.14" docker image instead so we don't have to apt-get install
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
# NVidia has stopped publishing Cuda packages for Ubuntu 16.04, so we need to
# delete this file to allow the apt update to run successfully.
sudo rm -f /etc/apt/sources.list.d/cuda.list
sudo apt update
sudo apt-get install -y nuget
nuget pack Google.Protobuf.Tools.nuspec
# Copy the nupkg to the output artifacts
cp Google.Protobuf.Tools.*.nupkg ../artifacts

@ -8,6 +8,9 @@ brew uninstall -f protobuf
# change to repo root # change to repo root
pushd $(dirname $0)/../../../.. pushd $(dirname $0)/../../../..
chmod ugo+x ${KOKORO_GFILE_DIR}/use_bazel.sh
${KOKORO_GFILE_DIR}/use_bazel.sh 5.1.1
# Create stage dir # Create stage dir
ORIGINAL_DIR=`pwd` ORIGINAL_DIR=`pwd`
pushd .. pushd ..

@ -6,3 +6,5 @@ action {
regex: "github/protobuf/artifacts/**" regex: "github/protobuf/artifacts/**"
} }
} }
gfile_resources: "/google_src/files/head/depot/google3/devtools/kokoro/vanadium/linux_scripts/usr/local/bin/use_bazel.sh"

@ -6,3 +6,5 @@ action {
regex: "github/protobuf/artifacts/**" regex: "github/protobuf/artifacts/**"
} }
} }
gfile_resources: "/google_src/files/head/depot/google3/devtools/kokoro/vanadium/linux_scripts/usr/local/bin/use_bazel.sh"

@ -6,3 +6,5 @@ action {
regex: "github/protobuf/artifacts/**" regex: "github/protobuf/artifacts/**"
} }
} }
gfile_resources: "/google_src/files/head/depot/google3/devtools/kokoro/vanadium/linux_scripts/usr/local/bin/use_bazel.sh"

@ -1,10 +1,13 @@
#!/bin/bash #!/bin/bash
set -ex set -ex
# change to repo root # change to repo root
cd $(dirname $0)/../../../.. cd $(dirname $0)/../../../..
chmod ugo+x ${KOKORO_GFILE_DIR}/use_bazel.sh
${KOKORO_GFILE_DIR}/use_bazel.sh 5.1.1
# all artifacts come here # all artifacts come here
mkdir artifacts mkdir artifacts
export ARTIFACT_DIR=$(pwd)/artifacts export ARTIFACT_DIR=$(pwd)/artifacts

@ -6,3 +6,5 @@ action {
regex: "github/protobuf/artifacts/**" regex: "github/protobuf/artifacts/**"
} }
} }
gfile_resources: "/google_src/files/head/depot/google3/devtools/kokoro/vanadium/linux_scripts/usr/local/bin/use_bazel.sh"

@ -6,3 +6,5 @@ action {
regex: "github/protobuf/artifacts/**" regex: "github/protobuf/artifacts/**"
} }
} }
gfile_resources: "/google_src/files/head/depot/google3/devtools/kokoro/vanadium/linux_scripts/usr/local/bin/use_bazel.sh"

@ -6,3 +6,5 @@ action {
regex: "github/protobuf/artifacts/**" regex: "github/protobuf/artifacts/**"
} }
} }
gfile_resources: "/google_src/files/head/depot/google3/devtools/kokoro/vanadium/linux_scripts/usr/local/bin/use_bazel.sh"

@ -21,11 +21,11 @@ set -e # rvm commands are very verbose
time rvm install 2.5.0 time rvm install 2.5.0
rvm use 2.5.0 rvm use 2.5.0
gem install rake-compiler --no-document gem install rake-compiler --no-document
gem install bundler -v 2.4.22 --no-document gem install bundler -v 2.3.26 --no-document
time rvm install 3.1.0 time rvm install 3.1.0
rvm use 3.1.0 rvm use 3.1.0
gem install rake-compiler --no-document gem install rake-compiler --no-document
gem install bundler -v 2.4.22 --no-document gem install bundler --no-document
time rvm install 2.7.0 time rvm install 2.7.0
rvm use 2.7.0 --default rvm use 2.7.0 --default
gem install rake-compiler --no-document gem install rake-compiler --no-document

@ -6143,7 +6143,6 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New(
google_protobuf_EnumDescriptorProto_EnumReservedRange_start(protos[i]); google_protobuf_EnumDescriptorProto_EnumReservedRange_start(protos[i]);
const int32_t end = const int32_t end =
google_protobuf_EnumDescriptorProto_EnumReservedRange_end(protos[i]); google_protobuf_EnumDescriptorProto_EnumReservedRange_end(protos[i]);
const int32_t max = kUpb_MaxFieldNumber + 1;
// A full validation would also check that each range is disjoint, and that // A full validation would also check that each range is disjoint, and that
// none of the fields overlap with the extension ranges, but we are just // none of the fields overlap with the extension ranges, but we are just
@ -6151,7 +6150,7 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New(
// Note: Not a typo! Unlike extension ranges and message reserved ranges, // Note: Not a typo! Unlike extension ranges and message reserved ranges,
// the end value of an enum reserved range is *inclusive*! // the end value of an enum reserved range is *inclusive*!
if (start < 1 || end < start || end > max) { if (end < start) {
symtab_errf(ctx, "Reserved range (%d, %d) is invalid, enum=%s\n", symtab_errf(ctx, "Reserved range (%d, %d) is invalid, enum=%s\n",
(int)start, (int)end, upb_EnumDef_FullName(e)); (int)start, (int)end, upb_EnumDef_FullName(e));
} }
@ -8184,7 +8183,7 @@ static void create_fielddef(
CHK_OOM( CHK_OOM(
upb_strtable_insert(&oneof->ntof, name.data, name.size, v, ctx->arena)); upb_strtable_insert(&oneof->ntof, name.data, name.size, v, ctx->arena));
} else { } else {
if (f->proto3_optional_) { if (f->proto3_optional_ && !is_extension) {
symtab_errf(ctx, "field with proto3_optional was not in a oneof (%s)", symtab_errf(ctx, "field with proto3_optional was not in a oneof (%s)",
f->full_name); f->full_name);
} }

@ -127,7 +127,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setter, 0, 0, 1)
ZEND_ARG_INFO(0, value) ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO() ZEND_END_ARG_INFO()
#define PHP_PROTOBUF_VERSION "3.21.11" #define PHP_PROTOBUF_VERSION "3.21.12"
// ptr -> PHP object cache. This is a weak map that caches lazily-created // ptr -> PHP object cache. This is a weak map that caches lazily-created
// wrapper objects around upb types: // wrapper objects around upb types:

@ -117,6 +117,6 @@ def protobuf_deps():
_github_archive( _github_archive(
name = "upb", name = "upb",
repo = "https://github.com/protocolbuffers/upb", repo = "https://github.com/protocolbuffers/upb",
commit = "969f6fdb88e94ced87953e53716893c68ec7b1ce", commit = "20b542a767139732548f7b8cf28c4c928cdcb07b",
sha256 = "6754b7f95c92f69a832a82931aea40d066cc689dbc1eb3348b84c1ed95285296", sha256 = "c77158955326f9e9a0cf8481c118b8ad5c34df99e5db3af27f3d1662d8bedef7",
) )

@ -1,4 +1,4 @@
PROTOC_VERSION = "21.11" PROTOC_VERSION = "21.12"
PROTOBUF_JAVA_VERSION = "3.21.11" PROTOBUF_JAVA_VERSION = "3.21.12"
PROTOBUF_PYTHON_VERSION = "4.21.11" PROTOBUF_PYTHON_VERSION = "4.21.12"
PROTOBUF_PHP_VERSION = "3.21.11" PROTOBUF_PHP_VERSION = "3.21.12"

@ -8,7 +8,7 @@
</parent> </parent>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protoc</artifactId> <artifactId>protoc</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>Protobuf Compiler</name> <name>Protobuf Compiler</name>
<description> <description>

@ -30,4 +30,4 @@
# Copyright 2007 Google Inc. All Rights Reserved. # Copyright 2007 Google Inc. All Rights Reserved.
__version__ = '4.21.11' __version__ = '4.21.12'

@ -5814,7 +5814,6 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New(
google_protobuf_EnumDescriptorProto_EnumReservedRange_start(protos[i]); google_protobuf_EnumDescriptorProto_EnumReservedRange_start(protos[i]);
const int32_t end = const int32_t end =
google_protobuf_EnumDescriptorProto_EnumReservedRange_end(protos[i]); google_protobuf_EnumDescriptorProto_EnumReservedRange_end(protos[i]);
const int32_t max = kUpb_MaxFieldNumber + 1;
// A full validation would also check that each range is disjoint, and that // A full validation would also check that each range is disjoint, and that
// none of the fields overlap with the extension ranges, but we are just // none of the fields overlap with the extension ranges, but we are just
@ -5822,7 +5821,7 @@ upb_EnumReservedRange* _upb_EnumReservedRanges_New(
// Note: Not a typo! Unlike extension ranges and message reserved ranges, // Note: Not a typo! Unlike extension ranges and message reserved ranges,
// the end value of an enum reserved range is *inclusive*! // the end value of an enum reserved range is *inclusive*!
if (start < 1 || end < start || end > max) { if (end < start) {
symtab_errf(ctx, "Reserved range (%d, %d) is invalid, enum=%s\n", symtab_errf(ctx, "Reserved range (%d, %d) is invalid, enum=%s\n",
(int)start, (int)end, upb_EnumDef_FullName(e)); (int)start, (int)end, upb_EnumDef_FullName(e));
} }
@ -7855,7 +7854,7 @@ static void create_fielddef(
CHK_OOM( CHK_OOM(
upb_strtable_insert(&oneof->ntof, name.data, name.size, v, ctx->arena)); upb_strtable_insert(&oneof->ntof, name.data, name.size, v, ctx->arena));
} else { } else {
if (f->proto3_optional_) { if (f->proto3_optional_ && !is_extension) {
symtab_errf(ctx, "field with proto3_optional was not in a oneof (%s)", symtab_errf(ctx, "field with proto3_optional was not in a oneof (%s)",
f->full_name); f->full_name);
} }

@ -1,6 +1,6 @@
Gem::Specification.new do |s| Gem::Specification.new do |s|
s.name = "google-protobuf" s.name = "google-protobuf"
s.version = "3.21.11" s.version = "3.21.12"
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 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.licenses = ["BSD-3-Clause"]
s.summary = "Protocol Buffers" s.summary = "Protocol Buffers"

@ -9,7 +9,7 @@
<groupId>com.google.protobuf.jruby</groupId> <groupId>com.google.protobuf.jruby</groupId>
<artifactId>protobuf-jruby</artifactId> <artifactId>protobuf-jruby</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
<name>Protocol Buffer JRuby native extension</name> <name>Protocol Buffer JRuby native extension</name>
<description> <description>
Protocol Buffers are a way of encoding structured data in an efficient yet Protocol Buffers are a way of encoding structured data in an efficient yet
@ -76,7 +76,7 @@
<dependency> <dependency>
<groupId>com.google.protobuf</groupId> <groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId> <artifactId>protobuf-java-util</artifactId>
<version>3.21.11</version> <version>3.21.12</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.jruby</groupId> <groupId>org.jruby</groupId>

@ -13,7 +13,8 @@ test_version() {
"rvm install $version && rvm use $version && rvm get head && \ "rvm install $version && rvm use $version && rvm get head && \
which ruby && \ which ruby && \
git clean -f && \ git clean -f && \
gem install --no-document bundler && bundle && \ gem install --no-document bundler -v 2.3.26 && \ # Pin to bundler with ruby 2.5
bundle && \
rake test && \ rake test && \
rake gc_test && \ rake gc_test && \
cd ../conformance && make test_jruby && \ cd ../conformance && make test_jruby && \

@ -18,7 +18,7 @@ else
PTHREAD_DEF = PTHREAD_DEF =
endif endif
PROTOBUF_VERSION = 32:11:0 PROTOBUF_VERSION = 32:12:0
if GCC if GCC
# Turn on all warnings except for sign comparison (we ignore sign comparison # Turn on all warnings except for sign comparison (we ignore sign comparison

@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3021011 < PROTOBUF_MIN_PROTOC_VERSION #if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3021011 < PROTOBUF_MIN_PROTOC_VERSION #if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3021011 < PROTOBUF_MIN_PROTOC_VERSION #if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3021011 < PROTOBUF_MIN_PROTOC_VERSION #if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3021011 < PROTOBUF_MIN_PROTOC_VERSION #if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3021011 < PROTOBUF_MIN_PROTOC_VERSION #if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3021011 < PROTOBUF_MIN_PROTOC_VERSION #if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

@ -178,7 +178,7 @@
#ifdef PROTOBUF_VERSION #ifdef PROTOBUF_VERSION
#error PROTOBUF_VERSION was previously defined #error PROTOBUF_VERSION was previously defined
#endif #endif
#define PROTOBUF_VERSION 3021011 #define PROTOBUF_VERSION 3021012
#ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC #ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC
#error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined #error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined
@ -879,13 +879,45 @@
#undef DEBUG #undef DEBUG
#endif // defined(__clang__) || PROTOBUF_GNUC_MIN(3, 0) || defined(_MSC_VER) #endif // defined(__clang__) || PROTOBUF_GNUC_MIN(3, 0) || defined(_MSC_VER)
#if PROTOBUF_GNUC_MIN(3, 0) // Protobuf does not support building with a number of warnings that are noisy
// (and of variable quality across compiler versions) or impossible to implement
// effectively but which people turn on anyways.
#ifdef __clang__
#pragma clang diagnostic push
// -Wshorten-64-to-32 is a typical pain where we diff pointers.
// char* p = strchr(s, '\n');
// return p ? p - s : -1;
#pragma clang diagnostic ignored "-Wshorten-64-to-32"
// Turn on -Wdeprecated-enum-enum-conversion. This deprecation comes in C++20
// via http://wg21.link/p1120r0.
#pragma clang diagnostic error "-Wdeprecated-enum-enum-conversion"
// This error has been generally flaky, but we need to disable it specifically
// to fix https://github.com/protocolbuffers/protobuf/issues/12313
#pragma clang diagnostic ignored "-Wunused-parameter"
#endif
#ifdef __GNUC__
#pragma GCC diagnostic push
// Some of the warnings below only exist in some GCC versions; those version
// ranges are poorly documented.
#pragma GCC diagnostic ignored "-Wpragmas"
// GCC does not allow disabling diagnostics within an expression: // GCC does not allow disabling diagnostics within an expression:
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60875, so we disable this one // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60875, so we disable this one
// globally even though it's only used for PROTOBUF_FIELD_OFFSET. // globally even though it's only used for PROTOBUF_FIELD_OFFSET.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Winvalid-offsetof" #pragma GCC diagnostic ignored "-Winvalid-offsetof"
#endif // Some versions of GCC seem to think that
// [this] { Foo(); }
// leaves `this` unused, even though `Foo();` is a member function of the
// captured `this`.
// https://bugzilla.mozilla.org/show_bug.cgi?id=1373625
#pragma GCC diagnostic ignored "-Wunused-lambda-capture"
// -Wsign-conversion causes a lot of warnings on mostly code like:
// int index = ...
// int value = vec[index];
#pragma GCC diagnostic ignored "-Wsign-conversion"
// This error has been generally flaky, but we need to disable it specifically
// to fix https://github.com/protocolbuffers/protobuf/issues/12313
#pragma GCC diagnostic ignored "-Wunused-parameter"
#endif // __GNUC__
// Silence some MSVC warnings in all our code. // Silence some MSVC warnings in all our code.
#ifdef _MSC_VER #ifdef _MSC_VER

@ -154,6 +154,10 @@
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
#ifdef __clang__
#pragma clang diagnostic pop
#endif
// Pop the warning(push) from port_def.inc // Pop the warning(push) from port_def.inc
#ifdef _MSC_VER #ifdef _MSC_VER
#pragma warning(pop) #pragma warning(pop)

@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3021011 < PROTOBUF_MIN_PROTOC_VERSION #if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3021011 < PROTOBUF_MIN_PROTOC_VERSION #if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

@ -82,7 +82,7 @@ namespace internal {
// The current version, represented as a single integer to make comparison // The current version, represented as a single integer to make comparison
// easier: major * 10^6 + minor * 10^3 + micro // easier: major * 10^6 + minor * 10^3 + micro
#define GOOGLE_PROTOBUF_VERSION 3021011 #define GOOGLE_PROTOBUF_VERSION 3021012
// A suffix string for alpha, beta or rc releases. Empty for stable releases. // A suffix string for alpha, beta or rc releases. Empty for stable releases.
#define GOOGLE_PROTOBUF_VERSION_SUFFIX "" #define GOOGLE_PROTOBUF_VERSION_SUFFIX ""

@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3021011 < PROTOBUF_MIN_PROTOC_VERSION #if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3021011 < PROTOBUF_MIN_PROTOC_VERSION #if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

@ -47,6 +47,7 @@ message TestAllTypesLite {
message NestedMessage { message NestedMessage {
optional int32 bb = 1; optional int32 bb = 1;
optional int64 cc = 2; optional int64 cc = 2;
repeated int32 dd = 3 [packed = true];
} }
message NestedMessage2 { message NestedMessage2 {

@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update #error incompatible with your Protocol Buffer headers. Please update
#error your headers. #error your headers.
#endif #endif
#if 3021011 < PROTOBUF_MIN_PROTOC_VERSION #if 3021012 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is #error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please #error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc. #error regenerate this file with a newer version of protoc.

@ -1,17 +1,17 @@
{ {
"21.x": { "21.x": {
"protoc_version": "21.12-dev", "protoc_version": "21.13-dev",
"lts": false, "lts": false,
"date": "2022-12-08", "date": "2022-12-16",
"languages": { "languages": {
"cpp": "3.21.12-dev", "cpp": "3.21.13-dev",
"csharp": "3.21.12-dev", "csharp": "3.21.13-dev",
"java": "3.21.12-dev", "java": "3.21.13-dev",
"javascript": "3.21.12-dev", "javascript": "3.21.13-dev",
"objectivec": "3.21.12-dev", "objectivec": "3.21.13-dev",
"php": "3.21.12-dev", "php": "3.21.13-dev",
"python": "4.21.12-dev", "python": "4.21.13-dev",
"ruby": "3.21.12-dev" "ruby": "3.21.13-dev"
} }
} }
} }
Loading…
Cancel
Save