PROTOBUF_SYNC_PIPER
pull/10817/head
Mike Kruskal 2 years ago
commit 91c1e7c058
  1. 34
      .bazelrc
  2. 13
      CHANGES.txt
  3. 4
      CMakeLists.txt
  4. 2
      Protobuf-C++.podspec
  5. 2
      build_defs/cpp_opts.bzl
  6. 1
      cmake/protobuf-config.cmake.in
  7. 8
      cmake/utf8_range.cmake
  8. 5
      csharp/.gitignore
  9. 1
      csharp/build_release.sh
  10. 3
      csharp/generate_protos.sh
  11. 0
      csharp/src/AddressBook/Addressbook.pb.cs
  12. 0
      csharp/src/Google.Protobuf.Test.TestProtos/MapUnittestProto3.pb.cs
  13. 0
      csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto2.pb.cs
  14. 0
      csharp/src/Google.Protobuf.Test.TestProtos/TestMessagesProto3.pb.cs
  15. 0
      csharp/src/Google.Protobuf.Test.TestProtos/Unittest.pb.cs
  16. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestCustomOptionsProto3.pb.cs
  17. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestImport.pb.cs
  18. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportProto3.pb.cs
  19. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublic.pb.cs
  20. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestImportPublicProto3.pb.cs
  21. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936A.pb.cs
  22. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936B.pb.cs
  23. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssue6936C.pb.cs
  24. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestIssues.pb.cs
  25. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3.pb.cs
  26. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestProto3Optional.pb.cs
  27. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestSelfreferentialOptions.pb.cs
  28. 0
      csharp/src/Google.Protobuf.Test.TestProtos/UnittestWellKnownTypes.pb.cs
  29. 0
      csharp/src/Google.Protobuf/Compiler/Plugin.pb.cs
  30. 0
      csharp/src/Google.Protobuf/Reflection/Descriptor.pb.cs
  31. 0
      csharp/src/Google.Protobuf/WellKnownTypes/Any.pb.cs
  32. 0
      csharp/src/Google.Protobuf/WellKnownTypes/Api.pb.cs
  33. 0
      csharp/src/Google.Protobuf/WellKnownTypes/Duration.pb.cs
  34. 0
      csharp/src/Google.Protobuf/WellKnownTypes/Empty.pb.cs
  35. 0
      csharp/src/Google.Protobuf/WellKnownTypes/FieldMask.pb.cs
  36. 0
      csharp/src/Google.Protobuf/WellKnownTypes/SourceContext.pb.cs
  37. 0
      csharp/src/Google.Protobuf/WellKnownTypes/Struct.pb.cs
  38. 0
      csharp/src/Google.Protobuf/WellKnownTypes/Timestamp.pb.cs
  39. 0
      csharp/src/Google.Protobuf/WellKnownTypes/Type.pb.cs
  40. 0
      csharp/src/Google.Protobuf/WellKnownTypes/Wrappers.pb.cs
  41. 4
      docs/options.md
  42. 6
      java/README.md
  43. 2
      java/bom/pom.xml
  44. 3
      java/core/BUILD.bazel
  45. 2
      java/core/generate-test-sources-build.xml
  46. 2
      java/core/pom.xml
  47. 7
      java/core/src/main/java/com/google/protobuf/AbstractMessage.java
  48. 1
      java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java
  49. 4
      java/core/src/main/java/com/google/protobuf/ByteString.java
  50. 14
      java/core/src/main/java/com/google/protobuf/CodedInputStream.java
  51. 1
      java/core/src/main/java/com/google/protobuf/Descriptors.java
  52. 1
      java/core/src/main/java/com/google/protobuf/DynamicMessage.java
  53. 1
      java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java
  54. 1
      java/core/src/main/java/com/google/protobuf/ExtensionRegistryFactory.java
  55. 1
      java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java
  56. 2
      java/core/src/main/java/com/google/protobuf/FieldSet.java
  57. 3
      java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java
  58. 8
      java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
  59. 3
      java/core/src/main/java/com/google/protobuf/Internal.java
  60. 4
      java/core/src/main/java/com/google/protobuf/MapField.java
  61. 1
      java/core/src/main/java/com/google/protobuf/Message.java
  62. 1
      java/core/src/main/java/com/google/protobuf/MessageLite.java
  63. 1
      java/core/src/main/java/com/google/protobuf/MessageReflection.java
  64. 13
      java/core/src/main/java/com/google/protobuf/TextFormat.java
  65. 1
      java/core/src/main/java/com/google/protobuf/TypeRegistry.java
  66. 1
      java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java
  67. 1
      java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java
  68. 1
      java/core/src/test/java/com/google/protobuf/AnyTest.java
  69. 2
      java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java
  70. 3
      java/core/src/test/java/com/google/protobuf/DescriptorsTest.java
  71. 1
      java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java
  72. 1
      java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java
  73. 2
      java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java
  74. 35
      java/core/src/test/java/com/google/protobuf/MapForProto2Test.java
  75. 30
      java/core/src/test/java/com/google/protobuf/MapTest.java
  76. 2
      java/core/src/test/java/com/google/protobuf/ParserTest.java
  77. 2
      java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java
  78. 112
      java/core/src/test/java/com/google/protobuf/TextFormatPerformanceTest.java
  79. 4
      java/core/src/test/java/com/google/protobuf/TextFormatTest.java
  80. 1
      java/core/src/test/java/com/google/protobuf/TypeRegistryTest.java
  81. 52
      java/core/src/test/proto/com/google/protobuf/proto2_text_format_performance_test.proto
  82. 44
      java/core/src/test/proto/com/google/protobuf/proto3_text_format_performance_test.proto
  83. 30
      java/internal/JavaVersionTest.java
  84. 2
      java/kotlin-lite/pom.xml
  85. 2
      java/kotlin/pom.xml
  86. 2
      java/lite.md
  87. 3
      java/lite/pom.xml
  88. 1
      java/lite/src/test/java/com/google/protobuf/LiteTest.java
  89. 2
      java/pom.xml
  90. 2
      java/util/pom.xml
  91. 1
      java/util/src/main/java/com/google/protobuf/util/JsonFormat.java
  92. 1
      java/util/src/test/java/com/google/protobuf/util/JsonFormatTest.java
  93. 1
      java/util/src/test/java/com/google/protobuf/util/StructsTest.java
  94. 2
      kokoro/windows/prepare_build_win64.bat
  95. 5
      pkg/BUILD.bazel
  96. 17
      protobuf_deps.bzl
  97. 6
      protobuf_version.bzl
  98. 2
      python/google/protobuf/__init__.py
  99. 1
      python/google/protobuf/internal/descriptor_pool_test.py
  100. 3
      python/google/protobuf/internal/message_test.py
  101. Some files were not shown because too many files have changed in this diff Show More

@ -1 +1,35 @@
build --cxxopt=-std=c++14 --host_cxxopt=-std=c++14
build:dbg --compilation_mode=dbg
build:opt --compilation_mode=opt
build:san-common --config=dbg --strip=never --copt=-O0 --copt=-fno-omit-frame-pointer
build:asan --config=san-common --copt=-fsanitize=address --linkopt=-fsanitize=address
build:asan --copt=-DADDRESS_SANITIZER=1
# ASAN hits ODR violations with shared linkage due to rules_proto.
build:asan --dynamic_mode=off
build:msan --config=san-common --copt=-fsanitize=memory --linkopt=-fsanitize=memory
build:msan --copt=-fsanitize-memory-track-origins
build:msan --copt=-fsanitize-memory-use-after-dtor
build:msan --action_env=MSAN_OPTIONS=poison_in_dtor=1
build:msan --copt=-DMEMORY_SANITIZER=1
# Use our instrumented LLVM libc++ in Kokoro.
build:kokoro-msan --config=msan
build:kokoro-msan --linkopt=-L/opt/libcxx_msan/lib
build:kokoro-msan --linkopt=-Wl,-rpath,/opt/libcxx_msan/lib
build:kokoro-msan --cxxopt=-stdlib=libc++ --linkopt=-stdlib=libc++
build:tsan --config=san-common --copt=-fsanitize=thread --linkopt=-fsanitize=thread
build:tsan --copt=-DTHREAD_SANITIZER=1
build:ubsan --config=san-common --copt=-fsanitize=undefined --linkopt=-fsanitize=undefined
build:ubsan --action_env=UBSAN_OPTIONS=halt_on_error=1:print_stacktrace=1
build:ubsan --copt=-DUNDEFINED_SANITIZER=1
# Workaround for the fact that Bazel links with $CC, not $CXX
# https://github.com/bazelbuild/bazel/issues/11122#issuecomment-613746748
build:ubsan --copt=-fno-sanitize=function --copt=-fno-sanitize=vptr

@ -37,6 +37,12 @@
* Introduce the Printer::{SetRedactDebugString,SetRandomizeDebugString} private flags.
* Introduce global flags to control Printer::{SetRedactDebugString, SetRandomizeDebugString}.
* proto3 string fields no longer trigger clang-tidy warning bugprone-branch-clone.
* Fix the API of DescriptorUpgrader::set_allow_unknown_dependencies to set to True always, and to populate into the DescriptorPool as well.
* Report line numbers consistently in text-format deprecated-field warnings.
* Reserve C++20 keywords
* Fixed C++ code generation for protos that use int32_t, uint32_t, int64_t, uint64_t, size_t as field names.
* Annotate generated C++ public aliases for enum types.
* Change default arena max block size from 8K to 32K.
Kotlin
@ -57,6 +63,12 @@
* Make message-type extensions merge from wire-format instead of building up instances and merging afterwards. This has much better performance.
* Change the Lite runtime to prefer merging from the wireformat into mutable messages rather than building up a new immutable object before merging. This way results in fewer allocations and copy operations.
* Move proto wireformat parsing functionality from the private "parsing constructor" to the Builder class.
* Refactoring java full runtime to reuse sub-message builders and prepare to migrate parsing logic from parse constructor to builder.
* Move proto wireformat parsing functionality from the private "parsing constructor" to the Builder class.
* Change the Lite runtime to prefer merging from the wireformat into mutable messages rather than building up a new immutable object before merging. This way results in fewer allocations and copy operations.
* Make message-type extensions merge from wire-format instead of building up instances and merging afterwards. This has much better performance.
* Fix TextFormat parser to build up recurring (but supposedly not repeated) sub-messages directly from text rather than building a new sub-message and merging the fully formed message into the existing field.
* Fix bug in nested builder caching logic where cleared sub-field builders would remain dirty after a clear and build in a parent layer. https://github.com/protocolbuffers/protobuf/issues/10624
Python
* Changes ordering of printed fields in .pyi files from lexicographic to the same ordering found in the proto descriptor.
@ -66,6 +78,7 @@
Compiler
* Print full path name of source .proto file on error
* Include proto message type in the annotation comments.
2022-10-18 version 21.8 (C++/Java/Python/PHP/Objective-C/C#/Ruby)

@ -23,6 +23,10 @@ endif()
if(POLICY CMP0063)
cmake_policy(SET CMP0063 NEW)
endif()
# option() honor variables
if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif (POLICY CMP0077)
# Project
project(protobuf C CXX)

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

@ -14,14 +14,12 @@ COPTS = select({
"/wd4506", # no definition for inline function 'function'
"/wd4800", # 'type' : forcing value to bool 'true' or 'false' (performance warning)
"/wd4996", # The compiler encountered a deprecated declaration.
"/std:c++14", # Use C++14
],
"//conditions:default": [
"-DHAVE_ZLIB",
"-Woverloaded-virtual",
"-Wno-sign-compare",
"-Werror",
"-std=c++14", # Protobuf requires C++14.
],
})

@ -4,6 +4,7 @@ include("${CMAKE_CURRENT_LIST_DIR}/protobuf-options.cmake")
# Depend packages
@_protobuf_FIND_ZLIB@
@_protobuf_FIND_ABSL@
@_protobuf_FIND_UTF8_RANGE@
# Imported targets
include("${CMAKE_CURRENT_LIST_DIR}/protobuf-targets.cmake")

@ -1,4 +1,4 @@
set(utf8_range_ENABLE_TESTS OFF)
set(utf8_range_ENABLE_TESTS OFF CACHE BOOL "Disable utf8_range tests")
if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/utf8_range/CMakeLists.txt")
message(FATAL_ERROR
@ -8,5 +8,7 @@ if (NOT EXISTS "${protobuf_SOURCE_DIR}/third_party/utf8_range/CMakeLists.txt")
" git submodule update --init --recursive\n")
endif()
set(utf8_range_ENABLE_INSTALL ${protobuf_INSTALL})
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/utf8_range third_party/utf8_range)
set(utf8_range_ENABLE_INSTALL ${protobuf_INSTALL} CACHE BOOL "Set install")
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/utf8_range third_party/utf8_range)
set(_protobuf_FIND_UTF8_RANGE "if(NOT TARGET utf8_range)\n find_package(utf8_range CONFIG)\nendif()")

5
csharp/.gitignore vendored

@ -33,3 +33,8 @@ lib/protoc.exe
# Benchmark output
BenchmarkDotNet.Artifacts/
# Reinstate generated code for test files
!any_test.pb.*
!map*unittest.pb.*
!unittest*.pb.*

@ -7,4 +7,5 @@ set DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true
set DOTNET_CLI_TELEMETRY_OPTOUT=true
# Builds Google.Protobuf NuGet packages
dotnet restore -s /lib/csharp/ src/Google.Protobuf/Google.Protobuf.csproj
dotnet pack --no-restore -c Release src/Google.Protobuf.sln -p:ContinuousIntegrationBuild=true

@ -32,6 +32,7 @@ fi
# descriptor.proto and well-known types
$PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
--csharp_opt=base_namespace=Google.Protobuf \
--csharp_opt=file_extension=.pb.cs \
src/google/protobuf/descriptor.proto \
src/google/protobuf/any.proto \
src/google/protobuf/api.proto \
@ -52,6 +53,7 @@ $PROTOC -Isrc --csharp_out=csharp/src/Google.Protobuf \
$PROTOC -Isrc -Icsharp/protos \
--experimental_allow_proto3_optional \
--csharp_out=csharp/src/Google.Protobuf.Test.TestProtos \
--csharp_opt=file_extension=.pb.cs \
--descriptor_set_out=csharp/src/Google.Protobuf.Test/testprotos.pb \
--include_source_info \
--include_imports \
@ -75,4 +77,5 @@ $PROTOC -Isrc -Icsharp/protos \
# AddressBook sample protos
$PROTOC -Iexamples -Isrc --csharp_out=csharp/src/AddressBook \
--csharp_opt=file_extension=.pb.cs \
examples/addressbook.proto

@ -348,3 +348,7 @@ with info about your project (name and website) so we can add an entry for you.
1. Pigweed protobuf compiler
* Website: https://pigweed.dev/pw_protobuf
* Extension: 1155
1. Perfetto
* Website: https://perfetto.dev
* Extension: 1156

@ -23,7 +23,7 @@ If you are using Maven, use the following:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.21.7</version>
<version>3.21.8</version>
</dependency>
```
@ -37,7 +37,7 @@ protobuf-java-util package:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.21.7</version>
<version>3.21.8</version>
</dependency>
```
@ -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.21.7'
implementation 'com.google.protobuf:protobuf-java:3.21.8'
```
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>
<artifactId>protobuf-bom</artifactId>
<version>3.21.7</version>
<version>3.21.8</version>
<packaging>pom</packaging>
<name>Protocol Buffers [BOM]</name>

@ -191,8 +191,8 @@ java_export(
maven_coordinates = "com.google.protobuf:protobuf-java:%s" % PROTOBUF_JAVA_VERSION,
pom_template = "pom_template.xml",
resources = [
"//src/google/protobuf:descriptor_proto_srcs",
"//:well_known_type_protos",
"//src/google/protobuf:descriptor_proto_srcs",
],
tags = ["manual"],
runtime_deps = [":core"],
@ -442,6 +442,7 @@ LITE_TEST_EXCLUSIONS = [
"src/test/java/com/google/protobuf/TestBadIdentifiers.java",
"src/test/java/com/google/protobuf/TextFormatParseInfoTreeTest.java",
"src/test/java/com/google/protobuf/TextFormatParseLocationTest.java",
"src/test/java/com/google/protobuf/TextFormatPerformanceTest.java",
"src/test/java/com/google/protobuf/TextFormatTest.java",
"src/test/java/com/google/protobuf/TestUtil.java",
"src/test/java/com/google/protobuf/TestUtilLite.java",

@ -43,8 +43,10 @@
<arg value="${test.proto.dir}/com/google/protobuf/proto2_message.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/proto2_message_lite.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/proto2_unknown_enum_values.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/proto2_text_format_performance_test.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/proto3_message.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/proto3_message_lite.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/proto3_text_format_performance_test.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/test_bad_identifiers.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/test_check_utf8.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/test_check_utf8_size.proto"/>

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

@ -83,7 +83,6 @@ public abstract class AbstractMessage
throw new UnsupportedOperationException("Nested builder is not supported for this type.");
}
@Override
public List<String> findInitializationErrors() {
return MessageReflection.findMissingFields(this);
@ -571,7 +570,7 @@ public abstract class AbstractMessage
protected static int hashLong(long n) {
return (int) (n ^ (n >>> 32));
}
//
/**
* @deprecated from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
* generated code.
@ -580,7 +579,7 @@ public abstract class AbstractMessage
protected static int hashBoolean(boolean b) {
return b ? 1231 : 1237;
}
//
/**
* @deprecated from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
* generated code.
@ -589,7 +588,7 @@ public abstract class AbstractMessage
protected static int hashEnum(EnumLite e) {
return e.getNumber();
}
//
/**
* @deprecated from v3.0.0-beta-3+, for compatibility with v2.5.0 and v2.6.1
* generated code.

@ -106,7 +106,6 @@ public abstract class AbstractMessageLite<
throw new UnsupportedOperationException();
}
int getSerializedSize(Schema schema) {
int memoizedSerializedSize = getMemoizedSerializedSize();
if (memoizedSerializedSize == -1) {

@ -75,6 +75,7 @@ import java.util.NoSuchElementException;
*/
@CheckReturnValue
public abstract class ByteString implements Iterable<Byte>, Serializable {
private static final long serialVersionUID = 1L;
/**
* When two strings to be concatenated have a combined length shorter than this, we just copy
@ -945,6 +946,8 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
/** Base class for leaf {@link ByteString}s (i.e. non-ropes). */
abstract static class LeafByteString extends ByteString {
private static final long serialVersionUID = 1L;
@Override
protected final int getTreeDepth() {
return 0;
@ -1603,7 +1606,6 @@ public abstract class ByteString implements Iterable<Byte>, Serializable {
// Keep this class private to avoid deadlocks in classloading across threads as ByteString's
// static initializer loads LiteralByteString and another thread loads BoundedByteString.
private static final class BoundedByteString extends LiteralByteString {
private final int bytesOffset;
private final int bytesLength;

@ -254,7 +254,6 @@ public abstract class CodedInputStream {
*/
public abstract void skipMessage(CodedOutputStream output) throws IOException;
// -----------------------------------------------------------------
/** Read a {@code double} field value from the stream. */
@ -300,7 +299,6 @@ public abstract class CodedInputStream {
final ExtensionRegistryLite extensionRegistry)
throws IOException;
/** Read a {@code group} field value from the stream. */
public abstract <T extends MessageLite> T readGroup(
final int fieldNumber, final Parser<T> parser, final ExtensionRegistryLite extensionRegistry)
@ -322,7 +320,6 @@ public abstract class CodedInputStream {
final MessageLite.Builder builder, final ExtensionRegistryLite extensionRegistry)
throws IOException;
/** Read an embedded message field value from the stream. */
public abstract <T extends MessageLite> T readMessage(
final Parser<T> parser, final ExtensionRegistryLite extensionRegistry) throws IOException;
@ -745,7 +742,6 @@ public abstract class CodedInputStream {
}
}
// -----------------------------------------------------------------
@Override
@ -839,7 +835,6 @@ public abstract class CodedInputStream {
--recursionDepth;
}
@Override
public <T extends MessageLite> T readGroup(
final int fieldNumber,
@ -878,7 +873,6 @@ public abstract class CodedInputStream {
popLimit(oldLimit);
}
@Override
public <T extends MessageLite> T readMessage(
final Parser<T> parser, final ExtensionRegistryLite extensionRegistry) throws IOException {
@ -1460,7 +1454,6 @@ public abstract class CodedInputStream {
}
}
// -----------------------------------------------------------------
@Override
@ -1559,7 +1552,6 @@ public abstract class CodedInputStream {
--recursionDepth;
}
@Override
public <T extends MessageLite> T readGroup(
final int fieldNumber,
@ -1598,7 +1590,6 @@ public abstract class CodedInputStream {
popLimit(oldLimit);
}
@Override
public <T extends MessageLite> T readMessage(
final Parser<T> parser, final ExtensionRegistryLite extensionRegistry) throws IOException {
@ -2253,7 +2244,6 @@ public abstract class CodedInputStream {
}
}
// -----------------------------------------------------------------
@Override
@ -2359,7 +2349,6 @@ public abstract class CodedInputStream {
--recursionDepth;
}
@Override
public <T extends MessageLite> T readGroup(
final int fieldNumber,
@ -2398,7 +2387,6 @@ public abstract class CodedInputStream {
popLimit(oldLimit);
}
@Override
public <T extends MessageLite> T readMessage(
final Parser<T> parser, final ExtensionRegistryLite extensionRegistry) throws IOException {
@ -3454,7 +3442,6 @@ public abstract class CodedInputStream {
--recursionDepth;
}
@Override
public <T extends MessageLite> T readGroup(
final int fieldNumber,
@ -3493,7 +3480,6 @@ public abstract class CodedInputStream {
popLimit(oldLimit);
}
@Override
public <T extends MessageLite> T readMessage(
final Parser<T> parser, final ExtensionRegistryLite extensionRegistry) throws IOException {

@ -1728,7 +1728,6 @@ public final class Descriptors {
// down-cast and call mergeFrom directly.
return ((Message.Builder) to).mergeFrom((Message) from);
}
}
// =================================================================

@ -86,7 +86,6 @@ public final class DynamicMessage extends AbstractMessage {
UnknownFieldSet.getDefaultInstance());
}
/** Parse a message of the given type from the given input stream. */
public static DynamicMessage parseFrom(Descriptor type, CodedInputStream input)
throws IOException {

@ -99,7 +99,6 @@ public class ExtensionRegistry extends ExtensionRegistryLite {
return EMPTY_REGISTRY;
}
/** Returns an unmodifiable view of the registry. */
@Override
public ExtensionRegistry getUnmodifiable() {

@ -70,7 +70,6 @@ final class ExtensionRegistryFactory {
return result != null ? result : EMPTY_REGISTRY_LITE;
}
static boolean isFullRegistry(ExtensionRegistryLite registry) {
return EXTENSION_REGISTRY_CLASS != null
&& EXTENSION_REGISTRY_CLASS.isAssignableFrom(registry.getClass());

@ -138,7 +138,6 @@ public class ExtensionRegistryLite {
return result;
}
/** Returns an unmodifiable view of the registry. */
public ExtensionRegistryLite getUnmodifiable() {
return new ExtensionRegistryLite(this);

@ -185,7 +185,6 @@ final class FieldSet<T extends FieldSet.FieldDescriptorLite<T>> {
return clone;
}
// =================================================================
/** See {@link Message.Builder#clear()}. */
@ -574,7 +573,6 @@ final class FieldSet<T extends FieldSet.FieldDescriptorLite<T>> {
}
}
/** See {@link Message#writeTo(CodedOutputStream)}. */
public void writeTo(final CodedOutputStream output) throws IOException {
for (int i = 0; i < fields.getNumArrayEntries(); i++) {

@ -586,7 +586,6 @@ public abstract class GeneratedMessageLite<
}
}
// =================================================================
// Extensions-related stuff
@ -1250,7 +1249,6 @@ public abstract class GeneratedMessageLite<
return ((Builder) to).mergeFrom((GeneratedMessageLite) from);
}
@Override
public int compareTo(ExtensionDescriptor other) {
return number - other.number;
@ -1291,7 +1289,6 @@ public abstract class GeneratedMessageLite<
}
}
/**
* Lite equivalent to {@link GeneratedMessage.GeneratedExtension}.
*

@ -456,7 +456,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
size == 0 ? AbstractProtobufList.DEFAULT_CAPACITY : size * 2);
}
@Override
public void writeTo(final CodedOutputStream output) throws IOException {
MessageReflection.writeMessageTo(this, getAllFieldsRaw(), output, false);
@ -474,7 +473,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return memoizedSize;
}
/**
* This class is used to make a generated protected method inaccessible from user's code (e.g.,
* the {@link #newInstance} method below). When this class is used as a parameter's type in a
@ -520,6 +518,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
});
}
/** Builder class for {@link GeneratedMessageV3}. */
@SuppressWarnings("unchecked")
public abstract static class Builder<BuilderType extends Builder<BuilderType>>
extends AbstractMessage.Builder<BuilderType> {
@ -879,7 +878,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
/**
* Called when a the builder or one of its nested children has changed and any parent should be
* Called when a builder or one of its nested children has changed and any parent should be
* notified of its invalidation.
*/
protected final void onChanged() {
@ -919,6 +918,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
// =================================================================
// Extensions-related stuff
/** Extends {@link MessageOrBuilder} with extension-related functions. */
public interface ExtendableMessageOrBuilder<MessageType extends ExtendableMessage>
extends MessageOrBuilder {
// Re-define for return type covariance.
@ -1169,7 +1169,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return parseUnknownField(input, unknownFields, extensionRegistry, tag);
}
/** Used by parsing constructors in generated classes. */
@Override
protected void makeExtensionsImmutable() {
@ -1847,7 +1846,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
FieldDescriptor getDescriptor();
}
// =================================================================
/** Calls Class.getMethod and throws a RuntimeException if it fails. */

@ -375,7 +375,6 @@ public final class Internal {
}
}
/** An empty byte array constant used in generated code. */
public static final byte[] EMPTY_BYTE_ARRAY = new byte[0];
@ -386,7 +385,6 @@ public final class Internal {
public static final CodedInputStream EMPTY_CODED_INPUT_STREAM =
CodedInputStream.newInstance(EMPTY_BYTE_ARRAY);
/** Helper method to merge two MessageLite instances. */
static Object mergeMessage(Object destination, Object source) {
return ((MessageLite) destination).toBuilder().mergeFrom((MessageLite) source).buildPartial();
@ -691,5 +689,4 @@ public final class Internal {
@Override
FloatList mutableCopyWithCapacity(int capacity);
}
}

@ -122,7 +122,6 @@ public class MapField<K, V> implements MutabilityOracle {
}
}
private final Converter<K, V> converter;
private MapField(Converter<K, V> converter, StorageMode mode, Map<K, V> mapData) {
@ -137,19 +136,16 @@ public class MapField<K, V> implements MutabilityOracle {
this(new ImmutableMessageConverter<K, V>(defaultEntry), mode, mapData);
}
/** Returns an immutable empty MapField. */
public static <K, V> MapField<K, V> emptyMapField(MapEntry<K, V> defaultEntry) {
return new MapField<K, V>(defaultEntry, StorageMode.MAP, Collections.<K, V>emptyMap());
}
/** Creates a new mutable empty MapField. */
public static <K, V> MapField<K, V> newMapField(MapEntry<K, V> defaultEntry) {
return new MapField<K, V>(defaultEntry, StorageMode.MAP, new LinkedHashMap<K, V>());
}
private Message convertKeyAndValueToMessage(K key, V value) {
return converter.convertKeyAndValueToMessage(key, value);
}

@ -51,7 +51,6 @@ public interface Message extends MessageLite, MessageOrBuilder {
@Override
Parser<? extends Message> getParserForType();
// -----------------------------------------------------------------
// Comparison and hashing

@ -123,7 +123,6 @@ public interface MessageLite extends MessageLiteOrBuilder {
*/
void writeDelimitedTo(OutputStream output) throws IOException;
// =================================================================
// Builders

@ -673,7 +673,6 @@ class MessageReflection {
}
}
static class ExtensionAdapter implements MergeTarget {
private final FieldSet<Descriptors.FieldDescriptor> extensions;

@ -132,7 +132,7 @@ public final class TextFormat {
public static String shortDebugString(final FieldDescriptor field, final Object value) {
return printer().shortDebugString(field, value);
}
//
/**
* Generates a human readable form of the unknown fields, useful for debugging and other
* purposes, with no newline characters.
@ -191,7 +191,7 @@ public final class TextFormat {
public static String printToUnicodeString(final UnknownFieldSet fields) {
return printer().escapingNonAscii(false).printToString(fields);
}
//
/** @deprecated Use {@code printer().printField(FieldDescriptor, Object, Appendable)} */
@Deprecated
public static void printField(
@ -199,13 +199,13 @@ public final class TextFormat {
throws IOException {
printer().printField(field, value, output);
}
//
/** @deprecated Use {@code printer().printFieldToString(FieldDescriptor, Object)} */
@Deprecated
public static String printFieldToString(final FieldDescriptor field, final Object value) {
return printer().printFieldToString(field, value);
}
//
/**
* Outputs a unicode textual representation of the value of given field value.
*
@ -465,7 +465,6 @@ public final class TextFormat {
@SuppressWarnings({"rawtypes"})
private MapEntry mapEntry;
private final FieldDescriptor.JavaType fieldType;
MapEntryAdapter(Object entry, FieldDescriptor fieldDescriptor) {
@ -1499,7 +1498,6 @@ public final class TextFormat {
PARSER.merge(input, extensionRegistry, builder);
}
/**
* Parse a text-format message from {@code input} and merge the contents into {@code builder}.
* Extensions will be recognized if they are registered in {@code extensionRegistry}.
@ -1530,7 +1528,6 @@ public final class TextFormat {
return output;
}
/**
* Parser for text-format proto2 instances. This class is thread-safe. The implementation largely
* follows google/protobuf/text_format.cc.
@ -1700,7 +1697,6 @@ public final class TextFormat {
merge(toStringBuilder(input), extensionRegistry, builder);
}
private static final int BUFFER_SIZE = 4096;
// TODO(chrisn): See if working around java.io.Reader#read(CharBuffer)
@ -1791,7 +1787,6 @@ public final class TextFormat {
checkUnknownFields(unknownFields);
}
/** Parse a single field from {@code tokenizer} and merge it into {@code builder}. */
private void mergeField(
final Tokenizer tokenizer,

@ -55,7 +55,6 @@ public class TypeRegistry {
return EmptyTypeRegistryHolder.EMPTY;
}
public static Builder newBuilder() {
return new Builder();
}

@ -89,7 +89,6 @@ public final class UnknownFieldSet implements MessageLite {
private static final UnknownFieldSet defaultInstance =
new UnknownFieldSet(new TreeMap<Integer, Field>());
@Override
public boolean equals(Object other) {
if (this == other) {

@ -117,5 +117,4 @@ public final class UnsafeByteOperations {
public static void unsafeWriteTo(ByteString bytes, ByteOutput output) throws IOException {
bytes.writeTo(output);
}
}

@ -58,7 +58,6 @@ public class AnyTest {
TestAllTypes result = container.getValue().unpack(TestAllTypes.class);
TestUtil.assertAllFieldsSet(result);
// Unpacking to a wrong type will throw an exception.
try {
container.getValue().unpack(TestAny.class);

@ -424,7 +424,6 @@ public class CodedInputStreamTest {
}
}
/**
* Test that a bug in skipRawBytes() has been fixed: if the skip skips exactly up to a limit, this
* should not break things.
@ -672,7 +671,6 @@ public class CodedInputStreamTest {
// success.
}
CodedInputStream input = inputType.newDecoder(data100);
input.setRecursionLimit(8);
try {

@ -324,7 +324,6 @@ public class DescriptorsTest {
assertThat(service.getFullName()).isEqualTo("protobuf_unittest.TestService");
assertThat(service.getFile()).isEqualTo(UnittestProto.getDescriptor());
MethodDescriptor fooMethod = service.getMethods().get(0);
assertThat(fooMethod.getName()).isEqualTo("Foo");
assertThat(fooMethod.getInputType()).isEqualTo(UnittestProto.FooRequest.getDescriptor());
@ -337,7 +336,6 @@ public class DescriptorsTest {
assertThat(barMethod.getOutputType()).isEqualTo(UnittestProto.BarResponse.getDescriptor());
assertThat(service.findMethodByName("Bar")).isEqualTo(barMethod);
assertThat(service.findMethodByName("NoSuchMethod")).isNull();
for (int i = 0; i < service.getMethods().size(); i++) {
@ -345,7 +343,6 @@ public class DescriptorsTest {
}
}
@Test
public void testCustomOptions() throws Exception {
// Get the descriptor indirectly from a dependent proto class. This is to

@ -500,5 +500,4 @@ public class FieldPresenceTest {
assertThat(builder.isInitialized()).isTrue();
assertThat(builder.buildPartial().isInitialized()).isTrue();
}
}

@ -801,7 +801,6 @@ public class GeneratedMessageTest {
assertThat(fieldBuilder.build().getField(field)).isEqualTo(expected);
}
@Test
public void testGetBuilderForNonMessageExtensionField() {
TestAllExtensions.Builder builder = TestAllExtensions.newBuilder();

@ -238,7 +238,6 @@ public class LazyFieldLiteTest {
.isEqualTo(messageWithExtensions);
}
// Help methods.
private LazyFieldLite createLazyFieldLiteFromMessage(MessageLite message) {
@ -262,5 +261,4 @@ public class LazyFieldLiteTest {
assertThat(unexpected).isNotSameInstanceAs(actual);
assertThat((unexpected != null && unexpected.equals(actual))).isFalse();
}
}

@ -67,26 +67,26 @@ public class MapForProto2Test {
builder.getMutableInt32ToInt32Field().put(1, 11);
builder.getMutableInt32ToInt32Field().put(2, 22);
builder.getMutableInt32ToInt32Field().put(3, 33);
//
builder.getMutableInt32ToStringField().put(1, "11");
builder.getMutableInt32ToStringField().put(2, "22");
builder.getMutableInt32ToStringField().put(3, "33");
//
builder.getMutableInt32ToBytesField().put(1, TestUtil.toBytes("11"));
builder.getMutableInt32ToBytesField().put(2, TestUtil.toBytes("22"));
builder.getMutableInt32ToBytesField().put(3, TestUtil.toBytes("33"));
//
builder.getMutableInt32ToEnumField().put(1, TestMap.EnumValue.FOO);
builder.getMutableInt32ToEnumField().put(2, TestMap.EnumValue.BAR);
builder.getMutableInt32ToEnumField().put(3, TestMap.EnumValue.BAZ);
//
builder.getMutableInt32ToMessageField().put(
1, MessageValue.newBuilder().setValue(11).build());
builder.getMutableInt32ToMessageField().put(
2, MessageValue.newBuilder().setValue(22).build());
builder.getMutableInt32ToMessageField().put(
3, MessageValue.newBuilder().setValue(33).build());
//
builder.getMutableStringToInt32Field().put("1", 11);
builder.getMutableStringToInt32Field().put("2", 22);
builder.getMutableStringToInt32Field().put("3", 33);
@ -175,25 +175,25 @@ public class MapForProto2Test {
builder.getMutableInt32ToInt32Field().put(1, 111);
builder.getMutableInt32ToInt32Field().remove(2);
builder.getMutableInt32ToInt32Field().put(4, 44);
//
builder.getMutableInt32ToStringField().put(1, "111");
builder.getMutableInt32ToStringField().remove(2);
builder.getMutableInt32ToStringField().put(4, "44");
//
builder.getMutableInt32ToBytesField().put(1, TestUtil.toBytes("111"));
builder.getMutableInt32ToBytesField().remove(2);
builder.getMutableInt32ToBytesField().put(4, TestUtil.toBytes("44"));
//
builder.getMutableInt32ToEnumField().put(1, TestMap.EnumValue.BAR);
builder.getMutableInt32ToEnumField().remove(2);
builder.getMutableInt32ToEnumField().put(4, TestMap.EnumValue.QUX);
//
builder.getMutableInt32ToMessageField().put(
1, MessageValue.newBuilder().setValue(111).build());
builder.getMutableInt32ToMessageField().remove(2);
builder.getMutableInt32ToMessageField().put(
4, MessageValue.newBuilder().setValue(44).build());
//
builder.getMutableStringToInt32Field().put("1", 111);
builder.getMutableStringToInt32Field().remove("2");
builder.getMutableStringToInt32Field().put("4", 44);
@ -234,7 +234,7 @@ public class MapForProto2Test {
assertMapValuesSet(usingAccessors);
assertThat(usingAccessors).isEqualTo(usingMutableMap);
//
usingMutableMapBuilder = usingMutableMap.toBuilder();
updateMapValuesUsingMutableMap(usingMutableMapBuilder);
usingMutableMap = usingMutableMapBuilder.build();
@ -340,7 +340,7 @@ public class MapForProto2Test {
assertThat(builder.getInt32ToInt32Field()).isEqualTo(newMap(1, 2));
builder.getMutableInt32ToInt32Field().put(2, 3);
assertThat(builder.getInt32ToInt32Field()).isEqualTo(newMap(1, 2, 2, 3));
//
Map<Integer, TestMap.EnumValue> enumMap = builder.getMutableInt32ToEnumField();
enumMap.put(1, TestMap.EnumValue.BAR);
assertThat(builder.build().getInt32ToEnumField())
@ -355,7 +355,7 @@ public class MapForProto2Test {
builder.getMutableInt32ToEnumField().put(2, TestMap.EnumValue.FOO);
assertThat(builder.getInt32ToEnumField())
.isEqualTo(newMap(1, TestMap.EnumValue.BAR, 2, TestMap.EnumValue.FOO));
//
Map<Integer, String> stringMap = builder.getMutableInt32ToStringField();
stringMap.put(1, "1");
assertThat(builder.build().getInt32ToStringField()).isEqualTo(newMap(1, "1"));
@ -368,7 +368,7 @@ public class MapForProto2Test {
assertThat(builder.getInt32ToStringField()).isEqualTo(newMap(1, "1"));
builder.getMutableInt32ToStringField().put(2, "2");
assertThat(builder.getInt32ToStringField()).isEqualTo(newMap(1, "1", 2, "2"));
//
Map<Integer, TestMap.MessageValue> messageMap = builder.getMutableInt32ToMessageField();
messageMap.put(1, TestMap.MessageValue.getDefaultInstance());
assertThat(builder.build().getInt32ToMessageField())
@ -386,7 +386,7 @@ public class MapForProto2Test {
newMap(1, TestMap.MessageValue.getDefaultInstance(),
2, TestMap.MessageValue.getDefaultInstance()));
}
//
@Test
public void testMutableMapLifecycle_collections() {
TestMap.Builder builder = TestMap.newBuilder();
@ -433,13 +433,13 @@ public class MapForProto2Test {
assertThat(builder.getInt32ToInt32Field()).isEqualTo(newMap(1, 2));
assertThat(builder.build().getInt32ToInt32Field()).isEqualTo(newMap(1, 2));
}
//
private static <K, V> Map<K, V> newMap(K key1, V value1) {
Map<K, V> map = new HashMap<K, V>();
map.put(key1, value1);
return map;
}
//
private static <K, V> Map<K, V> newMap(K key1, V value1, K key2, V value2) {
Map<K, V> map = new HashMap<K, V>();
map.put(key1, value1);
@ -635,7 +635,6 @@ public class MapForProto2Test {
// to be different.
}
// The following methods are used to test reflection API.
private static FieldDescriptor f(String name) {

@ -66,26 +66,26 @@ public class MapTest {
builder.getMutableInt32ToInt32Field().put(1, 11);
builder.getMutableInt32ToInt32Field().put(2, 22);
builder.getMutableInt32ToInt32Field().put(3, 33);
//
builder.getMutableInt32ToStringField().put(1, "11");
builder.getMutableInt32ToStringField().put(2, "22");
builder.getMutableInt32ToStringField().put(3, "33");
//
builder.getMutableInt32ToBytesField().put(1, TestUtil.toBytes("11"));
builder.getMutableInt32ToBytesField().put(2, TestUtil.toBytes("22"));
builder.getMutableInt32ToBytesField().put(3, TestUtil.toBytes("33"));
//
builder.getMutableInt32ToEnumField().put(1, TestMap.EnumValue.FOO);
builder.getMutableInt32ToEnumField().put(2, TestMap.EnumValue.BAR);
builder.getMutableInt32ToEnumField().put(3, TestMap.EnumValue.BAZ);
//
builder.getMutableInt32ToMessageField().put(
1, MessageValue.newBuilder().setValue(11).build());
builder.getMutableInt32ToMessageField().put(
2, MessageValue.newBuilder().setValue(22).build());
builder.getMutableInt32ToMessageField().put(
3, MessageValue.newBuilder().setValue(33).build());
//
builder.getMutableStringToInt32Field().put("1", 11);
builder.getMutableStringToInt32Field().put("2", 22);
builder.getMutableStringToInt32Field().put("3", 33);
@ -174,25 +174,25 @@ public class MapTest {
builder.getMutableInt32ToInt32Field().put(1, 111);
builder.getMutableInt32ToInt32Field().remove(2);
builder.getMutableInt32ToInt32Field().put(4, 44);
//
builder.getMutableInt32ToStringField().put(1, "111");
builder.getMutableInt32ToStringField().remove(2);
builder.getMutableInt32ToStringField().put(4, "44");
//
builder.getMutableInt32ToBytesField().put(1, TestUtil.toBytes("111"));
builder.getMutableInt32ToBytesField().remove(2);
builder.getMutableInt32ToBytesField().put(4, TestUtil.toBytes("44"));
//
builder.getMutableInt32ToEnumField().put(1, TestMap.EnumValue.BAR);
builder.getMutableInt32ToEnumField().remove(2);
builder.getMutableInt32ToEnumField().put(4, TestMap.EnumValue.QUX);
//
builder.getMutableInt32ToMessageField().put(
1, MessageValue.newBuilder().setValue(111).build());
builder.getMutableInt32ToMessageField().remove(2);
builder.getMutableInt32ToMessageField().put(
4, MessageValue.newBuilder().setValue(44).build());
//
builder.getMutableStringToInt32Field().put("1", 111);
builder.getMutableStringToInt32Field().remove("2");
builder.getMutableStringToInt32Field().put("4", 44);
@ -233,7 +233,7 @@ public class MapTest {
assertMapValuesSet(usingAccessors);
assertThat(usingAccessors).isEqualTo(usingMutableMap);
//
usingMutableMapBuilder = usingMutableMap.toBuilder();
updateMapValuesUsingMutableMap(usingMutableMapBuilder);
usingMutableMap = usingMutableMapBuilder.build();
@ -339,7 +339,7 @@ public class MapTest {
assertThat(builder.getInt32ToInt32Field()).isEqualTo(newMap(1, 2));
builder.getMutableInt32ToInt32Field().put(2, 3);
assertThat(builder.getInt32ToInt32Field()).isEqualTo(newMap(1, 2, 2, 3));
//
Map<Integer, TestMap.EnumValue> enumMap = builder.getMutableInt32ToEnumField();
enumMap.put(1, TestMap.EnumValue.BAR);
assertThat(builder.build().getInt32ToEnumField())
@ -354,7 +354,7 @@ public class MapTest {
builder.getMutableInt32ToEnumField().put(2, TestMap.EnumValue.FOO);
assertThat(builder.getInt32ToEnumField()).isEqualTo(
newMap(1, TestMap.EnumValue.BAR, 2, TestMap.EnumValue.FOO));
//
Map<Integer, String> stringMap = builder.getMutableInt32ToStringField();
stringMap.put(1, "1");
assertThat(builder.build().getInt32ToStringField()).isEqualTo(newMap(1, "1"));
@ -367,7 +367,7 @@ public class MapTest {
assertThat(builder.getInt32ToStringField()).isEqualTo(newMap(1, "1"));
builder.putInt32ToStringField(2, "2");
assertThat(builder.getInt32ToStringField()).isEqualTo(newMap(1, "1", 2, "2"));
//
Map<Integer, TestMap.MessageValue> messageMap = builder.getMutableInt32ToMessageField();
messageMap.put(1, TestMap.MessageValue.getDefaultInstance());
assertThat( builder.build().getInt32ToMessageField())
@ -385,7 +385,7 @@ public class MapTest {
newMap(1, TestMap.MessageValue.getDefaultInstance(),
2, TestMap.MessageValue.getDefaultInstance()));
}
//
@Test
public void testMutableMapLifecycle_collections() {
TestMap.Builder builder = TestMap.newBuilder();

@ -117,7 +117,6 @@ public class ParserTest {
assertRoundTripEquals(TestUtil.getAllSet());
}
@Test
public void testParsePartial() throws Exception {
assertParsePartial(TestRequired.parser(), TestRequired.newBuilder().setA(1).buildPartial());
@ -199,7 +198,6 @@ public class ParserTest {
assertThat(emptyMessage.toByteString()).isEqualTo(TestUtil.getAllSet().toByteString());
}
@Test
public void testOptimizeForSize() throws Exception {
TestOptimizedForSize.Builder builder = TestOptimizedForSize.newBuilder();

@ -99,7 +99,6 @@ public class TestBadIdentifiers extends TestCase {
assertEquals("", message.getFieldName33());
assertEquals(0, message.get2Conflict34());
assertEquals(0, message.get2Conflict35());
}
public void testNumberFields() throws Exception {
@ -120,6 +119,5 @@ public class TestBadIdentifiers extends TestCase {
assertEquals(0, message.get32());
assertEquals(0, message.get64Count());
assertEquals(0, message.get64List().size());
}
}

@ -0,0 +1,112 @@
// 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 com.google.protobuf.testing.textformat.performance.proto2.Proto2TextFormatPerformanceProto;
import com.google.protobuf.testing.textformat.performance.proto3.Proto3TextFormatPerformanceProto;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@RunWith(JUnit4.class)
public class TextFormatPerformanceTest {
// 10 Seconds is longer than we'd really like, but necesssary to keep this test from being flaky.
// This test is mostly to make sure it doesn't explode to many 10s of seconds for some reason.
private static final long MAX_PARSE_TIME_MS = 10_000L;
private static final int REPEAT_COUNT = 400000;
private static final String CONTAINS_SUB_MESSAGE_WITH_REPEATED_INT32 =
repeat("sub_msg { value: 123 }", REPEAT_COUNT);
private static final String CONTAINS_EXTENSION_SUB_MESSAGE_WITH_REPEATED_INT32 =
repeat(
"[protobuf.testing.textformat.performance.proto2.sub_msg_ext] { value: 123 }",
REPEAT_COUNT);
// OSS Tests are still using JDK 8, which doesn't have JDK 11 String.repeat()
private static String repeat(String text, int count) {
StringBuilder builder = new StringBuilder(text.length() * count);
for (int i = 0; i < count; ++i) {
builder.append(text);
}
return builder.toString();
}
@Test(timeout = MAX_PARSE_TIME_MS)
public void testProto2ImmutableTextFormatParsing() throws Exception {
Proto2TextFormatPerformanceProto.ContainsSubMessageWithRepeatedInt32.Builder builder =
Proto2TextFormatPerformanceProto.ContainsSubMessageWithRepeatedInt32.newBuilder();
TextFormat.merge(CONTAINS_SUB_MESSAGE_WITH_REPEATED_INT32, builder);
Proto2TextFormatPerformanceProto.ContainsSubMessageWithRepeatedInt32 msg = builder.build();
assertThat(msg.getSubMsg().getValueCount()).isEqualTo(REPEAT_COUNT);
for (int i = 0; i < msg.getSubMsg().getValueCount(); ++i) {
assertThat(msg.getSubMsg().getValue(i)).isEqualTo(123);
}
}
@Test(timeout = MAX_PARSE_TIME_MS)
public void testProto2ImmutableExtensionTextFormatParsing() throws Exception {
ExtensionRegistry registry = ExtensionRegistry.newInstance();
Proto2TextFormatPerformanceProto.registerAllExtensions(registry);
Proto2TextFormatPerformanceProto.ContainsExtensionSubMessage.Builder builder =
Proto2TextFormatPerformanceProto.ContainsExtensionSubMessage.newBuilder();
TextFormat.merge(CONTAINS_EXTENSION_SUB_MESSAGE_WITH_REPEATED_INT32, registry, builder);
Proto2TextFormatPerformanceProto.ContainsExtensionSubMessage msg = builder.build();
assertThat(msg.getExtension(Proto2TextFormatPerformanceProto.subMsgExt).getValueCount())
.isEqualTo(REPEAT_COUNT);
for (int i = 0;
i < msg.getExtension(Proto2TextFormatPerformanceProto.subMsgExt).getValueCount();
++i) {
assertThat(msg.getExtension(Proto2TextFormatPerformanceProto.subMsgExt).getValue(i))
.isEqualTo(123);
}
}
@Test(timeout = MAX_PARSE_TIME_MS)
public void testProto3ImmutableTextFormatParsing() throws Exception {
Proto3TextFormatPerformanceProto.ContainsSubMessageWithRepeatedInt32.Builder builder =
Proto3TextFormatPerformanceProto.ContainsSubMessageWithRepeatedInt32.newBuilder();
TextFormat.merge(CONTAINS_SUB_MESSAGE_WITH_REPEATED_INT32, builder);
Proto3TextFormatPerformanceProto.ContainsSubMessageWithRepeatedInt32 msg = builder.build();
assertThat(msg.getSubMsg().getValueCount()).isEqualTo(REPEAT_COUNT);
for (int i = 0; i < msg.getSubMsg().getValueCount(); ++i) {
assertThat(msg.getSubMsg().getValue(i)).isEqualTo(123);
}
}
}

@ -724,7 +724,6 @@ public class TextFormatTest {
assertThat(actual).isEqualTo(expected);
}
@Test
public void testMergeAny_customBuiltTypeRegistry() throws Exception {
TestAny.Builder builder = TestAny.newBuilder();
@ -759,7 +758,6 @@ public class TextFormatTest {
.build());
}
private void assertParseError(String error, String text) {
// Test merge().
TestAllTypes.Builder builder = TestAllTypes.newBuilder();
@ -1399,7 +1397,6 @@ public class TextFormatTest {
.isEqualTo("1: \"\\343\\201\\202\"\n");
}
@Test
public void testParseUnknownExtensions() throws Exception {
TestUtil.TestLogHandler logHandler = new TestUtil.TestLogHandler();
@ -1844,5 +1841,4 @@ public class TextFormatTest {
assertThat(TextFormat.printer().printToString(message))
.isEqualTo("optional_float: -0.0\noptional_double: -0.0\n");
}
}

@ -65,5 +65,4 @@ public final class TypeRegistryTest {
.getDescriptorForTypeUrl("type.googleapis.com/" + descriptor.getFullName()))
.isSameInstanceAs(descriptor);
}
}

@ -0,0 +1,52 @@
// 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.
syntax = "proto2";
package protobuf.testing.textformat.performance.proto2;
option java_package = "com.google.protobuf.testing.textformat.performance.proto2";
option java_outer_classname = "Proto2TextFormatPerformanceProto";
message ContainsSubMessageWithRepeatedInt32 {
optional RepeatedInt32 sub_msg = 1;
}
message RepeatedInt32 {
repeated int32 value = 2;
}
message ContainsExtensionSubMessage {
extensions 1 to max;
}
extend ContainsExtensionSubMessage {
optional RepeatedInt32 sub_msg_ext = 1;
}

@ -0,0 +1,44 @@
// 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.
syntax = "proto3";
package protobuf.testing.textformat.performance.proto3;
option java_package = "com.google.protobuf.testing.textformat.performance.proto3";
option java_outer_classname = "Proto3TextFormatPerformanceProto";
message ContainsSubMessageWithRepeatedInt32 {
optional RepeatedInt32 sub_msg = 1;
}
message RepeatedInt32 {
repeated int32 value = 2;
}

@ -1,3 +1,33 @@
// Protocol Buffers - Google's data interchange format
// Copyright 2008 Google Inc. All rights reserved.
// https://developers.google.com/protocol-buffers/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Test that Kokoro is using the expected version of Java.
import static com.google.common.truth.Truth.assertWithMessage;

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

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

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

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.21.7</version>
<version>3.21.8</version>
</parent>
<artifactId>protobuf-javalite</artifactId>
@ -229,6 +229,7 @@
<exclude>TestBadIdentifiers.java</exclude>
<exclude>TextFormatParseInfoTreeTest.java</exclude>
<exclude>TextFormatParseLocationTest.java</exclude>
<exclude>TextFormatPerformanceTest.java</exclude>
<exclude>TextFormatTest.java</exclude>
<exclude>TestUtil.java</exclude>
<exclude>TypeRegistryTest.java</exclude>

@ -1526,7 +1526,6 @@ public class LiteTest {
assertToStringEquals("optional_double: 3.14\noptional_float: 2.72", proto);
}
@Test
public void testToStringStringFields() throws Exception {
TestAllTypesLite proto =

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

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

@ -534,7 +534,6 @@ public class JsonFormat {
this.types = types;
}
/** A Builder is used to build {@link TypeRegistry}. */
public static class Builder {
private Builder() {}

@ -1019,7 +1019,6 @@ public class JsonFormatTest {
assertRoundTripEquals(message);
}
@Test
public void testAnyFieldsWithCustomAddedTypeRegistry() throws Exception {
TestAllTypes content = TestAllTypes.newBuilder().setOptionalInt32(1234).build();

@ -61,5 +61,4 @@ public final class StructsTest {
assertThat(Structs.of("k1", Values.of(1), "k2", Values.of(2), "k3", Values.of(3)))
.isEqualTo(expected.build());
}
}

@ -13,4 +13,4 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary
@rem Convert Windows line breaks to Unix line breaks
@rem This allows text-matching tests to pass
find . -type f -print0 | xargs -0 d2u
@find . -type f -print0 | xargs -0 d2u

@ -6,9 +6,14 @@ load(
"pkg_files",
"strip_prefix",
)
load("//:protobuf_release.bzl", "package_naming")
load(":build_systems.bzl", "gen_file_lists")
load(":cc_dist_library.bzl", "cc_dist_library")
package_naming(
name = "protobuf_pkg_naming",
)
pkg_files(
name = "wkt_protos_files",
srcs = [

@ -49,9 +49,12 @@ def protobuf_deps():
http_archive(
name = "zlib",
build_file = "@com_google_protobuf//:third_party/zlib.BUILD",
sha256 = "d8688496ea40fb61787500e863cc63c9afcbc524468cedeb478068924eb54932",
strip_prefix = "zlib-1.2.12",
urls = ["https://github.com/madler/zlib/archive/v1.2.12.tar.gz"],
sha256 = "d14c38e313afc35a9a8760dadf26042f51ea0f5d154b0630a31da0540107fb98",
strip_prefix = "zlib-1.2.13",
urls = [
"https://github.com/madler/zlib/releases/download/v1.2.13/zlib-1.2.13.tar.xz",
"https://zlib.net/zlib-1.2.13.tar.xz",
],
)
if not native.existing_rule("jsoncpp"):
@ -67,8 +70,8 @@ def protobuf_deps():
_github_archive(
name = "utf8_range",
repo = "https://github.com/protocolbuffers/utf8_range",
commit = "a67b76f9f40107f2c78a5aa860bb6ce37ed83d85",
sha256 = "de5f99318f3b5073dd99f3d4ca31e00e90a86cc400fb375e2147ae1fd41711ed",
commit = "de0b4a8ff9b5d4c98108bdfe723291a33c52c54f",
sha256 = "5da960e5e5d92394c809629a03af3c7709d2d3d0ca731dacb3a9fb4bf28f7702",
)
if not native.existing_rule("rules_cc"):
@ -132,6 +135,6 @@ def protobuf_deps():
_github_archive(
name = "upb",
repo = "https://github.com/protocolbuffers/upb",
commit = "32c6e9baab03d584b85390fdba789118f20613fc",
#sha256 = "4c82bff4f790dbb5a11ec40b1fac44e7c95d9a63fd215a13aaf44cb27b10ac27",
commit = "9e2d7f02da5440bfb0dfb069f61baa278aa2fbf6",
sha256 = "9eb13368a136af314855e1497838cf3124846b6a73a7e7c882455a52b8c04662",
)

@ -1,3 +1,3 @@
PROTOC_VERSION = "21.7"
PROTOBUF_JAVA_VERSION = "3.21.7"
PROTOBUF_PYTHON_VERSION = "4.21.7"
PROTOC_VERSION = "21.8"
PROTOBUF_JAVA_VERSION = "3.21.8"
PROTOBUF_PYTHON_VERSION = "4.21.8"

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

@ -56,7 +56,6 @@ from google.protobuf import message_factory
from google.protobuf import symbol_database
warnings.simplefilter('error', DeprecationWarning)

@ -1530,7 +1530,6 @@ class Proto2Test(unittest.TestCase):
self.assertEqual(100, msg.optional_int32)
self.assertEqual(200, msg.optional_fixed32)
def test_documentation(self):
# Also used by the interactive help() function.
doc = pydoc.html.document(unittest_pb2.TestAllTypes, 'message')
@ -2490,8 +2489,6 @@ class Proto3Test(unittest.TestCase):
unittest_proto3_arena_pb2.TestAllTypes().optional_nested_message)
@testing_refleaks.TestCase
class ValidTypeNamesTest(unittest.TestCase):

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save