Merge remote-tracking branch 'origin' into use-raise-from-in-try-except

pull/10966/head
TommyDew42 2 years ago
commit 7b5cc290a1
  1. 36
      .github/CODEOWNERSHIP
  2. 15
      .github/mergeable.yml
  3. 3
      .github/workflows/objc_cocoapods.yml
  4. 45
      .github/workflows/update_php_repo.yml
  5. 10
      CHANGES.txt
  6. 2
      CMakeLists.txt
  7. 3
      CODE_OF_CONDUCT.md
  8. 2
      Protobuf-C++.podspec
  9. 2
      Protobuf.podspec
  10. 25
      README.md
  11. 26
      WORKSPACE
  12. 71
      conformance/binary_json_conformance_suite.cc
  13. 1
      conformance/binary_json_conformance_suite.h
  14. 24
      conformance/conformance_cpp.cc
  15. 23
      conformance/conformance_python.py
  16. 22
      conformance/conformance_test.cc
  17. 54
      conformance/conformance_test_runner.cc
  18. 1
      conformance/failure_list_cpp.txt
  19. 2
      conformance/failure_list_php.txt
  20. 2
      conformance/failure_list_php_c.txt
  21. 3
      conformance/failure_list_python.txt
  22. 3
      conformance/failure_list_python_cpp.txt
  23. 2
      conformance/failure_list_ruby.txt
  24. 11
      conformance/text_format_conformance_suite.cc
  25. 2
      csharp/Google.Protobuf.Tools.nuspec
  26. 2
      csharp/src/Google.Protobuf/Google.Protobuf.csproj
  27. 664
      docs/options.md
  28. 201
      docs/third_party.md
  29. 6
      java/README.md
  30. 2
      java/bom/pom.xml
  31. 2
      java/core/pom.xml
  32. 25
      java/core/src/main/java/com/google/protobuf/GeneratedMessageV3.java
  33. 11
      java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java
  34. 95
      java/core/src/main/java/com/google/protobuf/TextFormat.java
  35. 2
      java/kotlin-lite/pom.xml
  36. 79
      java/kotlin-lite/src/test/kotlin/com/google/protobuf/Proto2LiteTest.kt
  37. 2
      java/kotlin/pom.xml
  38. 46
      java/kotlin/src/test/kotlin/com/google/protobuf/Proto2Test.kt
  39. 3
      java/kotlin/src/test/proto/com/google/protobuf/evil_names_proto2.proto
  40. 2
      java/lite.md
  41. 2
      java/lite/pom.xml
  42. 2
      java/pom.xml
  43. 2
      java/util/pom.xml
  44. 2
      kokoro/linux/java_linkage_monitor/build.sh
  45. 2
      kokoro/linux/python310/common.cfg
  46. 2
      kokoro/linux/python310_cpp/common.cfg
  47. 2
      kokoro/linux/python37/common.cfg
  48. 2
      kokoro/linux/python37_cpp/common.cfg
  49. 2
      kokoro/linux/python38/common.cfg
  50. 2
      kokoro/linux/python38_cpp/common.cfg
  51. 2
      kokoro/linux/python39/common.cfg
  52. 2
      kokoro/linux/python39_cpp/common.cfg
  53. 3
      kokoro/macos/php74/build.sh
  54. 1
      kokoro/macos/prepare_build_macos_rc
  55. 3
      kokoro/macos/python/build.sh
  56. 6
      kokoro/macos/python_cpp/build.sh
  57. 1
      kokoro/release/collect_all_artifacts.sh
  58. 5
      kokoro/windows/prepare_build_win64.bat
  59. 6
      objectivec/GPBAny.pbobjc.h
  60. 2
      objectivec/GPBAny.pbobjc.m
  61. 6
      objectivec/GPBApi.pbobjc.h
  62. 6
      objectivec/GPBApi.pbobjc.m
  63. 2
      objectivec/GPBBootstrap.h
  64. 44
      objectivec/GPBDescriptor.h
  65. 171
      objectivec/GPBDescriptor.m
  66. 73
      objectivec/GPBDescriptor_PackagePrivate.h
  67. 3
      objectivec/GPBDictionary.m
  68. 6
      objectivec/GPBDuration.pbobjc.h
  69. 2
      objectivec/GPBDuration.pbobjc.m
  70. 6
      objectivec/GPBEmpty.pbobjc.h
  71. 2
      objectivec/GPBEmpty.pbobjc.m
  72. 7
      objectivec/GPBExtensionInternals.h
  73. 110
      objectivec/GPBExtensionInternals.m
  74. 6
      objectivec/GPBFieldMask.pbobjc.h
  75. 2
      objectivec/GPBFieldMask.pbobjc.m
  76. 12
      objectivec/GPBMessage.h
  77. 186
      objectivec/GPBMessage.m
  78. 6
      objectivec/GPBSourceContext.pbobjc.h
  79. 2
      objectivec/GPBSourceContext.pbobjc.m
  80. 6
      objectivec/GPBStruct.pbobjc.h
  81. 9
      objectivec/GPBStruct.pbobjc.m
  82. 6
      objectivec/GPBTimestamp.pbobjc.h
  83. 2
      objectivec/GPBTimestamp.pbobjc.m
  84. 6
      objectivec/GPBType.pbobjc.h
  85. 243
      objectivec/GPBType.pbobjc.m
  86. 3
      objectivec/GPBUnknownFieldSet.h
  87. 3
      objectivec/GPBUtilities.m
  88. 6
      objectivec/GPBWrappers.pbobjc.h
  89. 18
      objectivec/GPBWrappers.pbobjc.m
  90. 27
      objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
  91. 6
      objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme
  92. 28
      objectivec/ProtocolBuffers_OSX.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme
  93. 19
      objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
  94. 15
      objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme
  95. 19
      objectivec/ProtocolBuffers_iOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme
  96. 15
      objectivec/ProtocolBuffers_tvOS.xcodeproj/project.pbxproj
  97. 24
      objectivec/ProtocolBuffers_tvOS.xcodeproj/xcshareddata/xcschemes/PerformanceTests.xcscheme
  98. 28
      objectivec/ProtocolBuffers_tvOS.xcodeproj/xcshareddata/xcschemes/ProtocolBuffers.xcscheme
  99. 76
      objectivec/Tests/GPBMessageTests.m
  100. 2
      php/ext/google/protobuf/config.m4
  101. Some files were not shown because too many files have changed in this diff Show More

@ -0,0 +1,36 @@
/src/ @protocolbuffers/protobuf-compiler
/src/google/protobuf/compiler/cpp @protocolbuffers/protobuf-cpp
/csharp/ @protocolbuffers/protobuf-csharp
/src/google/protobuf/compiler/csharp/ @protocolbuffers/protobuf-csharp
/docs/ @protocolbuffers/protobuf-docs
/examples/ @protocolbuffers/protobuf-docs
/java/ @protocolbuffers/protobuf-java
/src/google/protobuf/compiler/java/ @protocolbuffers/protobuf-java
/java/kotlin-lite/ @protocolbuffers/protobuf-kotlin
/java/kotlin/ @protocolbuffers/protobuf-kotlin
/objectivec/ @protocolbuffers/protobuf-objc
/src/google/protobuf/compiler/objectivec/ @protocolbuffers/protobuf-objc
/php/ @protocolbuffers/protobuf-php
/src/google/protobuf/compiler/php/ @protocolbuffers/protobuf-php
/python/ @protocolbuffers/protobuf-python
/src/google/protobuf/compiler/python/ @protocolbuffers/protobuf-python
/ruby/ @protocolbuffers/protobuf-ruby
/src/google/protobuf/compiler/ruby/ @protocolbuffers/protobuf-ruby
/build_defs/ @protocolbuffers/protobuf-btr
/cmake/ @protocolbuffers/protobuf-btr
/pkg/ @protocolbuffers/protobuf-btr
/toolchain/ @protocolbuffers/protobuf-btr
/conformance/ @protocolbuffers/protobuf-btr
/kokoro/ @protocolbuffers/protobuf-btr
/third_party/ @protocolbuffers/protobuf-btr
*.bazel @protocolbuffers/protobuf-btr

@ -0,0 +1,15 @@
mergeable:
pull_requests:
label:
and:
- must_exclude:
regex: '^disposition/DO NOT MERGE'
message: 'Pull request marked not mergeable'
- must_include:
regex: 'mergeable:force-allow'
message: 'Pull requests should not be merged directly and should instead
be handled by Copybara.
To enable Github merges, add the `mergeable:force-allow` label.
This should almost never be used except for releases or as a break glass measure
after discussing with the team.'

@ -24,7 +24,8 @@ jobs:
strategy:
fail-fast: false
matrix:
PLATFORM: ["ios", "macos", "tvos", "watchos"]
# Add back 'watchos'. See CocoaPods/CocoaPods#11558
PLATFORM: ["ios", "macos", "tvos"]
CONFIGURATION: ["Debug", "Release"]
steps:
- uses: actions/checkout@v2

@ -0,0 +1,45 @@
name: Update protobuf-php Repo
on:
push:
tags:
- v[0-9]+.[0-9]+
- v[0-9]+.[0-9]+-rc[0-9]+
jobs:
update-repo:
name: Update PHP Repo
runs-on: ubuntu-latest
steps:
- name: Checkout protobuf-php
uses: actions/checkout@v3
with:
repository: protocolbuffers/protobuf-php
token: ${{ secrets.BOT_ACCESS_TOKEN }}
- name: Clone protobuf
uses: actions/checkout@v3
with:
path: protobuf
- name: Configure Git Bot
run: |
git config user.name "Protobuf Team Bot"
git config user.email "protobuf-team-bot@google.com"
- name: Get PHP Version
run: |
unformatted_version=$( cat protobuf/version.json | jq -r '.main.languages.php' )
version=${unformatted_version/-rc/RC}
version_tag=v$version
echo "VERSION=$version" >> $GITHUB_ENV
echo "VERSION_TAG=$version_tag" >> $GITHUB_ENV
- name: Copy files
run: |
rm -rf src
cp -r protobuf/php/src .
cp protobuf/php/composer.json.dist composer.json
rm -rf protobuf
- name: Push Changes
run: |
git commit -a -m "$VERSION sync"
git push --force origin master
git tag -a $VERSION_TAG -m "Tag release $VERSION_TAG"
git push origin $VERSION_TAG

@ -81,6 +81,16 @@
* Print full path name of source .proto file on error
* Include proto message type in the annotation comments.
2022-11-29 version 21.10 (C++/Java/Python/PHP/Objective-C/C#/Ruby)
Java
* Use bit-field int values in buildPartial to skip work on unset groups of fields. (#10960)
* Mark nested builder as clean after clear is called (#10984)
UPB
* Fix UPB_LIKELY() for 32-bit Windows builds; update protobuf_deps to point to the current upb 21.x (#11028)
Other
* Add public modifiers to kotlin code (#11068)
2022-10-26 version 21.9 (C++/Java/Python/PHP/Objective-C/C#/Ruby)
C++

@ -238,7 +238,7 @@ if (NOT MSVC)
check_cxx_source_compiles("
#include <atomic>
int main() {
return std::atomic<int64_t>{};
return static_cast<int>(std::atomic<int64_t>{});
}
" protobuf_HAVE_BUILTIN_ATOMICS)
if (NOT protobuf_HAVE_BUILTIN_ATOMICS)

@ -0,0 +1,3 @@
This project is governed by
[Protobuf's Code of Conduct](https://github.com/protocolbuffers/.github/blob/main/profile/CODE_OF_CONDUCT.md).

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

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

@ -3,7 +3,7 @@ Protocol Buffers - Google's data interchange format
Copyright 2008 Google Inc.
https://developers.google.com/protocol-buffers/
[Protocol Buffers documentation](https://developers.google.com/protocol-buffers/)
Overview
--------
@ -24,18 +24,14 @@ the [C++ Installation Instructions](src/README.md) to install protoc along
with the C++ runtime.
For non-C++ users, the simplest way to install the protocol compiler is to
download a pre-built binary from our release page:
[https://github.com/protocolbuffers/protobuf/releases](https://github.com/protocolbuffers/protobuf/releases)
download a pre-built binary from our [GitHub release page](https://github.com/protocolbuffers/protobuf/releases).
In the downloads section of each release, you can find pre-built binaries in
zip packages: protoc-$VERSION-$PLATFORM.zip. It contains the protoc binary
as well as a set of standard .proto files distributed along with protobuf.
zip packages: `protoc-$VERSION-$PLATFORM.zip`. It contains the protoc binary
as well as a set of standard `.proto` files distributed along with protobuf.
If you are looking for an old version that is not available in the release
page, check out the maven repo here:
[https://repo1.maven.org/maven2/com/google/protobuf/protoc/](https://repo1.maven.org/maven2/com/google/protobuf/protoc/)
page, check out the [Maven repository](https://repo1.maven.org/maven2/com/google/protobuf/protoc/).
These pre-built binaries are only provided for released versions. If you want
to use the github main version at HEAD, or you need to modify protobuf code,
@ -67,10 +63,8 @@ how to install protobuf runtime for that specific language:
Quick Start
-----------
The best way to learn how to use protobuf is to follow the tutorials in our
developer guide:
https://developers.google.com/protocol-buffers/docs/tutorials
The best way to learn how to use protobuf is to follow the [tutorials in our
developer guide](https://developers.google.com/protocol-buffers/docs/tutorials).
If you want to learn from code examples, take a look at the examples in the
[examples](examples) directory.
@ -78,10 +72,7 @@ If you want to learn from code examples, take a look at the examples in the
Documentation
-------------
The complete documentation for Protocol Buffers is available via the
web at:
https://developers.google.com/protocol-buffers/
The complete documentation is available via the [Protocol Buffers documentation](https://developers.google.com/protocol-buffers/).
Developer Community
-------------------

@ -55,13 +55,6 @@ pinned_maven_install()
# For `cc_proto_blacklist_test` and `build_test`.
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
load("@rules_python//python:pip.bzl", "pip_install")
pip_install(
name="pip_deps",
requirements = "//python:requirements.txt"
)
bazel_skylib_workspace()
load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
@ -78,12 +71,27 @@ load("@upb//bazel:workspace_deps.bzl", "upb_deps")
upb_deps()
load("@upb//bazel:system_python.bzl", "system_python")
system_python(name = "local_config_python")
system_python(
name = "system_python",
minimum_python_version = "3.7",
)
load("@system_python//:pip.bzl", "pip_parse")
pip_parse(
name="pip_deps",
requirements = "@upb//python:requirements.txt",
requirements_overrides = {
"3.11": "@upb//python:requirements_311.txt",
},
)
load("@pip_deps//:requirements.bzl", "install_deps")
install_deps()
load("@utf8_range//:workspace_deps.bzl", "utf8_range_deps")
utf8_range_deps()
bind(
name = "python_headers",
actual = "@local_config_python//:python_headers",
actual = "@system_python//:python_headers",
)

@ -33,6 +33,8 @@
#include "google/protobuf/text_format.h"
#include "google/protobuf/util/json_util.h"
#include "google/protobuf/util/type_resolver_util.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "json/json.h"
@ -255,9 +257,10 @@ const FieldDescriptor* GetFieldForType(FieldDescriptor::Type type,
if (packed == Packed::kFalse) {
packed_string = "Unpacked ";
}
GOOGLE_LOG(FATAL) << "Couldn't find field with type: " << repeated_string.c_str()
<< packed_string.c_str() << FieldDescriptor::TypeName(type)
<< " for " << proto_string.c_str();
GOOGLE_ABSL_LOG(FATAL) << "Couldn't find field with type: "
<< repeated_string.c_str() << packed_string.c_str()
<< FieldDescriptor::TypeName(type) << " for "
<< proto_string.c_str();
return nullptr;
}
@ -279,10 +282,10 @@ const FieldDescriptor* GetFieldForMapType(FieldDescriptor::Type key_type,
}
const string proto_string = is_proto3 ? "Proto3" : "Proto2";
GOOGLE_LOG(FATAL) << "Couldn't find map field with type: "
<< FieldDescriptor::TypeName(key_type) << " and "
<< FieldDescriptor::TypeName(key_type) << " for "
<< proto_string.c_str();
GOOGLE_ABSL_LOG(FATAL) << "Couldn't find map field with type: "
<< FieldDescriptor::TypeName(key_type) << " and "
<< FieldDescriptor::TypeName(key_type) << " for "
<< proto_string.c_str();
return nullptr;
}
@ -299,9 +302,9 @@ const FieldDescriptor* GetFieldForOneofType(FieldDescriptor::Type type,
}
const string proto_string = is_proto3 ? "Proto3" : "Proto2";
GOOGLE_LOG(FATAL) << "Couldn't find oneof field with type: "
<< FieldDescriptor::TypeName(type) << " for "
<< proto_string.c_str();
GOOGLE_ABSL_LOG(FATAL) << "Couldn't find oneof field with type: "
<< FieldDescriptor::TypeName(type) << " for "
<< proto_string.c_str();
return nullptr;
}
@ -369,8 +372,8 @@ bool BinaryAndJsonConformanceSuite::ParseJsonResponse(
}
if (!test_message->ParseFromString(binary_protobuf)) {
GOOGLE_LOG(FATAL) << "INTERNAL ERROR: internal JSON->protobuf transcode "
<< "yielded unparseable proto.";
GOOGLE_ABSL_LOG(FATAL) << "INTERNAL ERROR: internal JSON->protobuf transcode "
<< "yielded unparseable proto.";
return false;
}
@ -426,8 +429,8 @@ bool BinaryAndJsonConformanceSuite::ParseResponse(
}
default:
GOOGLE_LOG(FATAL) << test_name
<< ": unknown payload type: " << response.result_case();
GOOGLE_ABSL_LOG(FATAL) << test_name
<< ": unknown payload type: " << response.result_case();
}
return true;
@ -678,7 +681,7 @@ void BinaryAndJsonConformanceSuite::ExpectParseFailureForJson(
void BinaryAndJsonConformanceSuite::ExpectSerializeFailureForJson(
const string& test_name, ConformanceLevel level, const string& text_format) {
TestAllTypesProto3 payload_message;
GOOGLE_CHECK(TextFormat::ParseFromString(text_format, &payload_message))
GOOGLE_ABSL_CHECK(TextFormat::ParseFromString(text_format, &payload_message))
<< "Failed to parse: " << text_format;
TestAllTypesProto3 prototype;
@ -1420,7 +1423,7 @@ void BinaryAndJsonConformanceSuite::RunSuiteImpl() {
req.set_protobuf_payload("");
req.set_requested_output_format(conformance::WireFormat::PROTOBUF);
RunTest("FindFailures", req, &res);
GOOGLE_CHECK(failure_set.MergeFromString(res.protobuf_payload()));
GOOGLE_ABSL_CHECK(failure_set.MergeFromString(res.protobuf_payload()));
for (const string& failure : failure_set.failure()) {
AddExpectedFailedTest(failure);
}
@ -1766,6 +1769,7 @@ void BinaryAndJsonConformanceSuite::RunJsonTests() {
RunJsonTestsForStruct();
RunJsonTestsForValue();
RunJsonTestsForAny();
RunJsonTestsForUnknownEnumStringValues();
RunValidJsonIgnoreUnknownTest("IgnoreUnknownJsonNumber", REQUIRED,
R"({
@ -1801,6 +1805,41 @@ void BinaryAndJsonConformanceSuite::RunJsonTests() {
ExpectParseFailureForJson("RejectTopLevelNull", REQUIRED, "null");
}
void BinaryAndJsonConformanceSuite::RunJsonTestsForUnknownEnumStringValues() {
// Tests the handling of unknown enum values when encoded as string labels.
// The expected behavior depends on whether unknown fields are ignored:
// * when ignored, the parser should ignore the unknown enum string value.
// * when not ignored, the parser should fail.
struct TestCase {
// Used in the test name.
string enum_location;
// JSON input which will contain the unknown field.
string input_json;
};
const std::vector<TestCase> test_cases = {
{"InOptionalField", R"json({
"optional_nested_enum": "UNKNOWN_ENUM_VALUE"
})json"},
{"InRepeatedField", R"json({
"repeated_nested_enum": ["UNKNOWN_ENUM_VALUE"]
})json"},
{"InMapValue", R"json({
"map_string_nested_enum": {"key": "UNKNOWN_ENUM_VALUE"}
})json"},
};
for (const TestCase& test_case : test_cases) {
// Unknown enum string value is a parse failure when not ignoring unknown
// fields.
ExpectParseFailureForJson(
absl::StrCat("RejectUnknownEnumStringValue", test_case.enum_location),
RECOMMENDED, test_case.input_json);
// Unknown enum string value is ignored when ignoring unknown fields.
RunValidJsonIgnoreUnknownTest(
absl::StrCat("IgnoreUnknownEnumStringValue", test_case.enum_location),
RECOMMENDED, test_case.input_json, "");
}
}
void BinaryAndJsonConformanceSuite::RunJsonTestsForFieldNameConvention() {
RunValidJsonTest(
"FieldNameInSnakeCase", REQUIRED,

@ -56,6 +56,7 @@ class BinaryAndJsonConformanceSuite : public ConformanceTestSuite {
void RunJsonTestsForStruct();
void RunJsonTestsForValue();
void RunJsonTestsForAny();
void RunJsonTestsForUnknownEnumStringValues();
void RunValidJsonTest(const std::string& test_name, ConformanceLevel level,
const std::string& input_json,
const std::string& equivalent_text_format);

@ -36,12 +36,12 @@
#include <string>
#include <utility>
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/common.h"
#include "google/protobuf/message.h"
#include "google/protobuf/text_format.h"
#include "google/protobuf/util/json_util.h"
#include "google/protobuf/util/type_resolver_util.h"
#include "google/protobuf/stubs/logging.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "conformance/conformance.pb.h"
@ -187,14 +187,14 @@ absl::StatusOr<ConformanceResponse> Harness::RunTest(
return absl::InvalidArgumentError("unspecified output format");
case conformance::PROTOBUF: {
GOOGLE_CHECK(
GOOGLE_ABSL_CHECK(
test_message->SerializeToString(response.mutable_protobuf_payload()));
break;
}
case conformance::JSON: {
std::string proto_binary;
GOOGLE_CHECK(test_message->SerializeToString(&proto_binary));
GOOGLE_ABSL_CHECK(test_message->SerializeToString(&proto_binary));
absl::Status status =
BinaryToJsonString(resolver_.get(), type_url_, proto_binary,
response.mutable_json_payload());
@ -208,8 +208,8 @@ absl::StatusOr<ConformanceResponse> Harness::RunTest(
case conformance::TEXT_FORMAT: {
TextFormat::Printer printer;
printer.SetHideUnknownFields(!request.print_unknown_fields());
GOOGLE_CHECK(printer.PrintToString(*test_message,
response.mutable_text_payload()));
GOOGLE_ABSL_CHECK(printer.PrintToString(*test_message,
response.mutable_text_payload()));
break;
}
@ -234,7 +234,7 @@ absl::StatusOr<bool> Harness::ServeConformanceRequest() {
RETURN_IF_ERROR(ReadFd(STDIN_FILENO, &serialized_input[0], in_len));
ConformanceRequest request;
GOOGLE_CHECK(request.ParseFromString(serialized_input));
GOOGLE_ABSL_CHECK(request.ParseFromString(serialized_input));
absl::StatusOr<ConformanceResponse> response = RunTest(request);
RETURN_IF_ERROR(response.status());
@ -247,8 +247,8 @@ absl::StatusOr<bool> Harness::ServeConformanceRequest() {
RETURN_IF_ERROR(WriteFd(STDOUT_FILENO, serialized_output.data(), out_len));
if (verbose_) {
GOOGLE_LOG(INFO) << "conformance-cpp: request=" << request.ShortDebugString()
<< ", response=" << response->ShortDebugString();
GOOGLE_ABSL_LOG(INFO) << "conformance-cpp: request=" << request.ShortDebugString()
<< ", response=" << response->ShortDebugString();
}
return false;
}
@ -262,13 +262,13 @@ int main() {
while (true) {
auto is_done = harness.ServeConformanceRequest();
if (!is_done.ok()) {
GOOGLE_LOG(FATAL) << is_done.status();
GOOGLE_ABSL_LOG(FATAL) << is_done.status();
}
if (*is_done) {
break;
}
total_runs++;
}
GOOGLE_LOG(INFO) << "conformance-cpp: received EOF from test runner after "
<< total_runs << " tests";
GOOGLE_ABSL_LOG(INFO) << "conformance-cpp: received EOF from test runner after "
<< total_runs << " tests";
}

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# https://developers.google.com/protocol-buffers/
@ -36,23 +36,21 @@ See conformance.proto for more information.
import struct
import sys
import os
from google.protobuf import json_format
from google.protobuf import message
from google.protobuf import test_messages_proto3_pb2
from google.protobuf import test_messages_proto2_pb2
from google.protobuf import text_format
from google.protobuf import test_messages_proto2_pb2
from google.protobuf import test_messages_proto3_pb2
from conformance import conformance_pb2
sys.stdout = os.fdopen(sys.stdout.fileno(), 'wb', 0)
sys.stdin = os.fdopen(sys.stdin.fileno(), 'rb', 0)
test_count = 0
verbose = False
class ProtocolError(Exception):
pass
def do_test(request):
response = conformance_pb2.ConformanceResponse()
@ -171,15 +169,16 @@ def do_test(request):
return response
def do_test_io():
length_bytes = sys.stdin.read(4)
length_bytes = sys.stdin.buffer.read(4)
if len(length_bytes) == 0:
return False # EOF
elif len(length_bytes) != 4:
raise IOError("I/O error")
length = struct.unpack("<I", length_bytes)[0]
serialized_request = sys.stdin.read(length)
serialized_request = sys.stdin.buffer.read(length)
if len(serialized_request) != length:
raise IOError("I/O error")
@ -189,9 +188,9 @@ def do_test_io():
response = do_test(request)
serialized_response = response.SerializeToString()
sys.stdout.write(struct.pack("<I", len(serialized_response)))
sys.stdout.write(serialized_response)
sys.stdout.flush()
sys.stdout.buffer.write(struct.pack("<I", len(serialized_response)))
sys.stdout.buffer.write(serialized_response)
sys.stdout.buffer.flush()
if verbose:
sys.stderr.write("conformance_python: request=%s, response=%s\n" % (

@ -41,6 +41,7 @@
#include "google/protobuf/util/field_comparator.h"
#include "google/protobuf/util/json_util.h"
#include "google/protobuf/util/message_differencer.h"
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "conformance/conformance.pb.h"
@ -111,7 +112,7 @@ ConformanceTestSuite::ConformanceRequestSetting::ConformanceRequestSetting(
}
default:
GOOGLE_LOG(FATAL) << "Unspecified input format";
GOOGLE_ABSL_LOG(FATAL) << "Unspecified input format";
}
request_.set_test_category(test_category);
@ -143,7 +144,7 @@ string ConformanceTestSuite::ConformanceRequestSetting::
case REQUIRED: return "Required";
case RECOMMENDED: return "Recommended";
}
GOOGLE_LOG(FATAL) << "Unknown value: " << level;
GOOGLE_ABSL_LOG(FATAL) << "Unknown value: " << level;
return "";
}
@ -157,7 +158,7 @@ string ConformanceTestSuite::ConformanceRequestSetting::
case conformance::TEXT_FORMAT:
return "TextFormatInput";
default:
GOOGLE_LOG(FATAL) << "Unspecified output format";
GOOGLE_ABSL_LOG(FATAL) << "Unspecified output format";
}
return "";
}
@ -172,7 +173,7 @@ string ConformanceTestSuite::ConformanceRequestSetting::
case conformance::TEXT_FORMAT:
return "TextFormatOutput";
default:
GOOGLE_LOG(FATAL) << "Unspecified output format";
GOOGLE_ABSL_LOG(FATAL) << "Unspecified output format";
}
return "";
}
@ -278,8 +279,8 @@ void ConformanceTestSuite::RunValidInputTest(
const ConformanceRequestSetting& setting,
const string& equivalent_text_format) {
std::unique_ptr<Message> reference_message(setting.NewTestMessage());
GOOGLE_CHECK(TextFormat::ParseFromString(equivalent_text_format,
reference_message.get()))
GOOGLE_ABSL_CHECK(TextFormat::ParseFromString(equivalent_text_format,
reference_message.get()))
<< "Failed to parse data for test case: " << setting.GetTestName()
<< ", data: " << equivalent_text_format;
const string equivalent_wire_format = reference_message->SerializeAsString();
@ -306,7 +307,7 @@ void ConformanceTestSuite::VerifyResponse(
ConformanceLevel level = setting.GetLevel();
std::unique_ptr<Message> reference_message = setting.NewTestMessage();
GOOGLE_CHECK(reference_message->ParseFromString(equivalent_wire_format))
GOOGLE_ABSL_CHECK(reference_message->ParseFromString(equivalent_wire_format))
<< "Failed to parse wire data for test case: " << test_name;
switch (response.result_case()) {
@ -341,7 +342,8 @@ void ConformanceTestSuite::VerifyResponse(
bool check = false;
if (require_same_wire_format) {
GOOGLE_DCHECK_EQ(response.result_case(), ConformanceResponse::kProtobufPayload);
GOOGLE_ABSL_DCHECK_EQ(response.result_case(),
ConformanceResponse::kProtobufPayload);
const string& protobuf_payload = response.protobuf_payload();
check = equivalent_wire_format == protobuf_payload;
differences = absl::StrCat("Expect: ", ToOctString(equivalent_wire_format),
@ -366,7 +368,7 @@ void ConformanceTestSuite::RunTest(const string& test_name,
const ConformanceRequest& request,
ConformanceResponse* response) {
if (test_names_.insert(test_name).second == false) {
GOOGLE_LOG(FATAL) << "Duplicated test name: " << test_name;
GOOGLE_ABSL_LOG(FATAL) << "Duplicated test name: " << test_name;
}
string serialized_request;
@ -441,7 +443,7 @@ string ConformanceTestSuite::WireFormatToString(
case conformance::UNSPECIFIED:
return "UNSPECIFIED";
default:
GOOGLE_LOG(FATAL) << "unknown wire type: " << wire_format;
GOOGLE_ABSL_LOG(FATAL) << "unknown wire type: " << wire_format;
}
return "";
}

@ -65,6 +65,7 @@
#include <future>
#include <vector>
#include "google/protobuf/stubs/logging.h"
#include "absl/strings/str_format.h"
#include "conformance/conformance.pb.h"
#include "conformance_test.h"
@ -76,7 +77,7 @@ using std::vector;
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define GOOGLE_CHECK_SYSCALL(call) \
#define CHECK_SYSCALL(call) \
if (call < 0) { \
perror(#call " " __FILE__ ":" TOSTRING(__LINE__)); \
exit(1); \
@ -160,7 +161,7 @@ void ForkPipeRunner::RunTest(const std::string &test_name,
if (!TryRead(read_fd_, &len, sizeof(uint32_t))) {
// We failed to read from the child, assume a crash and try to reap.
GOOGLE_LOG(INFO) << "Trying to reap child, pid=" << child_pid_;
GOOGLE_ABSL_LOG(INFO) << "Trying to reap child, pid=" << child_pid_;
int status = 0;
waitpid(child_pid_, &status, WEXITED);
@ -182,7 +183,7 @@ void ForkPipeRunner::RunTest(const std::string &test_name,
absl::StrAppendFormat(&error_msg, "child killed by signal %d",
WTERMSIG(status));
}
GOOGLE_LOG(INFO) << error_msg;
GOOGLE_ABSL_LOG(INFO) << error_msg;
child_pid_ = -1;
response_obj.SerializeToString(response);
@ -288,22 +289,22 @@ void ForkPipeRunner::SpawnTestProgram() {
if (pid) {
// Parent.
GOOGLE_CHECK_SYSCALL(close(toproc_pipe_fd[0]));
GOOGLE_CHECK_SYSCALL(close(fromproc_pipe_fd[1]));
CHECK_SYSCALL(close(toproc_pipe_fd[0]));
CHECK_SYSCALL(close(fromproc_pipe_fd[1]));
write_fd_ = toproc_pipe_fd[1];
read_fd_ = fromproc_pipe_fd[0];
child_pid_ = pid;
} else {
// Child.
GOOGLE_CHECK_SYSCALL(close(STDIN_FILENO));
GOOGLE_CHECK_SYSCALL(close(STDOUT_FILENO));
GOOGLE_CHECK_SYSCALL(dup2(toproc_pipe_fd[0], STDIN_FILENO));
GOOGLE_CHECK_SYSCALL(dup2(fromproc_pipe_fd[1], STDOUT_FILENO));
CHECK_SYSCALL(close(STDIN_FILENO));
CHECK_SYSCALL(close(STDOUT_FILENO));
CHECK_SYSCALL(dup2(toproc_pipe_fd[0], STDIN_FILENO));
CHECK_SYSCALL(dup2(fromproc_pipe_fd[1], STDOUT_FILENO));
GOOGLE_CHECK_SYSCALL(close(toproc_pipe_fd[0]));
GOOGLE_CHECK_SYSCALL(close(fromproc_pipe_fd[1]));
GOOGLE_CHECK_SYSCALL(close(toproc_pipe_fd[1]));
GOOGLE_CHECK_SYSCALL(close(fromproc_pipe_fd[0]));
CHECK_SYSCALL(close(toproc_pipe_fd[0]));
CHECK_SYSCALL(close(fromproc_pipe_fd[1]));
CHECK_SYSCALL(close(toproc_pipe_fd[1]));
CHECK_SYSCALL(close(fromproc_pipe_fd[0]));
std::unique_ptr<char[]> executable(new char[executable_.size() + 1]);
memcpy(executable.get(), executable_.c_str(), executable_.size());
@ -311,21 +312,21 @@ void ForkPipeRunner::SpawnTestProgram() {
std::vector<const char *> argv;
argv.push_back(executable.get());
GOOGLE_LOG(INFO) << argv[0];
GOOGLE_ABSL_LOG(INFO) << argv[0];
for (size_t i = 0; i < executable_args_.size(); ++i) {
argv.push_back(executable_args_[i].c_str());
GOOGLE_LOG(INFO) << executable_args_[i];
GOOGLE_ABSL_LOG(INFO) << executable_args_[i];
}
argv.push_back(nullptr);
// Never returns.
GOOGLE_CHECK_SYSCALL(execv(executable.get(), const_cast<char **>(argv.data())));
CHECK_SYSCALL(execv(executable.get(), const_cast<char **>(argv.data())));
}
}
void ForkPipeRunner::CheckedWrite(int fd, const void *buf, size_t len) {
if (static_cast<size_t>(write(fd, buf, len)) != len) {
GOOGLE_LOG(FATAL) << current_test_name_
<< ": error writing to test program: " << strerror(errno);
GOOGLE_ABSL_LOG(FATAL) << current_test_name_
<< ": error writing to test program: " << strerror(errno);
}
}
@ -342,7 +343,7 @@ bool ForkPipeRunner::TryRead(int fd, void *buf, size_t len) {
if (performance_) {
status = future.wait_for(std::chrono::seconds(5));
if (status == std::future_status::timeout) {
GOOGLE_LOG(ERROR) << current_test_name_ << ": timeout from test program";
GOOGLE_ABSL_LOG(ERROR) << current_test_name_ << ": timeout from test program";
kill(child_pid_, SIGQUIT);
// TODO(sandyzhang): Only log in flag-guarded mode, since reading output
// from SIGQUIT is slow and verbose.
@ -355,7 +356,8 @@ bool ForkPipeRunner::TryRead(int fd, void *buf, size_t len) {
read(fd, (void *)&err[err_ofs], err.size() - err_ofs);
err_ofs += err_bytes_read;
} while (err_bytes_read > 0 && err_ofs < err.size());
GOOGLE_LOG(ERROR) << "child_pid_=" << child_pid_ << " SIGQUIT: \n" << &err[0];
GOOGLE_ABSL_LOG(ERROR) << "child_pid_=" << child_pid_ << " SIGQUIT: \n"
<< &err[0];
return false;
}
} else {
@ -363,11 +365,13 @@ bool ForkPipeRunner::TryRead(int fd, void *buf, size_t len) {
}
ssize_t bytes_read = future.get();
if (bytes_read == 0) {
GOOGLE_LOG(ERROR) << current_test_name_ << ": unexpected EOF from test program";
GOOGLE_ABSL_LOG(ERROR) << current_test_name_
<< ": unexpected EOF from test program";
return false;
} else if (bytes_read < 0) {
GOOGLE_LOG(ERROR) << current_test_name_
<< ": error reading from test program: " << strerror(errno);
GOOGLE_ABSL_LOG(ERROR) << current_test_name_
<< ": error reading from test program: "
<< strerror(errno);
return false;
}
@ -380,8 +384,8 @@ bool ForkPipeRunner::TryRead(int fd, void *buf, size_t len) {
void ForkPipeRunner::CheckedRead(int fd, void *buf, size_t len) {
if (!TryRead(fd, buf, len)) {
GOOGLE_LOG(FATAL) << current_test_name_
<< ": error reading from test program: " << strerror(errno);
GOOGLE_ABSL_LOG(FATAL) << current_test_name_
<< ": error reading from test program: " << strerror(errno);
}
}

@ -17,6 +17,7 @@ Recommended.Proto3.JsonInput.FieldNameDuplicate
Recommended.Proto3.JsonInput.FieldNameDuplicateDifferentCasing1
Recommended.Proto3.JsonInput.FieldNameDuplicateDifferentCasing2
Recommended.Proto3.JsonInput.FieldNameNotQuoted
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput
Recommended.Proto3.JsonInput.MapFieldValueIsNull
Recommended.Proto3.JsonInput.RepeatedFieldMessageElementIsNull
Recommended.Proto3.JsonInput.RepeatedFieldPrimitiveElementIsNull

@ -5,6 +5,8 @@ Recommended.Proto2.JsonInput.FieldNameExtension.Validator
Recommended.Proto3.JsonInput.BytesFieldBase64Url.JsonOutput
Recommended.Proto3.JsonInput.BytesFieldBase64Url.ProtobufOutput
Recommended.Proto3.JsonInput.FieldMaskInvalidCharacter
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.Merge.ProtobufOutput
Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator
Required.Proto3.JsonInput.DoubleFieldTooSmall

@ -1,2 +1,4 @@
Recommended.Proto2.JsonInput.FieldNameExtension.Validator
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput
Required.Proto2.JsonInput.StoresDefaultPrimitive.Validator

@ -0,0 +1,3 @@
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInOptionalField.ProtobufOutput
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput

@ -6,3 +6,6 @@
#
# TODO(haberman): insert links to corresponding bugs tracking the issue.
# Should we use GitHub issues or the Google-internal bug tracker?
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInOptionalField.ProtobufOutput
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput

@ -27,6 +27,8 @@ Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.PackedInput.PackedOutp
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT32.UnpackedInput.PackedOutput.ProtobufOutput
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.PackedInput.PackedOutput.ProtobufOutput
Recommended.Proto2.ProtobufInput.ValidDataRepeated.UINT64.UnpackedInput.PackedOutput.ProtobufOutput
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInMapValue.ProtobufOutput
Recommended.Proto3.JsonInput.IgnoreUnknownEnumStringValueInRepeatedField.ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.Merge.ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.PackedInput.UnpackedOutput.ProtobufOutput
Recommended.Proto3.ProtobufInput.ValidDataRepeated.BOOL.UnpackedInput.UnpackedOutput.ProtobufOutput

@ -32,6 +32,7 @@
#include "google/protobuf/any.pb.h"
#include "google/protobuf/text_format.h"
#include "google/protobuf/stubs/logging.h"
#include "conformance_test.h"
#include "google/protobuf/test_messages_proto2.pb.h"
#include "google/protobuf/test_messages_proto3.pb.h"
@ -68,9 +69,9 @@ bool TextFormatConformanceTestSuite::ParseTextFormatResponse(
parser.AllowFieldNumber(true);
}
if (!parser.ParseFromString(response.text_payload(), test_message)) {
GOOGLE_LOG(ERROR) << "INTERNAL ERROR: internal text->protobuf transcode "
<< "yielded unparseable proto. Text payload: "
<< response.text_payload();
GOOGLE_ABSL_LOG(ERROR) << "INTERNAL ERROR: internal text->protobuf transcode "
<< "yielded unparseable proto. Text payload: "
<< response.text_payload();
return false;
}
@ -125,8 +126,8 @@ bool TextFormatConformanceTestSuite::ParseResponse(
}
default:
GOOGLE_LOG(FATAL) << test_name
<< ": unknown payload type: " << response.result_case();
GOOGLE_ABSL_LOG(FATAL) << test_name
<< ": unknown payload type: " << response.result_case();
}
return true;

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

@ -5,7 +5,7 @@
<Description>C# runtime library for Protocol Buffers - Google's data interchange format.</Description>
<Copyright>Copyright 2015, Google Inc.</Copyright>
<AssemblyTitle>Google Protocol Buffers</AssemblyTitle>
<VersionPrefix>3.21.9</VersionPrefix>
<VersionPrefix>3.21.10</VersionPrefix>
<LangVersion>10.0</LangVersion>
<Authors>Google Inc.</Authors>
<TargetFrameworks>netstandard1.1;netstandard2.0;net45;net50</TargetFrameworks>

@ -13,342 +13,446 @@ with info about your project (name and website) so we can add an entry for you.
## Existing Registered Extensions
1. C# port of protocol buffers
* Website: https://github.com/jskeet/protobuf-csharp-port
* Extensions: 1000
1. C# port of protocol buffers
1. Perl/XS port of protocol buffers
* Website: http://code.google.com/p/protobuf-perlxs
* Extensions: 1001
* Website: https://github.com/jskeet/protobuf-csharp-port
* Extensions: 1000
1. Objective-C port of protocol buffers
* Website: http://code.google.com/p/protobuf-objc
* Extensions: 1002
1. Perl/XS port of protocol buffers
1. Google Wave Federation Protocol open-source release (FedOne)
* Website: http://code.google.com/p/wave-protocol
* Extensions: 1003
* Website: http://code.google.com/p/protobuf-perlxs
* Extensions: 1001
1. PHP code generator plugin
* Website: ???
* Extensions: 1004
1. Objective-C port of protocol buffers
1. GWT code generator plugin (third-party!)
* Website: http://code.google.com/p/protobuf-gwt/
* Extensions: 1005
* Website: http://code.google.com/p/protobuf-objc
* Extensions: 1002
1. Unix Domain RPC code generator plugin
* Website: http://go/udrpc
* Extensions: 1006
1. Google Wave Federation Protocol open-source release (FedOne)
1. Object-C generator plugin (Plausible Labs)
* Website: http://www.plausible.coop
* Extensions: 1007
* Website: http://code.google.com/p/wave-protocol
* Extensions: 1003
1. TBD (code42.com)
* Website: ???
* Extensions: 1008
1. PHP code generator plugin
1. Goby Underwater Autonomy Project
* Website: https://github.com/GobySoft/goby
* Extensions: 1009
* Website: ???
* Extensions: 1004
1. Nanopb
* Website: http://kapsi.fi/~jpa/nanopb
* Extensions: 1010
1. GWT code generator plugin (third-party!)
1. Bluefin AUV Communication Extensions
* Website: http://www.bluefinrobotics.com
* Extensions: 1011
* Website: http://code.google.com/p/protobuf-gwt/
* Extensions: 1005
1. Dynamic Compact Control Language
* Website: http://github.com/GobySoft/dccl
* Extensions: 1012
1. Unix Domain RPC code generator plugin
1. ScaleOut StateServer® Native C++ API
* Website: http://www.scaleoutsoftware.com
* Extensions: 1013
* Website: http://go/udrpc
* Extensions: 1006
1. FoundationDB SQL Layer
* Website: https://github.com/FoundationDB/sql-layer
* Extensions: 1014
1. Object-C generator plugin (Plausible Labs)
1. Fender
* Website: https://github.com/hassox/fender
* Extensions: 1015
* Website: http://www.plausible.coop
* Extensions: 1007
1. Vortex
* Website: http://www.prismtech.com/vortex
* Extensions: 1016
1. TBD (code42.com)
1. tresorit
* Website: https://tresorit.com/
* Extensions: 1017
* Website: ???
* Extensions: 1008
1. CRIU (Checkpoint Restore In Userspace)
* Website: http://criu.org/Main_Page
* Extensions: 1018
1. Goby Underwater Autonomy Project
1. protobuf-c
* Website: https://github.com/protobuf-c/protobuf-c
* Extensions: 1019
* Website: https://github.com/GobySoft/goby
* Extensions: 1009
1. ScalaPB
* Website: https://scalapb.github.io/
* Extensions: 1020
1. Nanopb
1. protoc-gen-bq-schema
* Website: https://github.com/GoogleCloudPlatform/protoc-gen-bq-schema
* Extensions: 1021
* Website: http://kapsi.fi/~jpa/nanopb
* Extensions: 1010
1. grpc-gateway
* Website: https://github.com/gengo/grpc-gateway
* Extensions: 1022
1. Bluefin AUV Communication Extensions
1. Certificate Transparency
* Website: https://github.com/google/certificate-transparency
* Extensions: 1023
* Website: http://www.bluefinrobotics.com
* Extensions: 1011
1. JUNOS Router Telemetry
* Website: http://www.juniper.net
* Extensions: 1024
1. Dynamic Compact Control Language
1. Spine Event Engine
* Website: https://github.com/SpineEventEngine/core-java
* Extensions: 1025
* Website: http://github.com/GobySoft/dccl
* Extensions: 1012
1. Aruba cloud platform
* Website: ???
* Extensions: 1026 -> 1030
1. ScaleOut StateServer® Native C++ API
1. Voltha
* Website: ???
* Extensions: 1031 -> 1033
* Website: http://www.scaleoutsoftware.com
* Extensions: 1013
1. gator
* Website: ???
* Extensions: 1034
1. FoundationDB SQL Layer
1. protoc-gen-flowtypes
* Website: https://github.com/tmc/grpcutil/tree/master/protoc-gen-flowtypes
* Extensions: 1035
* Website: https://github.com/FoundationDB/sql-layer
* Extensions: 1014
1. ProfaneDB
* Website: https://gitlab.com/ProfaneDB/ProfaneDB
* Extensions: 1036
1. Fender
1. protobuf-net
* Website: https://github.com/mgravell/protobuf-net
* Extensions: 1037
* Website: https://github.com/hassox/fender
* Extensions: 1015
1. FICO / StreamEngine
* Website: http://www.fico.com/
* Extensions: 1038
1. Vortex
1. GopherJS
* Website: https://github.com/johanbrandhorst/protobuf
* Extensions: 1039
* Website: http://www.prismtech.com/vortex
* Extensions: 1016
1. ygot
* Website: https://github.com/openconfig/ygot
* Extensions: 1040
1. tresorit
1. go-grpcmw
* Website: https://github.com/MarquisIO/go-grpcmw
* Extensions: 1041
* Website: https://tresorit.com/
* Extensions: 1017
1. grpc-gateway protoc-gen-swagger
* Website: https://github.com/grpc-ecosystem/grpc-gateway
* Extensions: 1042
1. CRIU (Checkpoint Restore In Userspace)
1. AN Message
* Website: TBD
* Extensions: 1043
* Website: http://criu.org/Main_Page
* Extensions: 1018
1. protofire
* Website: https://github.com/ribrdb/protofire
* Extensions: 1044
1. protobuf-c
1. Gravity
* Website: https://github.com/aphysci/gravity
* Extensions: 1045
* Website: https://github.com/protobuf-c/protobuf-c
* Extensions: 1019
1. SEMI Standards – I&C Technical Committee
* Website: http://downloads.semi.org/web/wstdsbal.nsf/9c2b317e76523cca88257641005a47f5/88a5863a580e323088256e7b00707489!OpenDocument
* Extensions: 1046
1. ScalaPB
1. Elixir plugin
* Website: https://github.com/tony612/grpc-elixir
* Extensions: 1047
* Website: https://scalapb.github.io/
* Extensions: 1020
1. API client generators
* Website: ???
* Extensions: 1048-1056
1. protoc-gen-bq-schema
1. Netifi Proteus
* Website: https://github.com/netifi-proteus
* Extensions: 1057
* Website: https://github.com/GoogleCloudPlatform/protoc-gen-bq-schema
* Extensions: 1021
1. CGSN Mooring Project
* Website: https://bitbucket.org/ooicgsn/cgsn-mooring
* Extensions: 1058
1. grpc-gateway
1. Container Storage Interface
* Website: https://github.com/container-storage-interface/spec
* Extensions: 1059-1069
* Website: https://github.com/gengo/grpc-gateway
* Extensions: 1022
1. TwirpQL Plugin
* Website: https://twirpql.dev
* Extensions: 1070
1. Certificate Transparency
1. Protoc-gen-validate
* Website: https://github.com/envoyproxy/protoc-gen-validate
* Extensions: 1071
* Website: https://github.com/google/certificate-transparency
* Extensions: 1023
1. Protokt
* Website: https://github.com/open-toast/protokt
* Extensions: 1072
1. JUNOS Router Telemetry
1. Dart port of protocol buffers
* Website https://github.com/dart-lang/protobuf
* Extensions: 1073
* Website: http://www.juniper.net
* Extensions: 1024
1. Ocaml-protoc-plugin
* Website: https://github.com/issuu/ocaml-protoc-plugin
* Extensions: 1074
1. Spine Event Engine
1. Analyze Re Graphene
* Website: https://analyzere.com
* Extensions: 1075
* Website: https://github.com/SpineEventEngine/core-java
* Extensions: 1025
1. Wire since and until
* Website: https://square.github.io/wire/
* Extensions: 1076, 1077
1. Aruba cloud platform
1. Bazel, Failure Details
* Website: https://github.com/bazelbuild/bazel
* Extensions: 1078
* Website: ???
* Extensions: 1026 -> 1030
1. grpc-graphql-gateway
* Website: https://github.com/ysugimoto/grpc-graphql-gateway
* Extensions: 1079
1. Voltha
1. Cloudstate
* Website: https://cloudstate.io
* Extensions: 1080-1084
* Website: ???
* Extensions: 1031 -> 1033
1. SummaFT protoc-plugins
* Website: https://summaft.com/
* Extensions: 1085
1. gator
1. ADLINK EdgeSDK
* Website: https://www.adlinktech.com/en/Edge-SDK-IoT
* Extensions: 1086
* Website: ???
* Extensions: 1034
1. Wire wire_package
* Website: https://square.github.io/wire/
* Extensions: 1087
1. protoc-gen-flowtypes
1. Confluent Schema Registry
* Website: https://github.com/confluentinc/schema-registry
* Extensions: 1088
1. ScalaPB Validate
* Website: https://scalapb.github.io/docs/validation
* Extension: 1089
1. Astounding (Currently Private)
* Website: https://github.com/PbPipes/Astounding
* Extension: 1090
1. Protoc-gen-psql
* Website: https://github.com/Intrinsec/protoc-gen-psql
* Extension: 1091-1101
1. Protoc-gen-sanitize
* Website: https://github.com/Intrinsec/protoc-gen-sanitize
* Extension: 1102-1106
1. Coach Client Connect (planned release in March 2021)
* Website: https://www.coachclientconnect.com
* Extension: 1107
1. Kratos API Errors
* Website: https://go-kratos.dev
* Extension: 1108
1. Glitchdot (Currently Private)
* Website: https://go.glitchdot.com
* Extension: 1109
1. eigr/protocol
* Website: https://eigr.io
* Extension: 1110-1114
1. Container Object Storage Interface (COSI)
* Website: https://github.com/kubernetes-sigs/container-object-storage-interface-spec
* Extension: 1115-1124
1. Protoc-gen-jsonschema
* Website: https://github.com/chrusty/protoc-gen-jsonschema
* Extension: 1125-1129
1. Protoc-gen-checker
* Website: https://github.com/Intrinsec/protoc-gen-checker
* Extension: 1130-1139
1. Protoc-gen-go-svc
* Website: https://github.com/dane/protoc-gen-go-svc
* Extension: 1140
1. Embedded Proto
* Website: https://EmbeddedProto.com
* Extension: 1141
1. Protoc-gen-fieldmask
* Website: https://github.com/yeqown/protoc-gen-fieldmask
* Extension: 1142
1. Google Gnostic
* Website: https://github.com/google/gnostic
* Extension: 1143
1. Protoc-gen-go-micro
* Website: https://github.com/unistack-org/protoc-gen-go-micro
* Extension: 1144
1. Protoc-gen-authz
* Website: https://github.com/Neakxs/protoc-gen-authz
* Extension: 1145
1. Protonium
* Website: https://github.com/zyp/protonium
* Extension: 1146
1. Protoc-gen-xo
* Website: https://github.com/xo/ecosystem
* Extension: 1147
1. Ballerina gRPC
* Website: https://github.com/ballerina-platform/module-ballerina-grpc
* Extension: 1148
1. Protoc-gen-referential-integrity
* Website: https://github.com/ComponentCorp/protoc-gen-referential-integrity
* Extension: 1149
1. Oclea Service Layer RPC
* Website: https://oclea.com/
* Extension: 1150
1. mypy-protobuf
* Website: https://github.com/nipunn1313/mypy-protobuf
* Extension: 1151-1154
1. Pigweed protobuf compiler
* Website: https://pigweed.dev/pw_protobuf
* Extension: 1155
1. Perfetto
* Website: https://perfetto.dev
* Extension: 1156
* Website:
https://github.com/tmc/grpcutil/tree/master/protoc-gen-flowtypes
* Extensions: 1035
1. ProfaneDB
* Website: https://gitlab.com/ProfaneDB/ProfaneDB
* Extensions: 1036
1. protobuf-net
* Website: https://github.com/mgravell/protobuf-net
* Extensions: 1037
1. FICO / StreamEngine
* Website: http://www.fico.com/
* Extensions: 1038
1. GopherJS
* Website: https://github.com/johanbrandhorst/protobuf
* Extensions: 1039
1. ygot
* Website: https://github.com/openconfig/ygot
* Extensions: 1040
1. go-grpcmw
* Website: https://github.com/MarquisIO/go-grpcmw
* Extensions: 1041
1. grpc-gateway protoc-gen-swagger
* Website: https://github.com/grpc-ecosystem/grpc-gateway
* Extensions: 1042
1. AN Message
* Website: TBD
* Extensions: 1043
1. protofire
* Website: https://github.com/ribrdb/protofire
* Extensions: 1044
1. Gravity
* Website: https://github.com/aphysci/gravity
* Extensions: 1045
1. SEMI Standards – I&C Technical Committee
* Website:
http://downloads.semi.org/web/wstdsbal.nsf/9c2b317e76523cca88257641005a47f5/88a5863a580e323088256e7b00707489!OpenDocument
* Extensions: 1046
1. Elixir plugin
* Website: https://github.com/tony612/grpc-elixir
* Extensions: 1047
1. API client generators
* Website: ???
* Extensions: 1048-1056
1. Netifi Proteus
* Website: https://github.com/netifi-proteus
* Extensions: 1057
1. CGSN Mooring Project
* Website: https://bitbucket.org/ooicgsn/cgsn-mooring
* Extensions: 1058
1. Container Storage Interface
* Website: https://github.com/container-storage-interface/spec
* Extensions: 1059-1069
1. TwirpQL Plugin
* Website: https://twirpql.dev
* Extensions: 1070
1. Protoc-gen-validate
* Website: https://github.com/bufbuild/protoc-gen-validate
* Extensions: 1071
1. Protokt
* Website: https://github.com/open-toast/protokt
* Extensions: 1072
1. Dart port of protocol buffers
* Website https://github.com/dart-lang/protobuf
* Extensions: 1073
1. Ocaml-protoc-plugin
* Website: https://github.com/issuu/ocaml-protoc-plugin
* Extensions: 1074
1. Analyze Re Graphene
* Website: https://analyzere.com
* Extensions: 1075
1. Wire since and until
* Website: https://square.github.io/wire/
* Extensions: 1076, 1077
1. Bazel, Failure Details
* Website: https://github.com/bazelbuild/bazel
* Extensions: 1078
1. grpc-graphql-gateway
* Website: https://github.com/ysugimoto/grpc-graphql-gateway
* Extensions: 1079
1. Cloudstate
* Website: https://cloudstate.io
* Extensions: 1080-1084
1. SummaFT protoc-plugins
* Website: https://summaft.com/
* Extensions: 1085
1. ADLINK EdgeSDK
* Website: https://www.adlinktech.com/en/Edge-SDK-IoT
* Extensions: 1086
1. Wire wire_package
* Website: https://square.github.io/wire/
* Extensions: 1087
1. Confluent Schema Registry
* Website: https://github.com/confluentinc/schema-registry
* Extensions: 1088
1. ScalaPB Validate
* Website: https://scalapb.github.io/docs/validation
* Extension: 1089
1. Astounding (Currently Private)
* Website: https://github.com/PbPipes/Astounding
* Extension: 1090
1. Protoc-gen-psql
* Website: https://github.com/Intrinsec/protoc-gen-psql
* Extension: 1091-1101
1. Protoc-gen-sanitize
* Website: https://github.com/Intrinsec/protoc-gen-sanitize
* Extension: 1102-1106
1. Coach Client Connect (planned release in March 2021)
* Website: https://www.coachclientconnect.com
* Extension: 1107
1. Kratos API Errors
* Website: https://go-kratos.dev
* Extension: 1108
1. Glitchdot (Currently Private)
* Website: https://go.glitchdot.com
* Extension: 1109
1. eigr/protocol
* Website: https://eigr.io
* Extension: 1110-1114
1. Container Object Storage Interface (COSI)
* Website:
https://github.com/kubernetes-sigs/container-object-storage-interface-spec
* Extension: 1115-1124
1. Protoc-gen-jsonschema
* Website: https://github.com/chrusty/protoc-gen-jsonschema
* Extension: 1125-1129
1. Protoc-gen-checker
* Website: https://github.com/Intrinsec/protoc-gen-checker
* Extension: 1130-1139
1. Protoc-gen-go-svc
* Website: https://github.com/dane/protoc-gen-go-svc
* Extension: 1140
1. Embedded Proto
* Website: https://EmbeddedProto.com
* Extension: 1141
1. Protoc-gen-fieldmask
* Website: https://github.com/yeqown/protoc-gen-fieldmask
* Extension: 1142
1. Google Gnostic
* Website: https://github.com/google/gnostic
* Extension: 1143
1. Protoc-gen-go-micro
* Website: https://github.com/unistack-org/protoc-gen-go-micro
* Extension: 1144
1. Protoc-gen-authz
* Website: https://github.com/Neakxs/protoc-gen-authz
* Extension: 1145
1. Protonium
* Website: https://github.com/zyp/protonium
* Extension: 1146
1. Protoc-gen-xo
* Website: https://github.com/xo/ecosystem
* Extension: 1147
1. Ballerina gRPC
* Website: https://github.com/ballerina-platform/module-ballerina-grpc
* Extension: 1148
1. Protoc-gen-referential-integrity
* Website:
https://github.com/ComponentCorp/protoc-gen-referential-integrity
* Extension: 1149
1. Oclea Service Layer RPC
* Website: https://oclea.com/
* Extension: 1150
1. mypy-protobuf
* Website: https://github.com/nipunn1313/mypy-protobuf
* Extension: 1151-1154
1. Pigweed protobuf compiler
* Website: https://pigweed.dev/pw_protobuf
* Extension: 1155
1. Perfetto
* Website: https://perfetto.dev
* Extension: 1156
1. Buf
* Website: http://buf.build/
* Extension: 1157-1166
1. Connect
* Website: http://connect.build/
* Extension: 1167-1176
1. protocel
* Website: https://github.com/Neakxs/protocel
* Extension: 1177-1178

@ -7,110 +7,103 @@ If you have a project that should be listed here, please
## Programming Languages
These are projects we know about implementing Protocol Buffers for other programming languages:
* Action Script: https://code.google.com/p/protobuf-actionscript3/
* Action Script: https://code.google.com/p/protoc-gen-as3/
* Action Script: https://github.com/matrix3d/JProtoc
* Action Script: https://github.com/zhongfq/protobuf-as3/
* Ada: https://github.com/reznikmm/protobuf
* C: https://github.com/protobuf-c/protobuf-c
* C: https://koti.kapsi.fi/jpa/nanopb/
* C: https://github.com/cloudwu/pbc/
* C: https://github.com/haberman/upb/wiki
* C: https://github.com/squidfunk/protobluff
* C: https://github.com/eerimoq/pbtools
* C++: https://github.com/protocolbuffers/protobuf (Google-official implementation)
* C++: https://EmbeddedProto.com
* C/C++: http://spbc.sf.net/
* C#: https://code.google.com/p/protobuf-csharp-port
* C#: https://silentorbit.com/protobuf/
* C#/.NET/WCF/VB: https://code.google.com/p/protobuf-net/
* Clojure: http://github.com/ninjudd/clojure-protobuf
* Clojure: https://github.com/clojusc/protobuf
* Clojure: https://protojure.readthedocs.io
* Common Lisp: http://github.com/brown/protobuf
* Common Lisp: http://github.com/qitab/cl-protobuf
* D: https://github.com/dcarp/protobuf-d
* D: https://github.com/msoucy/dproto
* D: https://github.com/opticron/ProtocolBuffer
* Dart: https://github.com/dart-lang/dart-protobuf (runtime) https://github.com/dart-lang/dart-protoc-plugin (code generator)
* Delphi: http://sourceforge.net/projects/protobuf-delphi/
* Delphi: http://fundementals.sourceforge.net/dl.html
* Elixir: https://github.com/jeremyong/exprotoc
* Elixir: https://github.com/tony612/protobuf-elixir
* Elixir: https://github.com/ahamez/protox
* Elm: https://github.com/tiziano88/elm-protobuf
* Erlang: https://github.com/tomas-abrahamsson/gpb
* Erlang: http://piqi.org/
* Erlang: https://github.com/basho/erlang_protobuffs (no longer maintained, use gpb instead)
* Hacklang/HHVM: https://github.com/y3llowcake/proto-hack
* GDScript: https://github.com/oniksan/godobuf (Godot v3 engine plugin)
* Go: https://github.com/golang/protobuf (Google-official implementation)
* Go: https://github.com/akunspy/gopbuf
* Go: https://github.com/gogo/protobuf
* GopherJS: https://github.com/johanbrandhorst/protobuf
* Haskell: https://hackage.haskell.org/package/hprotoc
* Haskell: https://github.com/google/proto-lens (Google-unofficial implementation)
* Haskell: https://github.com/awakesecurity/proto3-suite (code generator) https://github.com/awakesecurity/proto3-wire (binary serializer/deserializer)
* Haxe: https://github.com/Atry/protoc-gen-haxe
* Java: https://github.com/protocolbuffers/protobuf (Google-official implementation)
* Java/Android: https://github.com/square/wire
* Java: https://github.com/HebiRobotics/QuickBuffers/
* Java ME: https://code.google.com/p/protobuf-javame/
* Java ME: http://swingme.sourceforge.net/encode.shtml
* Javascript: https://code.google.com/p/protobuf-js/
* Javascript: http://github.com/sirikata/protojs
* Javascript: https://github.com/dcodeIO/ProtoBuf.js
* Javascript: https://code.google.com/p/protobuf-for-node/
* Javascript: https://code.google.com/p/protostuff/
* Javascript: https://github.com/seishun/node-protoc-plugin (Node.js port of plugin.h)
* Javascript: https://github.com/seishun/node-protoc-gen-javascript (Node.js port of the Google-official implementation)
* Javascript: https://github.com/ButterCam/sisyphus-js
* Julia: https://github.com/tanmaykm/ProtoBuf.jl
* Kotlin: https://github.com/marcoferrer/kroto-plus
* Kotlin: https://github.com/Kotlin/kotlinx.serialization
* Kotlin: https://github.com/ButterCam/sisyphus
* Kotlin: https://github.com/open-toast/protokt
* Kotlin Multiplatform: https://github.com/streem/pbandk
* Lua: https://code.google.com/p/protoc-gen-lua/
* Lua: http://github.com/indygreg/lua-protobuf
* Lua: https://github.com/Neopallium/lua-pb
* Matlab: https://code.google.com/p/protobuf-matlab/
* Mercury: https://code.google.com/p/protobuf-mercury/
* Objective C: https://code.google.com/p/protobuf-objc/
* Objective C: https://github.com/alexeyxo/protobuf-objc
* OCaml: http://piqi.org/
* Perl: http://groups.google.com/group/protobuf-perl
* Perl: https://metacpan.org/pod/Google::ProtocolBuffers
* Perl: https://metacpan.org/pod/Google::ProtocolBuffers::Dynamic
* Perl/XS: https://code.google.com/p/protobuf-perlxs/
* PHP: https://code.google.com/p/pb4php/
* PHP: https://github.com/allegro/php-protobuf/
* PHP: https://github.com/chobie/php-protocolbuffers
* Prolog: http://www.swi-prolog.org/pldoc/package/protobufs.html
* Purescript: https://github.com/xc-jp/purescript-protobuf
* Python: https://github.com/protocolbuffers/protobuf (Google-official implementation)
* Python: https://github.com/eigenein/protobuf
* Python: https://github.com/danielgtaylor/python-betterproto
* R: http://cran.r-project.org/package=RProtoBuf
* Ruby: https://code.google.com/p/ruby-protobuf/
* Ruby: http://github.com/mozy/ruby-protocol-buffers
* Ruby: https://github.com/bmizerany/beefcake/tree/master/lib/beefcake
* Ruby: https://github.com/localshred/protobuf
* Rust: https://github.com/tokio-rs/prost
* Rust: https://github.com/stepancheg/rust-protobuf/
* Rust: https://github.com/tafia/quick-protobuf
* Scala: http://github.com/jeffplaisance/scala-protobuf
* Scala: https://code.google.com/p/protobuf-scala
* Scala: https://github.com/SandroGrzicic/ScalaBuff
* Scala: https://scalapb.github.io
* Solidity: https://github.com/celer-network/pb3-gen-sol
* Swift: https://github.com/alexeyxo/protobuf-swift
* Swift: https://github.com/apple/swift-protobuf/
* Typescript: https://github.com/thesayyn/protoc-gen-ts
* Typescript: https://github.com/pbkit/pbkit
* Vala: https://launchpad.net/protobuf-vala
* Visual Basic: https://code.google.com/p/protobuf-net/
These are projects we know about implementing Protocol Buffers for other
programming languages: * Action Script:
https://code.google.com/p/protobuf-actionscript3/ * Action Script:
https://code.google.com/p/protoc-gen-as3/ * Action Script:
https://github.com/matrix3d/JProtoc * Action Script:
https://github.com/zhongfq/protobuf-as3/ * Ada:
https://github.com/reznikmm/protobuf * C:
https://github.com/protobuf-c/protobuf-c * C: https://koti.kapsi.fi/jpa/nanopb/
* C: https://github.com/cloudwu/pbc/ * C: https://github.com/haberman/upb/wiki *
C: https://github.com/squidfunk/protobluff * C:
https://github.com/eerimoq/pbtools * C++:
https://github.com/protocolbuffers/protobuf (Google-official implementation) *
C++: https://github.com/yksten/struct2x * C++: https://EmbeddedProto.com *
C/C++: http://spbc.sf.net/ * C#: https://code.google.com/p/protobuf-csharp-port
* C#: https://silentorbit.com/protobuf/ * C#/.NET/WCF/VB:
https://code.google.com/p/protobuf-net/ * Clojure:
http://github.com/ninjudd/clojure-protobuf * Clojure:
https://github.com/clojusc/protobuf * Clojure: https://protojure.readthedocs.io
* Common Lisp: http://github.com/brown/protobuf * Common Lisp:
http://github.com/qitab/cl-protobuf * D: https://github.com/dcarp/protobuf-d *
D: https://github.com/msoucy/dproto * D:
https://github.com/opticron/ProtocolBuffer * Dart:
https://github.com/dart-lang/dart-protobuf (runtime)
https://github.com/dart-lang/dart-protoc-plugin (code generator) * Delphi:
http://sourceforge.net/projects/protobuf-delphi/ * Delphi:
http://fundementals.sourceforge.net/dl.html * Elixir:
https://github.com/jeremyong/exprotoc * Elixir:
https://github.com/tony612/protobuf-elixir * Elixir:
https://github.com/ahamez/protox * Elm:
https://github.com/tiziano88/elm-protobuf * Erlang:
https://github.com/tomas-abrahamsson/gpb * Erlang: http://piqi.org/ * Erlang:
https://github.com/basho/erlang_protobuffs (no longer maintained, use gpb
instead) * Hacklang/HHVM: https://github.com/y3llowcake/proto-hack * GDScript:
https://github.com/oniksan/godobuf (Godot v3 engine plugin) * Go:
https://github.com/golang/protobuf (Google-official implementation) * Go:
https://github.com/akunspy/gopbuf * Go: https://github.com/gogo/protobuf *
GopherJS: https://github.com/johanbrandhorst/protobuf * Haskell:
https://hackage.haskell.org/package/hprotoc * Haskell:
https://github.com/google/proto-lens (Google-unofficial implementation) *
Haskell: https://github.com/awakesecurity/proto3-suite (code generator)
https://github.com/awakesecurity/proto3-wire (binary serializer/deserializer) *
Haxe: https://github.com/Atry/protoc-gen-haxe * Java:
https://github.com/protocolbuffers/protobuf (Google-official implementation) *
Java/Android: https://github.com/square/wire * Java:
https://github.com/HebiRobotics/QuickBuffers/ * Java ME:
https://code.google.com/p/protobuf-javame/ * Java ME:
http://swingme.sourceforge.net/encode.shtml * Javascript:
https://code.google.com/p/protobuf-js/ * Javascript:
http://github.com/sirikata/protojs * Javascript:
https://github.com/dcodeIO/ProtoBuf.js * Javascript:
https://code.google.com/p/protobuf-for-node/ * Javascript:
https://code.google.com/p/protostuff/ * Javascript:
https://github.com/seishun/node-protoc-plugin (Node.js port of plugin.h) *
Javascript: https://github.com/seishun/node-protoc-gen-javascript (Node.js port
of the Google-official implementation) * Javascript:
https://github.com/ButterCam/sisyphus-js * Julia:
https://github.com/tanmaykm/ProtoBuf.jl * Kotlin:
https://github.com/marcoferrer/kroto-plus * Kotlin:
https://github.com/Kotlin/kotlinx.serialization * Kotlin:
https://github.com/ButterCam/sisyphus * Kotlin:
https://github.com/open-toast/protokt * Kotlin Multiplatform:
https://github.com/streem/pbandk * Lua:
https://code.google.com/p/protoc-gen-lua/ * Lua:
http://github.com/indygreg/lua-protobuf * Lua:
https://github.com/Neopallium/lua-pb * Matlab:
https://code.google.com/p/protobuf-matlab/ * Mercury:
https://code.google.com/p/protobuf-mercury/ * Objective C:
https://code.google.com/p/protobuf-objc/ * Objective C:
https://github.com/alexeyxo/protobuf-objc * OCaml: http://piqi.org/ * Perl:
http://groups.google.com/group/protobuf-perl * Perl:
https://metacpan.org/pod/Google::ProtocolBuffers * Perl:
https://metacpan.org/pod/Google::ProtocolBuffers::Dynamic * Perl/XS:
https://code.google.com/p/protobuf-perlxs/ * PHP:
https://code.google.com/p/pb4php/ * PHP:
https://github.com/allegro/php-protobuf/ * PHP:
https://github.com/chobie/php-protocolbuffers * Prolog:
http://www.swi-prolog.org/pldoc/package/protobufs.html * Purescript:
https://github.com/xc-jp/purescript-protobuf * Python:
https://github.com/protocolbuffers/protobuf (Google-official implementation) *
Python: https://github.com/eigenein/protobuf * Python:
https://github.com/danielgtaylor/python-betterproto * R:
http://cran.r-project.org/package=RProtoBuf * Ruby:
https://code.google.com/p/ruby-protobuf/ * Ruby:
http://github.com/mozy/ruby-protocol-buffers * Ruby:
https://github.com/bmizerany/beefcake/tree/master/lib/beefcake * Ruby:
https://github.com/localshred/protobuf * Rust: https://github.com/tokio-rs/prost
* Rust: https://github.com/stepancheg/rust-protobuf/ * Rust:
https://github.com/tafia/quick-protobuf * Scala:
http://github.com/jeffplaisance/scala-protobuf * Scala:
https://code.google.com/p/protobuf-scala * Scala:
https://github.com/SandroGrzicic/ScalaBuff * Scala: https://scalapb.github.io *
Solidity: https://github.com/celer-network/pb3-gen-sol * Swift:
https://github.com/alexeyxo/protobuf-swift * Swift:
https://github.com/apple/swift-protobuf/ * Typescript:
https://github.com/thesayyn/protoc-gen-ts * Typescript:
https://github.com/pbkit/pbkit * Vala: https://launchpad.net/protobuf-vala *
Visual Basic: https://code.google.com/p/protobuf-net/
## RPC Implementations

@ -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.9</version>
<version>3.21.10</version>
</dependency>
```
@ -37,7 +37,7 @@ protobuf-java-util package:
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
<version>3.21.9</version>
<version>3.21.10</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.9'
implementation 'com.google.protobuf:protobuf-java:3.21.10'
```
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.9</version>
<version>3.21.10</version>
<packaging>pom</packaging>
<name>Protocol Buffers [BOM]</name>

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

@ -1975,7 +1975,7 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
* Gets the descriptor for an extension. The implementation depends on whether the extension is
* scoped in the top level of a file or scoped in a Message.
*/
static interface ExtensionDescriptorRetriever {
interface ExtensionDescriptorRetriever {
FieldDescriptor getDescriptor();
}
@ -2326,14 +2326,14 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
}
private static final class ReflectionInvoker implements MethodInvoker {
protected final Method getMethod;
protected final Method getMethodBuilder;
protected final Method setMethod;
protected final Method hasMethod;
protected final Method hasMethodBuilder;
protected final Method clearMethod;
protected final Method caseMethod;
protected final Method caseMethodBuilder;
private final Method getMethod;
private final Method getMethodBuilder;
private final Method setMethod;
private final Method hasMethod;
private final Method hasMethodBuilder;
private final Method clearMethod;
private final Method caseMethod;
private final Method caseMethodBuilder;
ReflectionInvoker(
final FieldDescriptor descriptor,
@ -3120,13 +3120,11 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
final String containingOneofCamelCaseName) {
super(descriptor, camelCaseName, messageClass, builderClass, containingOneofCamelCaseName);
getBytesMethod = getMethodOrDie(messageClass, "get" + camelCaseName + "Bytes");
getBytesMethodBuilder = getMethodOrDie(builderClass, "get" + camelCaseName + "Bytes");
setBytesMethodBuilder =
getMethodOrDie(builderClass, "set" + camelCaseName + "Bytes", ByteString.class);
}
private final Method getBytesMethod;
private final Method getBytesMethodBuilder;
private final Method setBytesMethodBuilder;
@Override
@ -3134,11 +3132,6 @@ public abstract class GeneratedMessageV3 extends AbstractMessage implements Seri
return invokeOrDie(getBytesMethod, message);
}
@Override
public Object getRaw(GeneratedMessageV3.Builder builder) {
return invokeOrDie(getBytesMethodBuilder, builder);
}
@Override
public void set(GeneratedMessageV3.Builder builder, Object value) {
if (value instanceof ByteString) {

@ -67,12 +67,17 @@ public class LazyStringArrayList extends AbstractProtobufList<String>
EMPTY_LIST.makeImmutable();
}
static LazyStringArrayList emptyList() {
/** Returns an empty immutable {@code LazyStringArrayList} instance */
public static LazyStringArrayList emptyList() {
return EMPTY_LIST;
}
// For compatibility with older runtimes.
public static final LazyStringList EMPTY = EMPTY_LIST;
/**
* For compatibility with older runtimes.
*
* @deprecated use {@link emptyList()} instead
*/
@Deprecated public static final LazyStringList EMPTY = EMPTY_LIST;
private final List<Object> list;

@ -1545,7 +1545,8 @@ public final class TextFormat {
* the current token is part of the field value, so the silent marker is indicated by
* containsSilentMarkerAfterPrevToken.
*/
private void detectSilentMarker(Tokenizer tokenizer, String fieldName) {
private void detectSilentMarker(
Tokenizer tokenizer, Descriptor immediateMessageType, String fieldName) {
}
/**
@ -1892,24 +1893,14 @@ public final class TextFormat {
// Skips unknown fields.
if (field == null) {
// Try to guess the type of this field.
// If this field is not a message, there should be a ":" between the
// field name and the field value and also the field value should not
// start with "{" or "<" which indicates the beginning of a message body.
// If there is no ":" or there is a "{" or "<" after ":", this field has
// to be a message or the input is ill-formed.
detectSilentMarker(tokenizer, name);
if (tokenizer.tryConsume(":") && !tokenizer.lookingAt("{") && !tokenizer.lookingAt("<")) {
skipFieldValue(tokenizer);
} else {
skipFieldMessage(tokenizer);
}
detectSilentMarker(tokenizer, type, name);
guessFieldTypeAndSkip(tokenizer, type);
return;
}
// Handle potential ':'.
if (field.getJavaType() == FieldDescriptor.JavaType.MESSAGE) {
detectSilentMarker(tokenizer, field.getFullName());
detectSilentMarker(tokenizer, type, field.getFullName());
tokenizer.tryConsume(":"); // optional
if (parseTreeBuilder != null) {
TextFormatParseInfoTree.Builder childParseTreeBuilder =
@ -1933,7 +1924,7 @@ public final class TextFormat {
unknownFields);
}
} else {
detectSilentMarker(tokenizer, field.getFullName());
detectSilentMarker(tokenizer, type, field.getFullName());
tokenizer.consume(":"); // required
consumeFieldValues(
tokenizer,
@ -2223,7 +2214,7 @@ public final class TextFormat {
throw tokenizer.parseExceptionPreviousToken("Expected a valid type URL.");
}
}
detectSilentMarker(tokenizer, typeUrlBuilder.toString());
detectSilentMarker(tokenizer, anyDescriptor, typeUrlBuilder.toString());
tokenizer.tryConsume(":");
final String anyEndToken;
if (tokenizer.tryConsume("<")) {
@ -2260,21 +2251,11 @@ public final class TextFormat {
}
/** Skips the next field including the field's name and value. */
private void skipField(Tokenizer tokenizer) throws ParseException {
private void skipField(Tokenizer tokenizer, Descriptor type) throws ParseException {
String name = consumeFullTypeName(tokenizer);
detectSilentMarker(tokenizer, type, name);
guessFieldTypeAndSkip(tokenizer, type);
// Try to guess the type of this field.
// If this field is not a message, there should be a ":" between the
// field name and the field value and also the field value should not
// start with "{" or "<" which indicates the beginning of a message body.
// If there is no ":" or there is a "{" or "<" after ":", this field has
// to be a message or the input is ill-formed.
detectSilentMarker(tokenizer, name);
if (tokenizer.tryConsume(":") && !tokenizer.lookingAt("<") && !tokenizer.lookingAt("{")) {
skipFieldValue(tokenizer);
} else {
skipFieldMessage(tokenizer);
}
// For historical reasons, fields may optionally be separated by commas or
// semicolons.
if (!tokenizer.tryConsume(";")) {
@ -2285,7 +2266,7 @@ public final class TextFormat {
/**
* Skips the whole body of a message including the beginning delimiter and the ending delimiter.
*/
private void skipFieldMessage(Tokenizer tokenizer) throws ParseException {
private void skipFieldMessage(Tokenizer tokenizer, Descriptor type) throws ParseException {
final String delimiter;
if (tokenizer.tryConsume("<")) {
delimiter = ">";
@ -2294,7 +2275,7 @@ public final class TextFormat {
delimiter = "}";
}
while (!tokenizer.lookingAt(">") && !tokenizer.lookingAt("}")) {
skipField(tokenizer);
skipField(tokenizer, type);
}
tokenizer.consume(delimiter);
}
@ -2313,6 +2294,58 @@ public final class TextFormat {
throw tokenizer.parseException("Invalid field value: " + tokenizer.currentToken);
}
}
/**
* Tries to guess the type of this field and skip it.
*
* <p>If this field is not a message, there should be a ":" between the field name and the field
* value and also the field value should not start with "{" or "<" which indicates the beginning
* of a message body. If there is no ":" or there is a "{" or "<" after ":", this field has to
* be a message or the input is ill-formed. For short-formed repeated fields (i.e. with "[]"),
* if it is repeated scalar, there must be a ":" between the field name and the starting "[" .
*/
private void guessFieldTypeAndSkip(Tokenizer tokenizer, Descriptor type) throws ParseException {
boolean semicolonConsumed = tokenizer.tryConsume(":");
if (tokenizer.lookingAt("[")) {
// Short repeated field form. If a semicolon was consumed, it could be repeated scalar or
// repeated message. If not, it must be repeated message.
skipFieldShortFormedRepeated(tokenizer, semicolonConsumed, type);
} else if (semicolonConsumed && !tokenizer.lookingAt("{") && !tokenizer.lookingAt("<")) {
skipFieldValue(tokenizer);
} else {
skipFieldMessage(tokenizer, type);
}
}
/**
* Skips a short-formed repeated field value.
*
* <p>Reports an error if scalar type is not allowed but showing up inside "[]".
*/
private void skipFieldShortFormedRepeated(
Tokenizer tokenizer, boolean scalarAllowed, Descriptor type) throws ParseException {
if (!tokenizer.tryConsume("[") || tokenizer.tryConsume("]")) {
// Try skipping "[]".
return;
}
while (true) {
if (tokenizer.lookingAt("{") || tokenizer.lookingAt("<")) {
// Try skipping message field inside "[]"
skipFieldMessage(tokenizer, type);
} else if (scalarAllowed) {
// Try skipping scalar field inside "[]".
skipFieldValue(tokenizer);
} else {
throw tokenizer.parseException(
"Invalid repeated scalar field: missing \":\" before \"[\".");
}
if (tokenizer.tryConsume("]")) {
break;
}
tokenizer.consume(",");
}
}
}
// =================================================================

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

@ -55,9 +55,9 @@ import com.google.protobuf.testEmptyMessageWithExtensionsLite
import protobuf_unittest.MapLiteUnittest.MapEnumLite
import protobuf_unittest.MapLiteUnittest.TestMapLite
import protobuf_unittest.testMapLite
import `in`.com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.EvilNamesProto2
import `in`.com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.HardKeywordsAllTypesProto2
import `in`.com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.Interface
import `in`.com.google.protobuf.kotlin.generator.EvilNamesProto2
import `in`.com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2
import `in`.com.google.protobuf.kotlin.generator.Interface
import `in`.com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2Kt
import `in`.com.google.protobuf.kotlin.generator.evilNamesProto2
import `in`.com.google.protobuf.kotlin.generator.hardKeywordsAllTypesProto2
@ -404,38 +404,57 @@ class Proto2LiteTest {
fun testExtensionsSet() {
assertThat(
testAllExtensionsLite {
this[UnittestLite.optionalInt32ExtensionLite] = 101
this[UnittestLite.optionalInt64ExtensionLite] = 102L
this[UnittestLite.optionalUint32ExtensionLite] = 103
this[UnittestLite.optionalUint64ExtensionLite] = 104L
this[UnittestLite.optionalSint32ExtensionLite] = 105
this[UnittestLite.optionalSint64ExtensionLite] = 106L
this[UnittestLite.optionalFixed32ExtensionLite] = 107
this[UnittestLite.optionalFixed64ExtensionLite] = 108L
this[UnittestLite.optionalSfixed32ExtensionLite] = 109
this[UnittestLite.optionalSfixed64ExtensionLite] = 110L
this[UnittestLite.optionalFloatExtensionLite] = 111F
this[UnittestLite.optionalDoubleExtensionLite] = 112.0
this[UnittestLite.optionalBoolExtensionLite] = true
this[UnittestLite.optionalStringExtensionLite] = "115"
this[UnittestLite.optionalBytesExtensionLite] = toBytes("116")
this[UnittestLite.optionalGroupExtensionLite] = optionalGroupExtensionLite { a = 117 }
this[UnittestLite.optionalNestedMessageExtensionLite] =
setExtension(UnittestLite.optionalInt32ExtensionLite, 101)
setExtension(UnittestLite.optionalInt64ExtensionLite, 102L)
setExtension(UnittestLite.optionalUint32ExtensionLite, 103)
setExtension(UnittestLite.optionalUint64ExtensionLite, 104L)
setExtension(UnittestLite.optionalSint32ExtensionLite, 105)
setExtension(UnittestLite.optionalSint64ExtensionLite, 106L)
setExtension(UnittestLite.optionalFixed32ExtensionLite, 107)
setExtension(UnittestLite.optionalFixed64ExtensionLite, 108L)
setExtension(UnittestLite.optionalSfixed32ExtensionLite, 109)
setExtension(UnittestLite.optionalSfixed64ExtensionLite, 110L)
setExtension(UnittestLite.optionalFloatExtensionLite, 111F)
setExtension(UnittestLite.optionalDoubleExtensionLite, 112.0)
setExtension(UnittestLite.optionalBoolExtensionLite, true)
setExtension(UnittestLite.optionalStringExtensionLite, "115")
setExtension(UnittestLite.optionalBytesExtensionLite, toBytes("116"))
setExtension(
UnittestLite.optionalGroupExtensionLite,
optionalGroupExtensionLite { a = 117 }
)
setExtension(
UnittestLite.optionalNestedMessageExtensionLite,
TestAllTypesLiteKt.nestedMessage { bb = 118 }
this[UnittestLite.optionalForeignMessageExtensionLite] = foreignMessageLite { c = 119 }
this[UnittestLite.optionalImportMessageExtensionLite] =
)
setExtension(
UnittestLite.optionalForeignMessageExtensionLite,
foreignMessageLite { c = 119 }
)
setExtension(
UnittestLite.optionalImportMessageExtensionLite,
ImportMessageLite.newBuilder().setD(120).build()
this[UnittestLite.optionalPublicImportMessageExtensionLite] =
)
setExtension(
UnittestLite.optionalPublicImportMessageExtensionLite,
PublicImportMessageLite.newBuilder().setE(126).build()
this[UnittestLite.optionalLazyMessageExtensionLite] =
)
setExtension(
UnittestLite.optionalLazyMessageExtensionLite,
TestAllTypesLiteKt.nestedMessage { bb = 127 }
this[UnittestLite.optionalUnverifiedLazyMessageExtensionLite] =
)
setExtension(
UnittestLite.optionalUnverifiedLazyMessageExtensionLite,
TestAllTypesLiteKt.nestedMessage { bb = 128 }
this[UnittestLite.optionalNestedEnumExtensionLite] = NestedEnum.BAZ
this[UnittestLite.optionalForeignEnumExtensionLite] = ForeignEnumLite.FOREIGN_LITE_BAZ
this[UnittestLite.optionalImportEnumExtensionLite] = ImportEnumLite.IMPORT_LITE_BAZ
this[UnittestLite.optionalStringPieceExtensionLite] = "124"
this[UnittestLite.optionalCordExtensionLite] = "125"
)
setExtension(UnittestLite.optionalNestedEnumExtensionLite, NestedEnum.BAZ)
setExtension(
UnittestLite.optionalForeignEnumExtensionLite,
ForeignEnumLite.FOREIGN_LITE_BAZ
)
setExtension(UnittestLite.optionalImportEnumExtensionLite, ImportEnumLite.IMPORT_LITE_BAZ)
setExtension(UnittestLite.optionalStringPieceExtensionLite, "124")
setExtension(UnittestLite.optionalCordExtensionLite, "125")
this[UnittestLite.repeatedInt32ExtensionLite].add(201)
this[UnittestLite.repeatedInt64ExtensionLite].add(202L)
this[UnittestLite.repeatedUint32ExtensionLite].add(203)

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

@ -60,9 +60,9 @@ import protobuf_unittest.testEmptyMessageWithExtensions
import protobuf_unittest.testEnumMap
import protobuf_unittest.testIntIntMap
import protobuf_unittest.testMaps
import `in`.com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.EvilNamesProto2
import `in`.com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.HardKeywordsAllTypesProto2
import `in`.com.google.protobuf.kotlin.generator.EvilNamesProto2OuterClass.Interface
import `in`.com.google.protobuf.kotlin.generator.EvilNamesProto2
import `in`.com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2
import `in`.com.google.protobuf.kotlin.generator.Interface
import `in`.com.google.protobuf.kotlin.generator.HardKeywordsAllTypesProto2Kt
import `in`.com.google.protobuf.kotlin.generator.evilNamesProto2
import `in`.com.google.protobuf.kotlin.generator.hardKeywordsAllTypesProto2
@ -487,26 +487,26 @@ class Proto2Test {
this[UnittestProto.repeatedImportEnumExtension] += ImportEnum.IMPORT_BAZ
this[UnittestProto.repeatedStringPieceExtension] += "324"
this[UnittestProto.repeatedCordExtension] += "325"
this[UnittestProto.defaultInt32Extension] = 401
this[UnittestProto.defaultInt64Extension] = 402L
this[UnittestProto.defaultUint32Extension] = 403
this[UnittestProto.defaultUint64Extension] = 404L
this[UnittestProto.defaultSint32Extension] = 405
this[UnittestProto.defaultSint64Extension] = 406L
this[UnittestProto.defaultFixed32Extension] = 407
this[UnittestProto.defaultFixed64Extension] = 408L
this[UnittestProto.defaultSfixed32Extension] = 409
this[UnittestProto.defaultSfixed64Extension] = 410L
this[UnittestProto.defaultFloatExtension] = 411F
this[UnittestProto.defaultDoubleExtension] = 412.0
this[UnittestProto.defaultBoolExtension] = false
this[UnittestProto.defaultStringExtension] = "415"
this[UnittestProto.defaultBytesExtension] = toBytes("416")
this[UnittestProto.defaultNestedEnumExtension] = NestedEnum.FOO
this[UnittestProto.defaultForeignEnumExtension] = ForeignEnum.FOREIGN_FOO
this[UnittestProto.defaultImportEnumExtension] = ImportEnum.IMPORT_FOO
this[UnittestProto.defaultStringPieceExtension] = "424"
this[UnittestProto.defaultCordExtension] = "425"
setExtension(UnittestProto.defaultInt32Extension, 401)
setExtension(UnittestProto.defaultInt64Extension, 402L)
setExtension(UnittestProto.defaultUint32Extension, 403)
setExtension(UnittestProto.defaultUint64Extension, 404L)
setExtension(UnittestProto.defaultSint32Extension, 405)
setExtension(UnittestProto.defaultSint64Extension, 406L)
setExtension(UnittestProto.defaultFixed32Extension, 407)
setExtension(UnittestProto.defaultFixed64Extension, 408L)
setExtension(UnittestProto.defaultSfixed32Extension, 409)
setExtension(UnittestProto.defaultSfixed64Extension, 410L)
setExtension(UnittestProto.defaultFloatExtension, 411F)
setExtension(UnittestProto.defaultDoubleExtension, 412.0)
setExtension(UnittestProto.defaultBoolExtension, false)
setExtension(UnittestProto.defaultStringExtension, "415")
setExtension(UnittestProto.defaultBytesExtension, toBytes("416"))
setExtension(UnittestProto.defaultNestedEnumExtension, NestedEnum.FOO)
setExtension(UnittestProto.defaultForeignEnumExtension, ForeignEnum.FOREIGN_FOO)
setExtension(UnittestProto.defaultImportEnumExtension, ImportEnum.IMPORT_FOO)
setExtension(UnittestProto.defaultStringPieceExtension, "424")
setExtension(UnittestProto.defaultCordExtension, "425")
this[UnittestProto.oneofUint32Extension] = 601
this[UnittestProto.oneofNestedMessageExtension] =
TestAllTypesKt.nestedMessage { bb = 602 }

@ -34,6 +34,7 @@ syntax = "proto2";
package protobuf.kotlin.generator;
option java_package = "in.com.google.protobuf.kotlin.generator";
option java_multiple_files = true;
message EvilNamesProto2 {
optional bool initialized = 1;
@ -67,6 +68,8 @@ message EvilNamesProto2 {
optional string by = 25;
}
message List {}
message HardKeywordsAllTypesProto2 {
message NestedMessage {
optional int32 while = 1;

@ -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.9</version>
<version>3.21.10</version>
</dependency>
```

@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.21.9</version>
<version>3.21.10</version>
</parent>
<artifactId>protobuf-javalite</artifactId>

@ -4,7 +4,7 @@
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.21.9</version>
<version>3.21.10</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.9</version>
<version>3.21.10</version>
</parent>
<artifactId>protobuf-java-util</artifactId>

@ -6,6 +6,8 @@
# This script selects a specific Dockerfile (for building a Docker image) and
# a script to run inside that image.
set -eux
use_bazel.sh 4.2.2
# Change to repo root

@ -11,7 +11,7 @@ env_vars {
env_vars {
key: "BAZEL_TARGETS"
value: "//python/... @upb//python/..."
value: "//python/... @upb//python/... //python:python_version"
}
action {

@ -12,7 +12,7 @@ env_vars {
env_vars {
key: "BAZEL_TARGETS"
# Note: upb tests don't work since the C++ extension takes precedence here.
value: "//python/..."
value: "//python/... //python:python_version"
}
env_vars {

@ -11,7 +11,7 @@ env_vars {
env_vars {
key: "BAZEL_TARGETS"
value: "//python/... @upb//python/..."
value: "//python/... @upb//python/... //python:python_version"
}
action {

@ -12,7 +12,7 @@ env_vars {
env_vars {
key: "BAZEL_TARGETS"
# Note: upb tests don't work since the C++ extension takes precedence here.
value: "//python/..."
value: "//python/... //python:python_version"
}
env_vars {

@ -11,7 +11,7 @@ env_vars {
env_vars {
key: "BAZEL_TARGETS"
value: "//python/... @upb//python/..."
value: "//python/... @upb//python/... //python:python_version"
}
action {

@ -12,7 +12,7 @@ env_vars {
env_vars {
key: "BAZEL_TARGETS"
# Note: upb tests don't work since the C++ extension takes precedence here.
value: "//python/..."
value: "//python/... //python:python_version"
}
env_vars {

@ -11,7 +11,7 @@ env_vars {
env_vars {
key: "BAZEL_TARGETS"
value: "//python/... @upb//python/..."
value: "//python/... @upb//python/... //python:python_version"
}
action {

@ -12,7 +12,7 @@ env_vars {
env_vars {
key: "BAZEL_TARGETS"
# Note: upb tests don't work since the C++ extension takes precedence here.
value: "//python/..."
value: "//python/... //python:python_version"
}
env_vars {

@ -9,8 +9,9 @@ cd $(dirname $0)/../../..
source kokoro/macos/prepare_build_macos_rc
# Install Dependencies
# PHP 7.4 is already installed on the machine
brew cleanup
brew install coreutils php@7.4
brew install coreutils
# Configure path
PHP_FOLDER=$(find $HOMEBREW_PREFIX -type d -regex ".*php.*/7.4.[0-9_.]*" | sort -n | tail -n 1)

@ -5,6 +5,7 @@
set -eux
export HOMEBREW_PREFIX=$(brew --prefix)
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 # Do not automatically update packages.
##
# Select Xcode version

@ -9,5 +9,6 @@ cd $(dirname $0)/../../..
KOKORO_INSTALL_VENV=yes
source kokoro/macos/prepare_build_macos_rc
bazel test //python/... @upb//python/... $(kokoro/common/bazel_flags.sh) \
bazel test //python/... @upb//python/... //python:python_version \
$(kokoro/common/bazel_flags.sh) \
--macos_minimum_os=10.9

@ -9,5 +9,7 @@ cd $(dirname $0)/../../..
KOKORO_INSTALL_VENV=yes
source kokoro/macos/prepare_build_macos_rc
bazel test //python/... $(kokoro/common/bazel_flags.sh) \
--macos_minimum_os=10.9 --define=use_fast_cpp_protos=true
bazel test //python/... //python:python_version \
$(kokoro/common/bazel_flags.sh) \
--macos_minimum_os=10.9 \
--define=use_fast_cpp_protos=true

@ -6,6 +6,7 @@ set -ex
cd $(dirname $0)/../..
# Initialize any submodules.
git config --global --add safe.directory '*'
git submodule update --init --recursive
# The directory with all resulting artifacts

@ -1,5 +1,6 @@
@rem Update Chocolatey
choco upgrade -y --no-progress chocolatey
choco install -y python --version 3.10.0
choco install -y --no-progress --pre cmake
@rem Enable long paths.
@ -14,3 +15,7 @@ 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
@rem Use python3
C:\python310\python.exe -m venv venv
call venv\Scripts\activate.bat

@ -6,10 +6,10 @@
#import "GPBMessage.h"
#import "GPBRootObject.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30005
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30004 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#if 30005 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
@ -177,4 +177,4 @@ CF_EXTERN_C_END
// @@protoc_insertion_point(global_scope)
// clange-format on
// clang-format on

@ -79,7 +79,7 @@ typedef struct GPBAny__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBAny__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
static const char *extraTextFormatInfo =
"\001\001\004\241!!\000";

@ -8,10 +8,10 @@
#import "GPBSourceContext.pbobjc.h"
#import "GPBType.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30005
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30004 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#if 30005 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
@ -298,4 +298,4 @@ CF_EXTERN_C_END
// @@protoc_insertion_point(global_scope)
// clange-format on
// clang-format on

@ -144,7 +144,7 @@ typedef struct GPBApi__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBApi__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -265,7 +265,7 @@ typedef struct GPBMethod__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBMethod__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
static const char *extraTextFormatInfo =
"\002\002\007\244\241!!\000\004\010\244\241!!\000";
@ -338,7 +338,7 @@ typedef struct GPBMixin__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBMixin__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG

@ -134,7 +134,7 @@
// Current library runtime version.
// - Gets bumped when the runtime makes changes to the interfaces between the
// generated code and runtime (things added/removed, etc).
#define GOOGLE_PROTOBUF_OBJC_VERSION 30004
#define GOOGLE_PROTOBUF_OBJC_VERSION 30005
// Minimum runtime version supported for compiling/running against.
// - Gets changed when support for the older generated code is dropped.

@ -64,6 +64,9 @@ typedef NS_ENUM(uint8_t, GPBFieldType) {
**/
@interface GPBDescriptor : NSObject <NSCopying>
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/** Name of the message. */
@property(nonatomic, readonly, copy) NSString *name;
/** Fields declared in the message. */
@ -123,12 +126,23 @@ typedef NS_ENUM(uint8_t, GPBFieldType) {
**/
@interface GPBFileDescriptor : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/** The package declared in the proto file. */
@property(nonatomic, readonly, copy) NSString *package;
/** The objc prefix declared in the proto file. */
@property(nonatomic, readonly, copy, nullable) NSString *objcPrefix;
/** The syntax of the proto file. */
@property(nonatomic, readonly) GPBFileSyntax syntax;
/**
* The syntax of the proto file.
*
* This should not be used for making decisions about support
* features/behaviors, what proto2 vs. proto3 syntax has meant has evolved over
* time, and not more specific methods on the descriptors should be used
* instead.
*/
@property(nonatomic, readonly) GPBFileSyntax syntax
__attribute__((deprecated("Syntax is not a good way to decide things about behaviors.")));
@end
@ -136,6 +150,10 @@ typedef NS_ENUM(uint8_t, GPBFieldType) {
* Describes a oneof field.
**/
@interface GPBOneofDescriptor : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/** Name of the oneof field. */
@property(nonatomic, readonly) NSString *name;
/** Fields declared in the oneof. */
@ -166,6 +184,9 @@ typedef NS_ENUM(uint8_t, GPBFieldType) {
**/
@interface GPBFieldDescriptor : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/** Name of the field. */
@property(nonatomic, readonly, copy) NSString *name;
/** Number associated with the field. */
@ -215,10 +236,25 @@ typedef NS_ENUM(uint8_t, GPBFieldType) {
**/
@interface GPBEnumDescriptor : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/** Name of the enum. */
@property(nonatomic, readonly, copy) NSString *name;
/** Function that validates that raw values are valid enum values. */
@property(nonatomic, readonly) GPBEnumValidationFunc enumVerifier;
/**
* Is this a closed enum, meaning that it:
* - Has a fixed set of named values.
* - Encountering values not in this set causes them to be treated as unknown
* fields.
* - The first value (i.e., the default) may be nonzero.
*
* NOTE: This is only accurate if the generate sources for a proto file were
* generated with a protobuf release after the v21.9 version, as the ObjC
* generator wasn't capturing this information.
*/
@property(nonatomic, readonly) BOOL isClosed;
/**
* Returns the enum value name for the given raw enum.
@ -294,6 +330,10 @@ typedef NS_ENUM(uint8_t, GPBFieldType) {
* Describes a proto extension.
**/
@interface GPBExtensionDescriptor : NSObject <NSCopying>
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/** Field number under which the extension is stored. */
@property(nonatomic, readonly) uint32_t fieldNumber;
/** The containing message class, i.e. the class extended by this extension. */

@ -36,6 +36,32 @@
#import "GPBUtilities_PackagePrivate.h"
#import "GPBWireFormat.h"
@interface GPBDescriptor ()
- (instancetype)initWithClass:(Class)messageClass
file:(GPBFileDescriptor *)file
fields:(NSArray *)fields
storageSize:(uint32_t)storage
wireFormat:(BOOL)wireFormat;
@end
@interface GPBFieldDescriptor ()
// Single initializer
// description has to be long lived, it is held as a raw pointer.
- (instancetype)initWithFieldDescription:(void *)description
file:(GPBFileDescriptor *)file
decriptorFlags:(GPBDescriptorInitializationFlags)decriptorFlags;
@end
@interface GPBEnumDescriptor ()
- (instancetype)initWithName:(NSString *)name
valueNames:(const char *)valueNames
values:(const int32_t *)values
count:(uint32_t)valueCount
enumVerifier:(GPBEnumValidationFunc)enumVerifier
flags:(GPBEnumDescriptorInitializationFlags)flags;
@end
// Direct access is use for speed, to avoid even internally declaring things
// read/write, etc. The warning is enabled in the project to ensure code calling
// protos can turn on -Wdirect-ivar-access without issues.
@ -118,31 +144,20 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex, NSArray *allMessageField
// The rootClass is no longer used, but it is passed in to ensure it
// was started up during initialization also.
(void)rootClass;
NSMutableArray *fields = nil;
GPBFileSyntax syntax = file.syntax;
NSMutableArray *fields =
(fieldCount ? [[NSMutableArray alloc] initWithCapacity:fieldCount] : nil);
BOOL fieldsIncludeDefault = (flags & GPBDescriptorInitializationFlag_FieldsWithDefault) != 0;
BOOL usesClassRefs = (flags & GPBDescriptorInitializationFlag_UsesClassRefs) != 0;
BOOL proto3OptionalKnown = (flags & GPBDescriptorInitializationFlag_Proto3OptionalKnown) != 0;
void *desc;
for (uint32_t i = 0; i < fieldCount; ++i) {
if (fields == nil) {
fields = [[NSMutableArray alloc] initWithCapacity:fieldCount];
}
// Need correctly typed pointer for array indexing below to work.
if (fieldsIncludeDefault) {
GPBMessageFieldDescriptionWithDefault *fieldDescWithDefault = fieldDescriptions;
desc = &(fieldDescWithDefault[i]);
desc = &(((GPBMessageFieldDescriptionWithDefault *)fieldDescriptions)[i]);
} else {
GPBMessageFieldDescription *fieldDesc = fieldDescriptions;
desc = &(fieldDesc[i]);
desc = &(((GPBMessageFieldDescription *)fieldDescriptions)[i]);
}
GPBFieldDescriptor *fieldDescriptor =
[[GPBFieldDescriptor alloc] initWithFieldDescription:desc
includesDefault:fieldsIncludeDefault
usesClassRefs:usesClassRefs
proto3OptionalKnown:proto3OptionalKnown
syntax:syntax];
[[GPBFieldDescriptor alloc] initWithFieldDescription:desc file:file decriptorFlags:flags];
[fields addObject:fieldDescriptor];
[fieldDescriptor release];
}
@ -443,33 +458,18 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
Class msgClass_;
// Enum ivars.
// If protos are generated with GenerateEnumDescriptors on then it will
// be a enumDescriptor, otherwise it will be a enumVerifier.
union {
GPBEnumDescriptor *enumDescriptor_;
GPBEnumValidationFunc enumVerifier_;
} enumHandling_;
GPBEnumDescriptor *enumDescriptor_;
}
@synthesize msgClass = msgClass_;
@synthesize containingOneof = containingOneof_;
- (instancetype)init {
// Throw an exception if people attempt to not use the designated initializer.
self = [super init];
if (self != nil) {
[self doesNotRecognizeSelector:_cmd];
self = nil;
}
return self;
}
- (instancetype)initWithFieldDescription:(void *)description
includesDefault:(BOOL)includesDefault
usesClassRefs:(BOOL)usesClassRefs
proto3OptionalKnown:(BOOL)proto3OptionalKnown
syntax:(GPBFileSyntax)syntax {
file:(GPBFileDescriptor *)file
decriptorFlags:(GPBDescriptorInitializationFlags)decriptorFlags {
if ((self = [super init])) {
BOOL includesDefault =
(decriptorFlags & GPBDescriptorInitializationFlag_FieldsWithDefault) != 0;
GPBMessageFieldDescription *coreDesc;
if (includesDefault) {
coreDesc = &(((GPBMessageFieldDescriptionWithDefault *)description)->core);
@ -486,19 +486,40 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
// If proto3 optionals weren't known (i.e. generated code from an
// older version), compute the flag for the rest of the runtime.
if (!proto3OptionalKnown) {
if ((decriptorFlags & GPBDescriptorInitializationFlag_Proto3OptionalKnown) == 0) {
// If it was...
// - proto3 syntax
// - not repeated/map
// - not in a oneof (negative has index)
// - not a message (the flag doesn't make sense for messages)
BOOL clearOnZero = ((syntax == GPBFileSyntaxProto3) && !isMapOrArray &&
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
BOOL clearOnZero = ((file.syntax == GPBFileSyntaxProto3) && !isMapOrArray &&
(coreDesc->hasIndex >= 0) && !isMessage);
#pragma clang diagnostic pop
if (clearOnZero) {
coreDesc->flags |= GPBFieldClearHasIvarOnZero;
}
}
// If the ClosedEnum flag wasn't known (i.e. generated code from an older
// version), compute the flag for the rest of the runtime.
if ((decriptorFlags & GPBDescriptorInitializationFlag_ClosedEnumSupportKnown) == 0) {
// NOTE: This isn't correct, it is using the syntax of the file that
// declared the field, not the syntax of the file that declared the
// enum; but for older generated code, that's all we have and that happens
// to be what the runtime was doing (even though it was wrong). This is
// only wrong in the rare cases an enum is declared in a proto3 syntax
// file but used for a field in the proto2 syntax file.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
BOOL isClosedEnum = (dataType == GPBDataTypeEnum && file.syntax != GPBFileSyntaxProto3);
#pragma clang diagnostic pop
if (isClosedEnum) {
coreDesc->flags |= GPBFieldClosedEnum;
}
}
if (isMapOrArray) {
// map<>/repeated fields get a *Count property (inplace of a has*) to
// support checking if there are any entries without triggering
@ -519,7 +540,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
// Note: Only fetch the class here, can't send messages to it because
// that could cause cycles back to this class within +initialize if
// two messages have each other in fields (i.e. - they build a graph).
if (usesClassRefs) {
if ((decriptorFlags & GPBDescriptorInitializationFlag_UsesClassRefs) != 0) {
msgClass_ = coreDesc->dataTypeSpecific.clazz;
} else {
// Backwards compatibility for sources generated with older protoc.
@ -528,11 +549,14 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
NSAssert(msgClass_, @"Class %s not defined", className);
}
} else if (dataType == GPBDataTypeEnum) {
if ((coreDesc->flags & GPBFieldHasEnumDescriptor) != 0) {
enumHandling_.enumDescriptor_ = coreDesc->dataTypeSpecific.enumDescFunc();
} else {
enumHandling_.enumVerifier_ = coreDesc->dataTypeSpecific.enumVerifier;
}
enumDescriptor_ = coreDesc->dataTypeSpecific.enumDescFunc();
#if defined(DEBUG) && DEBUG
NSAssert((coreDesc->flags & GPBFieldHasEnumDescriptor) != 0,
@"Field must have GPBFieldHasEnumDescriptor set");
NSAssert(((decriptorFlags & GPBDescriptorInitializationFlag_ClosedEnumSupportKnown) != 0) ||
(((coreDesc->flags & GPBFieldClosedEnum) != 0) == enumDescriptor_.isClosed),
@"Internal error, ClosedEnum flag doesn't agree with EnumDescriptor");
#endif // DEBUG
}
// Non map<>/repeated fields can have defaults in proto2 syntax.
@ -636,19 +660,11 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
- (BOOL)isValidEnumValue:(int32_t)value {
NSAssert(description_->dataType == GPBDataTypeEnum, @"Field Must be of type GPBDataTypeEnum");
if (description_->flags & GPBFieldHasEnumDescriptor) {
return enumHandling_.enumDescriptor_.enumVerifier(value);
} else {
return enumHandling_.enumVerifier_(value);
}
return enumDescriptor_.enumVerifier(value);
}
- (GPBEnumDescriptor *)enumDescriptor {
if (description_->flags & GPBFieldHasEnumDescriptor) {
return enumHandling_.enumDescriptor_;
} else {
return nil;
}
return enumDescriptor_;
}
- (GPBGenericValue)defaultValue {
@ -743,6 +759,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
const uint8_t *extraTextFormatInfo_;
uint32_t *nameOffsets_;
uint32_t valueCount_;
uint32_t flags_;
}
@synthesize name = name_;
@ -752,12 +769,14 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
valueNames:(const char *)valueNames
values:(const int32_t *)values
count:(uint32_t)valueCount
enumVerifier:(GPBEnumValidationFunc)enumVerifier {
enumVerifier:(GPBEnumValidationFunc)enumVerifier
flags:(GPBEnumDescriptorInitializationFlags)flags {
GPBEnumDescriptor *descriptor = [[self alloc] initWithName:name
valueNames:valueNames
values:values
count:valueCount
enumVerifier:enumVerifier];
enumVerifier:enumVerifier
flags:flags];
return descriptor;
}
@ -766,29 +785,61 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
values:(const int32_t *)values
count:(uint32_t)valueCount
enumVerifier:(GPBEnumValidationFunc)enumVerifier
flags:(GPBEnumDescriptorInitializationFlags)flags
extraTextFormatInfo:(const char *)extraTextFormatInfo {
// Call the common case.
GPBEnumDescriptor *descriptor = [self allocDescriptorForName:name
valueNames:valueNames
values:values
count:valueCount
enumVerifier:enumVerifier];
enumVerifier:enumVerifier
flags:flags];
// Set the extra info.
descriptor->extraTextFormatInfo_ = (const uint8_t *)extraTextFormatInfo;
return descriptor;
}
+ (instancetype)allocDescriptorForName:(NSString *)name
valueNames:(const char *)valueNames
values:(const int32_t *)values
count:(uint32_t)valueCount
enumVerifier:(GPBEnumValidationFunc)enumVerifier {
return [self allocDescriptorForName:name
valueNames:valueNames
values:values
count:valueCount
enumVerifier:enumVerifier
flags:GPBEnumDescriptorInitializationFlag_None];
}
+ (instancetype)allocDescriptorForName:(NSString *)name
valueNames:(const char *)valueNames
values:(const int32_t *)values
count:(uint32_t)valueCount
enumVerifier:(GPBEnumValidationFunc)enumVerifier
extraTextFormatInfo:(const char *)extraTextFormatInfo {
return [self allocDescriptorForName:name
valueNames:valueNames
values:values
count:valueCount
enumVerifier:enumVerifier
flags:GPBEnumDescriptorInitializationFlag_None
extraTextFormatInfo:extraTextFormatInfo];
}
- (instancetype)initWithName:(NSString *)name
valueNames:(const char *)valueNames
values:(const int32_t *)values
count:(uint32_t)valueCount
enumVerifier:(GPBEnumValidationFunc)enumVerifier {
enumVerifier:(GPBEnumValidationFunc)enumVerifier
flags:(GPBEnumDescriptorInitializationFlags)flags {
if ((self = [super init])) {
name_ = [name copy];
valueNames_ = valueNames;
values_ = values;
valueCount_ = valueCount;
enumVerifier_ = enumVerifier;
flags_ = flags;
}
return self;
}
@ -799,6 +850,10 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) {
[super dealloc];
}
- (BOOL)isClosed {
return (flags_ & GPBEnumDescriptorInitializationFlag_IsClosed) != 0;
}
- (void)calcValueNameOffsets {
@synchronized(self) {
if (nameOffsets_ != NULL) {

@ -52,7 +52,7 @@ typedef NS_OPTIONS(uint16_t, GPBFieldFlags) {
// Indicates the field needs custom handling for the TextFormat name, if not
// set, the name can be derived from the ObjC name.
GPBFieldTextFormatNameCustom = 1 << 6,
// Indicates the field has an enum descriptor.
// This flag has never had any meaning, it was set on all enum fields.
GPBFieldHasEnumDescriptor = 1 << 7,
// These are not standard protobuf concepts, they are specific to the
@ -73,6 +73,18 @@ typedef NS_OPTIONS(uint16_t, GPBFieldFlags) {
GPBFieldMapKeySFixed64 = 10 << 8,
GPBFieldMapKeyBool = 11 << 8,
GPBFieldMapKeyString = 12 << 8,
// If the enum for this field is "closed", meaning that it:
// - Has a fixed set of named values.
// - Encountering values not in this set causes them to be treated as unknown
// fields.
// - The first value (i.e., the default) may be nonzero.
// NOTE: This could be tracked just on the GPBEnumDescriptor, but to support
// previously generated code, there would be not data to get the behavior
// correct, so instead it is tracked on the field. If old source compatibility
// is removed, this could be removed and the GPBEnumDescription fetched from
// the GPBFieldDescriptor instead.
GPBFieldClosedEnum = 1 << 12,
};
// NOTE: The structures defined here have their members ordered to minimize
@ -89,10 +101,8 @@ typedef struct GPBMessageFieldDescription {
// clazz is used iff GPBDescriptorInitializationFlag_UsesClassRefs is set.
char *className; // Name of the class of the message.
Class clazz; // Class of the message.
// For enums only: If EnumDescriptors are compiled in, it will be that,
// otherwise it will be the verifier.
// For enums only.
GPBEnumDescriptorFunc enumDescFunc;
GPBEnumValidationFunc enumVerifier;
} dataTypeSpecific;
// The field number for the ivar.
uint32_t number;
@ -175,6 +185,12 @@ typedef NS_OPTIONS(uint32_t, GPBDescriptorInitializationFlags) {
// at startup. This allows older generated code to still work with the
// current runtime library.
GPBDescriptorInitializationFlag_Proto3OptionalKnown = 1 << 3,
// This flag is used to indicate that the generated sources already contain
// the `GPBFieldCloseEnum` flag and it doesn't have to be computed at startup.
// This allows the older generated code to still work with the current runtime
// library.
GPBDescriptorInitializationFlag_ClosedEnumSupportKnown = 1 << 4,
};
@interface GPBDescriptor () {
@ -193,12 +209,6 @@ typedef NS_OPTIONS(uint32_t, GPBDescriptorInitializationFlags) {
storageSize:(uint32_t)storageSize
flags:(GPBDescriptorInitializationFlags)flags;
- (instancetype)initWithClass:(Class)messageClass
file:(GPBFileDescriptor *)file
fields:(NSArray *)fields
storageSize:(uint32_t)storage
wireFormat:(BOOL)wireFormat;
// Called right after init to provide extra information to avoid init having
// an explosion of args. These pointers are recorded, so they are expected
// to live for the lifetime of the app.
@ -242,37 +252,44 @@ typedef NS_OPTIONS(uint32_t, GPBDescriptorInitializationFlags) {
SEL hasOrCountSel_; // *Count for map<>/repeated fields, has* otherwise.
SEL setHasSel_;
}
@end
// Single initializer
// description has to be long lived, it is held as a raw pointer.
- (instancetype)initWithFieldDescription:(void *)description
includesDefault:(BOOL)includesDefault
usesClassRefs:(BOOL)usesClassRefs
proto3OptionalKnown:(BOOL)proto3OptionalKnown
syntax:(GPBFileSyntax)syntax;
typedef NS_OPTIONS(uint32_t, GPBEnumDescriptorInitializationFlags) {
GPBEnumDescriptorInitializationFlag_None = 0,
@end
// Marks this enum as a closed enum.
GPBEnumDescriptorInitializationFlag_IsClosed = 1 << 1,
};
@interface GPBEnumDescriptor ()
// valueNames, values and extraTextFormatInfo have to be long lived, they are
// held as raw pointers.
+ (instancetype)allocDescriptorForName:(NSString *)name
valueNames:(const char *)valueNames
values:(const int32_t *)values
count:(uint32_t)valueCount
enumVerifier:(GPBEnumValidationFunc)enumVerifier
flags:(GPBEnumDescriptorInitializationFlags)flags;
+ (instancetype)allocDescriptorForName:(NSString *)name
valueNames:(const char *)valueNames
values:(const int32_t *)values
count:(uint32_t)valueCount
enumVerifier:(GPBEnumValidationFunc)enumVerifier
flags:(GPBEnumDescriptorInitializationFlags)flags
extraTextFormatInfo:(const char *)extraTextFormatInfo;
// Deprecated. Calls above with `flags = 0`
+ (instancetype)allocDescriptorForName:(NSString *)name
valueNames:(const char *)valueNames
values:(const int32_t *)values
count:(uint32_t)valueCount
enumVerifier:(GPBEnumValidationFunc)enumVerifier;
// Deprecated. Calls above with `flags = 0`
+ (instancetype)allocDescriptorForName:(NSString *)name
valueNames:(const char *)valueNames
values:(const int32_t *)values
count:(uint32_t)valueCount
enumVerifier:(GPBEnumValidationFunc)enumVerifier
extraTextFormatInfo:(const char *)extraTextFormatInfo;
- (instancetype)initWithName:(NSString *)name
valueNames:(const char *)valueNames
values:(const int32_t *)values
count:(uint32_t)valueCount
enumVerifier:(GPBEnumValidationFunc)enumVerifier;
@end
@interface GPBExtensionDescriptor () {
@ -320,6 +337,10 @@ GPB_INLINE uint32_t GPBFieldNumber(GPBFieldDescriptor *field) {
return field->description_->number;
}
GPB_INLINE BOOL GPBFieldIsClosedEnum(GPBFieldDescriptor *field) {
return (field->description_->flags & GPBFieldClosedEnum) != 0;
}
#pragma clang diagnostic pop
uint32_t GPBFieldTag(GPBFieldDescriptor *self);
@ -330,10 +351,6 @@ uint32_t GPBFieldTag(GPBFieldDescriptor *self);
// would be the wire type for packed.
uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self);
GPB_INLINE BOOL GPBHasPreservingUnknownEnumSemantics(GPBFileSyntax syntax) {
return syntax == GPBFileSyntaxProto3;
}
GPB_INLINE BOOL GPBExtensionIsRepeated(GPBExtensionDescription *description) {
return (description->options & GPBExtensionRepeated) != 0;
}

@ -501,8 +501,7 @@ void GPBDictionaryReadEntry(id mapDictionary, GPBCodedInputStream *stream,
[(NSMutableDictionary *)mapDictionary setObject:value.valueString forKey:key.valueString];
} else {
if (valueDataType == GPBDataTypeEnum) {
if (GPBHasPreservingUnknownEnumSemantics([parentMessage descriptor].file.syntax) ||
[field isValidEnumValue:value.valueEnum]) {
if (!GPBFieldIsClosedEnum(field) || [field isValidEnumValue:value.valueEnum]) {
[mapDictionary setGPBGenericValue:&value forGPBGenericValueKey:&key];
} else {
NSData *data = [mapDictionary serializedDataForUnknownValue:value.valueEnum

@ -6,10 +6,10 @@
#import "GPBMessage.h"
#import "GPBRootObject.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30005
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30004 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#if 30005 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
@ -133,4 +133,4 @@ CF_EXTERN_C_END
// @@protoc_insertion_point(global_scope)
// clange-format on
// clang-format on

@ -79,7 +79,7 @@ typedef struct GPBDuration__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBDuration__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG

@ -6,10 +6,10 @@
#import "GPBMessage.h"
#import "GPBRootObject.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30005
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30004 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#if 30005 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
@ -60,4 +60,4 @@ CF_EXTERN_C_END
// @@protoc_insertion_point(global_scope)
// clange-format on
// clang-format on

@ -55,7 +55,7 @@ typedef struct GPBEmpty__storage_ {
fields:NULL
fieldCount:0
storageSize:sizeof(GPBEmpty__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG

@ -32,14 +32,7 @@
#import "GPBDescriptor.h"
@class GPBCodedInputStream;
@class GPBCodedOutputStream;
@protocol GPBExtensionRegistry;
void GPBExtensionMergeFromInputStream(GPBExtensionDescriptor *extension, BOOL isPackedOnStream,
GPBCodedInputStream *input,
id<GPBExtensionRegistry> extensionRegistry,
GPBMessage *message);
size_t GPBComputeExtensionSerializedSizeIncludingTag(GPBExtensionDescriptor *extension, id value);

@ -38,12 +38,6 @@
#import "GPBMessage_PackagePrivate.h"
#import "GPBUtilities_PackagePrivate.h"
static id NewSingleValueFromInputStream(GPBExtensionDescriptor *extension,
GPBCodedInputStream *input,
id<GPBExtensionRegistry> extensionRegistry,
GPBMessage *existingValue)
__attribute__((ns_returns_retained));
GPB_INLINE size_t DataTypeSize(GPBDataType dataType) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch-enum"
@ -263,38 +257,6 @@ static void WriteArrayIncludingTagsToCodedOutputStream(NSArray *values,
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdirect-ivar-access"
void GPBExtensionMergeFromInputStream(GPBExtensionDescriptor *extension, BOOL isPackedOnStream,
GPBCodedInputStream *input,
id<GPBExtensionRegistry> extensionRegistry,
GPBMessage *message) {
GPBExtensionDescription *description = extension->description_;
GPBCodedInputStreamState *state = &input->state_;
if (isPackedOnStream) {
NSCAssert(GPBExtensionIsRepeated(description), @"How was it packed if it isn't repeated?");
int32_t length = GPBCodedInputStreamReadInt32(state);
size_t limit = GPBCodedInputStreamPushLimit(state, length);
while (GPBCodedInputStreamBytesUntilLimit(state) > 0) {
id value = NewSingleValueFromInputStream(extension, input, extensionRegistry, nil);
[message addExtension:extension value:value];
[value release];
}
GPBCodedInputStreamPopLimit(state, limit);
} else {
id existingValue = nil;
BOOL isRepeated = GPBExtensionIsRepeated(description);
if (!isRepeated && GPBDataTypeIsMessage(description->dataType)) {
existingValue = [message getExistingExtension:extension];
}
id value = NewSingleValueFromInputStream(extension, input, extensionRegistry, existingValue);
if (isRepeated) {
[message addExtension:extension value:value];
} else {
[message setExtension:extension value:value];
}
[value release];
}
}
void GPBWriteExtensionValueToOutputStream(GPBExtensionDescriptor *extension, id value,
GPBCodedOutputStream *output) {
GPBExtensionDescription *description = extension->description_;
@ -314,76 +276,4 @@ size_t GPBComputeExtensionSerializedSizeIncludingTag(GPBExtensionDescriptor *ext
}
}
// Note that this returns a retained value intentionally.
static id NewSingleValueFromInputStream(GPBExtensionDescriptor *extension,
GPBCodedInputStream *input,
id<GPBExtensionRegistry> extensionRegistry,
GPBMessage *existingValue) {
GPBExtensionDescription *description = extension->description_;
GPBCodedInputStreamState *state = &input->state_;
switch (description->dataType) {
case GPBDataTypeBool:
return [[NSNumber alloc] initWithBool:GPBCodedInputStreamReadBool(state)];
case GPBDataTypeFixed32:
return [[NSNumber alloc] initWithUnsignedInt:GPBCodedInputStreamReadFixed32(state)];
case GPBDataTypeSFixed32:
return [[NSNumber alloc] initWithInt:GPBCodedInputStreamReadSFixed32(state)];
case GPBDataTypeFloat:
return [[NSNumber alloc] initWithFloat:GPBCodedInputStreamReadFloat(state)];
case GPBDataTypeFixed64:
return [[NSNumber alloc] initWithUnsignedLongLong:GPBCodedInputStreamReadFixed64(state)];
case GPBDataTypeSFixed64:
return [[NSNumber alloc] initWithLongLong:GPBCodedInputStreamReadSFixed64(state)];
case GPBDataTypeDouble:
return [[NSNumber alloc] initWithDouble:GPBCodedInputStreamReadDouble(state)];
case GPBDataTypeInt32:
return [[NSNumber alloc] initWithInt:GPBCodedInputStreamReadInt32(state)];
case GPBDataTypeInt64:
return [[NSNumber alloc] initWithLongLong:GPBCodedInputStreamReadInt64(state)];
case GPBDataTypeSInt32:
return [[NSNumber alloc] initWithInt:GPBCodedInputStreamReadSInt32(state)];
case GPBDataTypeSInt64:
return [[NSNumber alloc] initWithLongLong:GPBCodedInputStreamReadSInt64(state)];
case GPBDataTypeUInt32:
return [[NSNumber alloc] initWithUnsignedInt:GPBCodedInputStreamReadUInt32(state)];
case GPBDataTypeUInt64:
return [[NSNumber alloc] initWithUnsignedLongLong:GPBCodedInputStreamReadUInt64(state)];
case GPBDataTypeBytes:
return GPBCodedInputStreamReadRetainedBytes(state);
case GPBDataTypeString:
return GPBCodedInputStreamReadRetainedString(state);
case GPBDataTypeEnum:
return [[NSNumber alloc] initWithInt:GPBCodedInputStreamReadEnum(state)];
case GPBDataTypeGroup:
case GPBDataTypeMessage: {
GPBMessage *message;
if (existingValue) {
message = [existingValue retain];
} else {
GPBDescriptor *descriptor = [extension.msgClass descriptor];
message = [[descriptor.messageClass alloc] init];
}
if (description->dataType == GPBDataTypeGroup) {
[input readGroup:description->fieldNumber
message:message
extensionRegistry:extensionRegistry];
} else {
// description->dataType == GPBDataTypeMessage
if (GPBExtensionIsWireFormat(description)) {
// For MessageSet fields the message length will have already been
// read.
[message mergeFromCodedInputStream:input extensionRegistry:extensionRegistry];
} else {
[input readMessage:message extensionRegistry:extensionRegistry];
}
}
return message;
}
}
return nil;
}
#pragma clang diagnostic pop

@ -6,10 +6,10 @@
#import "GPBMessage.h"
#import "GPBRootObject.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30005
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30004 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#if 30005 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
@ -261,4 +261,4 @@ CF_EXTERN_C_END
// @@protoc_insertion_point(global_scope)
// clange-format on
// clang-format on

@ -68,7 +68,7 @@ typedef struct GPBFieldMask__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBFieldMask__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG

@ -90,15 +90,13 @@ CF_EXTERN_C_END
* The set of unknown fields for this message.
*
* Only messages from proto files declared with "proto2" syntax support unknown
* fields. For "proto3" syntax, any unknown fields found while parsing are
* dropped.
* fields.
**/
@property(nonatomic, copy, nullable) GPBUnknownFieldSet *unknownFields;
/**
* Whether the message, along with all submessages, have the required fields
* set. This is only applicable for files declared with "proto2" syntax, as
* there are no required fields for "proto3" syntax.
* set.
**/
@property(nonatomic, readonly, getter=isInitialized) BOOL initialized;
@ -412,6 +410,12 @@ CF_EXTERN_C_END
* repeated fields. If the extension is a Message one will be auto created for
* you and returned similar to fields.
*
* NOTE: For Enum extensions, if the enum was _closed_, then unknown values
* were parsed into the message's unknown fields instead of ending up in the
* extensions, just like what happens with singular/repeated fields. For open
* enums, the _raw_ value will be in the NSNumber, meaning if one does a
* `switch` on the values, a `default` case should also be included.
*
* @param extension The extension descriptor of the extension to fetch.
*
* @return The extension matching the given descriptor, or nil if none found.

@ -108,6 +108,7 @@ static id GetOrCreateMapIvarWithField(GPBMessage *self, GPBFieldDescriptor *fiel
static id GetMapIvarWithField(GPBMessage *self, GPBFieldDescriptor *field);
static NSMutableDictionary *CloneExtensionMap(NSDictionary *extensionMap, NSZone *zone)
__attribute__((ns_returns_retained));
static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self);
#ifdef DEBUG
static NSError *MessageError(NSInteger code, NSDictionary *userInfo) {
@ -637,6 +638,135 @@ static id GetMapIvarWithField(GPBMessage *self, GPBFieldDescriptor *field) {
#endif // !defined(__clang_analyzer__)
static id NewSingleValueFromInputStream(GPBExtensionDescriptor *extension,
GPBMessage *messageToGetExtension,
GPBCodedInputStream *input,
id<GPBExtensionRegistry> extensionRegistry,
GPBMessage *existingValue)
__attribute__((ns_returns_retained));
// Note that this returns a retained value intentionally.
static id NewSingleValueFromInputStream(GPBExtensionDescriptor *extension,
GPBMessage *messageToGetExtension,
GPBCodedInputStream *input,
id<GPBExtensionRegistry> extensionRegistry,
GPBMessage *existingValue) {
GPBExtensionDescription *description = extension->description_;
GPBCodedInputStreamState *state = &input->state_;
switch (description->dataType) {
case GPBDataTypeBool:
return [[NSNumber alloc] initWithBool:GPBCodedInputStreamReadBool(state)];
case GPBDataTypeFixed32:
return [[NSNumber alloc] initWithUnsignedInt:GPBCodedInputStreamReadFixed32(state)];
case GPBDataTypeSFixed32:
return [[NSNumber alloc] initWithInt:GPBCodedInputStreamReadSFixed32(state)];
case GPBDataTypeFloat:
return [[NSNumber alloc] initWithFloat:GPBCodedInputStreamReadFloat(state)];
case GPBDataTypeFixed64:
return [[NSNumber alloc] initWithUnsignedLongLong:GPBCodedInputStreamReadFixed64(state)];
case GPBDataTypeSFixed64:
return [[NSNumber alloc] initWithLongLong:GPBCodedInputStreamReadSFixed64(state)];
case GPBDataTypeDouble:
return [[NSNumber alloc] initWithDouble:GPBCodedInputStreamReadDouble(state)];
case GPBDataTypeInt32:
return [[NSNumber alloc] initWithInt:GPBCodedInputStreamReadInt32(state)];
case GPBDataTypeInt64:
return [[NSNumber alloc] initWithLongLong:GPBCodedInputStreamReadInt64(state)];
case GPBDataTypeSInt32:
return [[NSNumber alloc] initWithInt:GPBCodedInputStreamReadSInt32(state)];
case GPBDataTypeSInt64:
return [[NSNumber alloc] initWithLongLong:GPBCodedInputStreamReadSInt64(state)];
case GPBDataTypeUInt32:
return [[NSNumber alloc] initWithUnsignedInt:GPBCodedInputStreamReadUInt32(state)];
case GPBDataTypeUInt64:
return [[NSNumber alloc] initWithUnsignedLongLong:GPBCodedInputStreamReadUInt64(state)];
case GPBDataTypeBytes:
return GPBCodedInputStreamReadRetainedBytes(state);
case GPBDataTypeString:
return GPBCodedInputStreamReadRetainedString(state);
case GPBDataTypeEnum: {
int32_t val = GPBCodedInputStreamReadEnum(&input->state_);
GPBEnumDescriptor *enumDescriptor = extension.enumDescriptor;
// If run with source generated before the closed enum support, all enums
// will be considers not closed, so casing to the enum type for a switch
// could cause things to fall off the end of a switch.
if (!enumDescriptor.isClosed || enumDescriptor.enumVerifier(val)) {
return [[NSNumber alloc] initWithInt:val];
} else {
GPBUnknownFieldSet *unknownFields = GetOrMakeUnknownFields(messageToGetExtension);
[unknownFields mergeVarintField:extension->description_->fieldNumber value:val];
return nil;
}
}
case GPBDataTypeGroup:
case GPBDataTypeMessage: {
GPBMessage *message;
if (existingValue) {
message = [existingValue retain];
} else {
GPBDescriptor *descriptor = [extension.msgClass descriptor];
message = [[descriptor.messageClass alloc] init];
}
if (description->dataType == GPBDataTypeGroup) {
[input readGroup:description->fieldNumber
message:message
extensionRegistry:extensionRegistry];
} else {
// description->dataType == GPBDataTypeMessage
if (GPBExtensionIsWireFormat(description)) {
// For MessageSet fields the message length will have already been
// read.
[message mergeFromCodedInputStream:input extensionRegistry:extensionRegistry];
} else {
[input readMessage:message extensionRegistry:extensionRegistry];
}
}
return message;
}
}
return nil;
}
static void ExtensionMergeFromInputStream(GPBExtensionDescriptor *extension, BOOL isPackedOnStream,
GPBCodedInputStream *input,
id<GPBExtensionRegistry> extensionRegistry,
GPBMessage *message) {
GPBExtensionDescription *description = extension->description_;
GPBCodedInputStreamState *state = &input->state_;
if (isPackedOnStream) {
NSCAssert(GPBExtensionIsRepeated(description), @"How was it packed if it isn't repeated?");
int32_t length = GPBCodedInputStreamReadInt32(state);
size_t limit = GPBCodedInputStreamPushLimit(state, length);
while (GPBCodedInputStreamBytesUntilLimit(state) > 0) {
id value = NewSingleValueFromInputStream(extension, message, input, extensionRegistry, nil);
if (value) {
[message addExtension:extension value:value];
[value release];
}
}
GPBCodedInputStreamPopLimit(state, limit);
} else {
id existingValue = nil;
BOOL isRepeated = GPBExtensionIsRepeated(description);
if (!isRepeated && GPBDataTypeIsMessage(description->dataType)) {
existingValue = [message getExistingExtension:extension];
}
id value =
NewSingleValueFromInputStream(extension, message, input, extensionRegistry, existingValue);
if (value) {
if (isRepeated) {
[message addExtension:extension value:value];
} else {
[message setExtension:extension value:value];
}
[value release];
}
}
}
GPBMessage *GPBCreateMessageWithAutocreator(Class msgClass, GPBMessage *autocreator,
GPBFieldDescriptor *field) {
GPBMessage *message = [[msgClass alloc] init];
@ -1987,11 +2117,11 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
if (extension != nil) {
GPBCodedInputStream *newInput =
[[GPBCodedInputStream alloc] initWithData:rawBytes];
GPBExtensionMergeFromInputStream(extension,
extension.packable,
newInput,
extensionRegistry,
self);
ExtensionMergeFromInputStream(extension,
extension.packable,
newInput,
extensionRegistry,
self);
[newInput release];
} else {
GPBUnknownFieldSet *unknownFields = GetOrMakeUnknownFields(self);
@ -2022,11 +2152,11 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
}
} else {
if (extension.wireType == wireType) {
GPBExtensionMergeFromInputStream(extension,
extension.packable,
input,
extensionRegistry,
self);
ExtensionMergeFromInputStream(extension,
extension.packable,
input,
extensionRegistry,
self);
return YES;
}
// Primitive, repeated types can be packed on unpacked on the wire, and are
@ -2034,11 +2164,11 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
if ([extension isRepeated] &&
!GPBDataTypeIsObject(extension->description_->dataType) &&
(extension.alternateWireType == wireType)) {
GPBExtensionMergeFromInputStream(extension,
!extension.packable,
input,
extensionRegistry,
self);
ExtensionMergeFromInputStream(extension,
!extension.packable,
input,
extensionRegistry,
self);
return YES;
}
}
@ -2058,7 +2188,7 @@ static GPBUnknownFieldSet *GetOrMakeUnknownFields(GPBMessage *self) {
#pragma mark - MergeFromCodedInputStream Support
static void MergeSingleFieldFromCodedInputStream(
GPBMessage *self, GPBFieldDescriptor *field, GPBFileSyntax syntax,
GPBMessage *self, GPBFieldDescriptor *field,
GPBCodedInputStream *input, id<GPBExtensionRegistry>extensionRegistry) {
GPBDataType fieldDataType = GPBGetFieldDataType(field);
switch (fieldDataType) {
@ -2128,8 +2258,7 @@ static void MergeSingleFieldFromCodedInputStream(
case GPBDataTypeEnum: {
int32_t val = GPBCodedInputStreamReadEnum(&input->state_);
if (GPBHasPreservingUnknownEnumSemantics(syntax) ||
[field isValidEnumValue:val]) {
if (!GPBFieldIsClosedEnum(field) || [field isValidEnumValue:val]) {
GPBSetInt32IvarWithFieldPrivate(self, field, val);
} else {
GPBUnknownFieldSet *unknownFields = GetOrMakeUnknownFields(self);
@ -2140,7 +2269,7 @@ static void MergeSingleFieldFromCodedInputStream(
}
static void MergeRepeatedPackedFieldFromCodedInputStream(
GPBMessage *self, GPBFieldDescriptor *field, GPBFileSyntax syntax,
GPBMessage *self, GPBFieldDescriptor *field,
GPBCodedInputStream *input) {
GPBDataType fieldDataType = GPBGetFieldDataType(field);
GPBCodedInputStreamState *state = &input->state_;
@ -2179,8 +2308,7 @@ static void MergeRepeatedPackedFieldFromCodedInputStream(
case GPBDataTypeEnum: {
int32_t val = GPBCodedInputStreamReadEnum(state);
if (GPBHasPreservingUnknownEnumSemantics(syntax) ||
[field isValidEnumValue:val]) {
if (!GPBFieldIsClosedEnum(field) || [field isValidEnumValue:val]) {
[(GPBEnumArray*)genericArray addRawValue:val];
} else {
GPBUnknownFieldSet *unknownFields = GetOrMakeUnknownFields(self);
@ -2194,7 +2322,7 @@ static void MergeRepeatedPackedFieldFromCodedInputStream(
}
static void MergeRepeatedNotPackedFieldFromCodedInputStream(
GPBMessage *self, GPBFieldDescriptor *field, GPBFileSyntax syntax,
GPBMessage *self, GPBFieldDescriptor *field,
GPBCodedInputStream *input, id<GPBExtensionRegistry>extensionRegistry) {
GPBCodedInputStreamState *state = &input->state_;
id genericArray = GetOrCreateArrayIvarWithField(self, field);
@ -2247,8 +2375,7 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
}
case GPBDataTypeEnum: {
int32_t val = GPBCodedInputStreamReadEnum(state);
if (GPBHasPreservingUnknownEnumSemantics(syntax) ||
[field isValidEnumValue:val]) {
if (!GPBFieldIsClosedEnum(field) || [field isValidEnumValue:val]) {
[(GPBEnumArray*)genericArray addRawValue:val];
} else {
GPBUnknownFieldSet *unknownFields = GetOrMakeUnknownFields(self);
@ -2262,7 +2389,6 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
- (void)mergeFromCodedInputStream:(GPBCodedInputStream *)input
extensionRegistry:(id<GPBExtensionRegistry>)extensionRegistry {
GPBDescriptor *descriptor = [self descriptor];
GPBFileSyntax syntax = descriptor.file.syntax;
GPBCodedInputStreamState *state = &input->state_;
uint32_t tag = 0;
NSUInteger startingIndex = 0;
@ -2280,7 +2406,7 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
if (GPBFieldTag(fieldDescriptor) == tag) {
GPBFieldType fieldType = fieldDescriptor.fieldType;
if (fieldType == GPBFieldTypeSingle) {
MergeSingleFieldFromCodedInputStream(self, fieldDescriptor, syntax,
MergeSingleFieldFromCodedInputStream(self, fieldDescriptor,
input, extensionRegistry);
// Well formed protos will only have a single field once, advance
// the starting index to the next field.
@ -2288,13 +2414,13 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
} else if (fieldType == GPBFieldTypeRepeated) {
if (fieldDescriptor.isPackable) {
MergeRepeatedPackedFieldFromCodedInputStream(
self, fieldDescriptor, syntax, input);
self, fieldDescriptor, input);
// Well formed protos will only have a repeated field that is
// packed once, advance the starting index to the next field.
startingIndex += 1;
} else {
MergeRepeatedNotPackedFieldFromCodedInputStream(
self, fieldDescriptor, syntax, input, extensionRegistry);
self, fieldDescriptor, input, extensionRegistry);
}
} else { // fieldType == GPBFieldTypeMap
// GPB*Dictionary or NSDictionary, exact type doesn't matter at this
@ -2325,13 +2451,13 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
BOOL alternateIsPacked = !fieldDescriptor.isPackable;
if (alternateIsPacked) {
MergeRepeatedPackedFieldFromCodedInputStream(
self, fieldDescriptor, syntax, input);
self, fieldDescriptor, input);
// Well formed protos will only have a repeated field that is
// packed once, advance the starting index to the next field.
startingIndex += 1;
} else {
MergeRepeatedNotPackedFieldFromCodedInputStream(
self, fieldDescriptor, syntax, input, extensionRegistry);
self, fieldDescriptor, input, extensionRegistry);
}
merged = YES;
break;

@ -6,10 +6,10 @@
#import "GPBMessage.h"
#import "GPBRootObject.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30005
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30004 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#if 30005 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
@ -65,4 +65,4 @@ CF_EXTERN_C_END
// @@protoc_insertion_point(global_scope)
// clange-format on
// clang-format on

@ -68,7 +68,7 @@ typedef struct GPBSourceContext__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBSourceContext__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG

@ -6,10 +6,10 @@
#import "GPBMessage.h"
#import "GPBRootObject.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30005
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30004 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#if 30005 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
@ -192,4 +192,4 @@ CF_EXTERN_C_END
// @@protoc_insertion_point(global_scope)
// clange-format on
// clang-format on

@ -61,7 +61,8 @@ GPBEnumDescriptor *GPBNullValue_EnumDescriptor(void) {
valueNames:valueNames
values:values
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
enumVerifier:GPBNullValue_IsValidValue];
enumVerifier:GPBNullValue_IsValidValue
flags:GPBEnumDescriptorInitializationFlag_None];
GPBEnumDescriptor *expected = nil;
if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
[worker release];
@ -113,7 +114,7 @@ typedef struct GPBStruct__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBStruct__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -213,7 +214,7 @@ typedef struct GPBValue__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBValue__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
static const char *oneofs[] = {
"kind",
};
@ -281,7 +282,7 @@ typedef struct GPBListValue__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBListValue__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG

@ -6,10 +6,10 @@
#import "GPBMessage.h"
#import "GPBRootObject.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30005
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30004 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#if 30005 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
@ -162,4 +162,4 @@ CF_EXTERN_C_END
// @@protoc_insertion_point(global_scope)
// clange-format on
// clang-format on

@ -79,7 +79,7 @@ typedef struct GPBTimestamp__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBTimestamp__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG

@ -8,10 +8,10 @@
#import "GPBAny.pbobjc.h"
#import "GPBSourceContext.pbobjc.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30005
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30004 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#if 30005 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
@ -432,4 +432,4 @@ CF_EXTERN_C_END
// @@protoc_insertion_point(global_scope)
// clange-format on
// clang-format on

@ -63,7 +63,8 @@ GPBEnumDescriptor *GPBSyntax_EnumDescriptor(void) {
valueNames:valueNames
values:values
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
enumVerifier:GPBSyntax_IsValidValue];
enumVerifier:GPBSyntax_IsValidValue
flags:GPBEnumDescriptorInitializationFlag_None];
GPBEnumDescriptor *expected = nil;
if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
[worker release];
@ -82,6 +83,122 @@ BOOL GPBSyntax_IsValidValue(int32_t value__) {
}
}
#pragma mark - Enum GPBField_Kind
GPBEnumDescriptor *GPBField_Kind_EnumDescriptor(void) {
static _Atomic(GPBEnumDescriptor*) descriptor = nil;
if (!descriptor) {
static const char *valueNames =
"TypeUnknown\000TypeDouble\000TypeFloat\000TypeInt"
"64\000TypeUint64\000TypeInt32\000TypeFixed64\000Type"
"Fixed32\000TypeBool\000TypeString\000TypeGroup\000Ty"
"peMessage\000TypeBytes\000TypeUint32\000TypeEnum\000"
"TypeSfixed32\000TypeSfixed64\000TypeSint32\000Typ"
"eSint64\000";
static const int32_t values[] = {
GPBField_Kind_TypeUnknown,
GPBField_Kind_TypeDouble,
GPBField_Kind_TypeFloat,
GPBField_Kind_TypeInt64,
GPBField_Kind_TypeUint64,
GPBField_Kind_TypeInt32,
GPBField_Kind_TypeFixed64,
GPBField_Kind_TypeFixed32,
GPBField_Kind_TypeBool,
GPBField_Kind_TypeString,
GPBField_Kind_TypeGroup,
GPBField_Kind_TypeMessage,
GPBField_Kind_TypeBytes,
GPBField_Kind_TypeUint32,
GPBField_Kind_TypeEnum,
GPBField_Kind_TypeSfixed32,
GPBField_Kind_TypeSfixed64,
GPBField_Kind_TypeSint32,
GPBField_Kind_TypeSint64,
};
GPBEnumDescriptor *worker =
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Kind)
valueNames:valueNames
values:values
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
enumVerifier:GPBField_Kind_IsValidValue
flags:GPBEnumDescriptorInitializationFlag_None];
GPBEnumDescriptor *expected = nil;
if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
[worker release];
}
}
return descriptor;
}
BOOL GPBField_Kind_IsValidValue(int32_t value__) {
switch (value__) {
case GPBField_Kind_TypeUnknown:
case GPBField_Kind_TypeDouble:
case GPBField_Kind_TypeFloat:
case GPBField_Kind_TypeInt64:
case GPBField_Kind_TypeUint64:
case GPBField_Kind_TypeInt32:
case GPBField_Kind_TypeFixed64:
case GPBField_Kind_TypeFixed32:
case GPBField_Kind_TypeBool:
case GPBField_Kind_TypeString:
case GPBField_Kind_TypeGroup:
case GPBField_Kind_TypeMessage:
case GPBField_Kind_TypeBytes:
case GPBField_Kind_TypeUint32:
case GPBField_Kind_TypeEnum:
case GPBField_Kind_TypeSfixed32:
case GPBField_Kind_TypeSfixed64:
case GPBField_Kind_TypeSint32:
case GPBField_Kind_TypeSint64:
return YES;
default:
return NO;
}
}
#pragma mark - Enum GPBField_Cardinality
GPBEnumDescriptor *GPBField_Cardinality_EnumDescriptor(void) {
static _Atomic(GPBEnumDescriptor*) descriptor = nil;
if (!descriptor) {
static const char *valueNames =
"CardinalityUnknown\000CardinalityOptional\000C"
"ardinalityRequired\000CardinalityRepeated\000";
static const int32_t values[] = {
GPBField_Cardinality_CardinalityUnknown,
GPBField_Cardinality_CardinalityOptional,
GPBField_Cardinality_CardinalityRequired,
GPBField_Cardinality_CardinalityRepeated,
};
GPBEnumDescriptor *worker =
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Cardinality)
valueNames:valueNames
values:values
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
enumVerifier:GPBField_Cardinality_IsValidValue
flags:GPBEnumDescriptorInitializationFlag_None];
GPBEnumDescriptor *expected = nil;
if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
[worker release];
}
}
return descriptor;
}
BOOL GPBField_Cardinality_IsValidValue(int32_t value__) {
switch (value__) {
case GPBField_Cardinality_CardinalityUnknown:
case GPBField_Cardinality_CardinalityOptional:
case GPBField_Cardinality_CardinalityRequired:
case GPBField_Cardinality_CardinalityRepeated:
return YES;
default:
return NO;
}
}
#pragma mark - GPBType
@implementation GPBType
@ -171,7 +288,7 @@ typedef struct GPBType__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBType__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -326,7 +443,7 @@ typedef struct GPBField__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBField__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
static const char *extraTextFormatInfo =
"\001\006\004\241!!\000";
@ -366,120 +483,6 @@ void SetGPBField_Cardinality_RawValue(GPBField *message, int32_t value) {
GPBSetMessageRawEnumField(message, field, value);
}
#pragma mark - Enum GPBField_Kind
GPBEnumDescriptor *GPBField_Kind_EnumDescriptor(void) {
static _Atomic(GPBEnumDescriptor*) descriptor = nil;
if (!descriptor) {
static const char *valueNames =
"TypeUnknown\000TypeDouble\000TypeFloat\000TypeInt"
"64\000TypeUint64\000TypeInt32\000TypeFixed64\000Type"
"Fixed32\000TypeBool\000TypeString\000TypeGroup\000Ty"
"peMessage\000TypeBytes\000TypeUint32\000TypeEnum\000"
"TypeSfixed32\000TypeSfixed64\000TypeSint32\000Typ"
"eSint64\000";
static const int32_t values[] = {
GPBField_Kind_TypeUnknown,
GPBField_Kind_TypeDouble,
GPBField_Kind_TypeFloat,
GPBField_Kind_TypeInt64,
GPBField_Kind_TypeUint64,
GPBField_Kind_TypeInt32,
GPBField_Kind_TypeFixed64,
GPBField_Kind_TypeFixed32,
GPBField_Kind_TypeBool,
GPBField_Kind_TypeString,
GPBField_Kind_TypeGroup,
GPBField_Kind_TypeMessage,
GPBField_Kind_TypeBytes,
GPBField_Kind_TypeUint32,
GPBField_Kind_TypeEnum,
GPBField_Kind_TypeSfixed32,
GPBField_Kind_TypeSfixed64,
GPBField_Kind_TypeSint32,
GPBField_Kind_TypeSint64,
};
GPBEnumDescriptor *worker =
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Kind)
valueNames:valueNames
values:values
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
enumVerifier:GPBField_Kind_IsValidValue];
GPBEnumDescriptor *expected = nil;
if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
[worker release];
}
}
return descriptor;
}
BOOL GPBField_Kind_IsValidValue(int32_t value__) {
switch (value__) {
case GPBField_Kind_TypeUnknown:
case GPBField_Kind_TypeDouble:
case GPBField_Kind_TypeFloat:
case GPBField_Kind_TypeInt64:
case GPBField_Kind_TypeUint64:
case GPBField_Kind_TypeInt32:
case GPBField_Kind_TypeFixed64:
case GPBField_Kind_TypeFixed32:
case GPBField_Kind_TypeBool:
case GPBField_Kind_TypeString:
case GPBField_Kind_TypeGroup:
case GPBField_Kind_TypeMessage:
case GPBField_Kind_TypeBytes:
case GPBField_Kind_TypeUint32:
case GPBField_Kind_TypeEnum:
case GPBField_Kind_TypeSfixed32:
case GPBField_Kind_TypeSfixed64:
case GPBField_Kind_TypeSint32:
case GPBField_Kind_TypeSint64:
return YES;
default:
return NO;
}
}
#pragma mark - Enum GPBField_Cardinality
GPBEnumDescriptor *GPBField_Cardinality_EnumDescriptor(void) {
static _Atomic(GPBEnumDescriptor*) descriptor = nil;
if (!descriptor) {
static const char *valueNames =
"CardinalityUnknown\000CardinalityOptional\000C"
"ardinalityRequired\000CardinalityRepeated\000";
static const int32_t values[] = {
GPBField_Cardinality_CardinalityUnknown,
GPBField_Cardinality_CardinalityOptional,
GPBField_Cardinality_CardinalityRequired,
GPBField_Cardinality_CardinalityRepeated,
};
GPBEnumDescriptor *worker =
[GPBEnumDescriptor allocDescriptorForName:GPBNSStringifySymbol(GPBField_Cardinality)
valueNames:valueNames
values:values
count:(uint32_t)(sizeof(values) / sizeof(int32_t))
enumVerifier:GPBField_Cardinality_IsValidValue];
GPBEnumDescriptor *expected = nil;
if (!atomic_compare_exchange_strong(&descriptor, &expected, worker)) {
[worker release];
}
}
return descriptor;
}
BOOL GPBField_Cardinality_IsValidValue(int32_t value__) {
switch (value__) {
case GPBField_Cardinality_CardinalityUnknown:
case GPBField_Cardinality_CardinalityOptional:
case GPBField_Cardinality_CardinalityRequired:
case GPBField_Cardinality_CardinalityRepeated:
return YES;
default:
return NO;
}
}
#pragma mark - GPBEnum
@implementation GPBEnum
@ -558,7 +561,7 @@ typedef struct GPBEnum__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBEnum__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -637,7 +640,7 @@ typedef struct GPBEnumValue__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBEnumValue__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -693,7 +696,7 @@ typedef struct GPBOption__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBOption__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG

@ -37,8 +37,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* A collection of unknown fields. Fields parsed from the binary representation
* of a message that are unknown end up in an instance of this set. This only
* applies for files declared with the "proto2" syntax. Files declared with the
* "proto3" syntax discard the unknown values.
* applies for files declared with the "proto2" syntax.
**/
@interface GPBUnknownFieldSet : NSObject <NSCopying>

@ -669,8 +669,7 @@ int32_t GPBGetMessageEnumField(GPBMessage *self, GPBFieldDescriptor *field) {
// If this is presevering unknown enums, make sure the value is valid before
// returning it.
GPBFileSyntax syntax = [self descriptor].file.syntax;
if (GPBHasPreservingUnknownEnumSemantics(syntax) && ![field isValidEnumValue:result]) {
if (!GPBFieldIsClosedEnum(field) && ![field isValidEnumValue:result]) {
result = kGPBUnrecognizedEnumeratorValue;
}
return result;

@ -6,10 +6,10 @@
#import "GPBMessage.h"
#import "GPBRootObject.h"
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30004
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30005
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
#if 30004 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#if 30005 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
#endif
@ -207,4 +207,4 @@ CF_EXTERN_C_END
// @@protoc_insertion_point(global_scope)
// clange-format on
// clang-format on

@ -68,7 +68,7 @@ typedef struct GPBDoubleValue__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBDoubleValue__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -113,7 +113,7 @@ typedef struct GPBFloatValue__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBFloatValue__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -158,7 +158,7 @@ typedef struct GPBInt64Value__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBInt64Value__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -203,7 +203,7 @@ typedef struct GPBUInt64Value__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBUInt64Value__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -248,7 +248,7 @@ typedef struct GPBInt32Value__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBInt32Value__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -293,7 +293,7 @@ typedef struct GPBUInt32Value__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBUInt32Value__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -337,7 +337,7 @@ typedef struct GPBBoolValue__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBBoolValue__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -382,7 +382,7 @@ typedef struct GPBStringValue__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBStringValue__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG
@ -427,7 +427,7 @@ typedef struct GPBBytesValue__storage_ {
fields:fields
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
storageSize:sizeof(GPBBytesValue__storage_)
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown)];
flags:(GPBDescriptorInitializationFlags)(GPBDescriptorInitializationFlag_UsesClassRefs | GPBDescriptorInitializationFlag_Proto3OptionalKnown | GPBDescriptorInitializationFlag_ClosedEnumSupportKnown)];
#if defined(DEBUG) && DEBUG
NSAssert(descriptor == nil, @"Startup recursed!");
#endif // DEBUG

@ -651,10 +651,10 @@
attributes = {
LastSwiftUpdateCheck = 0710;
LastTestingUpgradeCheck = 0600;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1400;
TargetAttributes = {
8BBEA4A5147C727100C4ADB7 = {
LastSwiftMigration = 0940;
LastSwiftMigration = "";
TestTargetID = 8B9A5EA41831993600A9D33B;
};
F45BBC141B0CE3C6002D064D = {
@ -664,11 +664,11 @@
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ProtocolBuffers_OSX" */;
compatibilityVersion = "Xcode 13.0";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 1;
knownRegions = (
English,
en,
Base,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
@ -700,6 +700,7 @@
/* Begin PBXShellScriptBuildPhase section */
F4B62A781AF91F6000AFCEDC /* Script: Check Runtime Stamps */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@ -835,6 +836,7 @@
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
PRODUCT_NAME = ProtocolBuffers;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)";
};
@ -845,6 +847,7 @@
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
PRODUCT_NAME = ProtocolBuffers;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)";
};
@ -856,6 +859,7 @@
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
INFOPLIST_FILE = "Tests/UnitTests-Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@ -867,7 +871,7 @@
PRODUCT_NAME = UnitTests;
SWIFT_OBJC_BRIDGING_HEADER = "Tests/UnitTests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
USER_HEADER_SEARCH_PATHS = (
"${PROJECT_DERIVED_FILE_DIR}/protos",
"$(SRCROOT)",
@ -887,6 +891,7 @@
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
INFOPLIST_FILE = "Tests/UnitTests-Info.plist";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
@ -897,7 +902,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "com.yourcompany.${PRODUCT_NAME:identifier}";
PRODUCT_NAME = UnitTests;
SWIFT_OBJC_BRIDGING_HEADER = "Tests/UnitTests-Bridging-Header.h";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
USER_HEADER_SEARCH_PATHS = (
"${PROJECT_DERIVED_FILE_DIR}/protos",
"$(SRCROOT)",
@ -915,6 +920,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
@ -932,12 +938,14 @@
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEAD_CODE_STRIPPING = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = c99;
@ -986,6 +994,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
@ -1003,12 +1012,14 @@
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
DEAD_CODE_STRIPPING = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = c99;
@ -1057,6 +1068,7 @@
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
PRODUCT_NAME = TestSingleSourceBuild;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)";
};
@ -1067,6 +1079,7 @@
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
PRODUCT_NAME = TestSingleSourceBuild;
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)";
};
@ -1076,6 +1089,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
DEAD_CODE_STRIPPING = YES;
};
name = Debug;
};
@ -1083,6 +1097,7 @@
isa = XCBuildConfiguration;
buildSettings = {
CLANG_ENABLE_OBJC_WEAK = YES;
DEAD_CODE_STRIPPING = YES;
};
name = Release;
};

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -293,8 +293,6 @@
</SkippedTests>
</TestableReference>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
@ -315,8 +313,6 @@
ReferencedContainer = "container:ProtocolBuffers_OSX.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -54,8 +54,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7461B52D0F94FAF800A0C422"
BuildableName = "libProtocolBuffers.a"
BlueprintName = "ProtocolBuffers"
ReferencedContainer = "container:ProtocolBuffers_OSX.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
@ -73,17 +82,6 @@
</SkippedTests>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7461B52D0F94FAF800A0C422"
BuildableName = "libProtocolBuffers.a"
BlueprintName = "ProtocolBuffers"
ReferencedContainer = "container:ProtocolBuffers_OSX.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@ -104,8 +102,6 @@
ReferencedContainer = "container:ProtocolBuffers_OSX.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

@ -658,7 +658,7 @@
attributes = {
LastSwiftUpdateCheck = 0710;
LastTestingUpgradeCheck = 0600;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1400;
TargetAttributes = {
8BBEA4A5147C727100C4ADB7 = {
LastSwiftMigration = 0940;
@ -671,11 +671,11 @@
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ProtocolBuffers_iOS" */;
compatibilityVersion = "Xcode 13.0";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 1;
knownRegions = (
English,
en,
Base,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
@ -707,6 +707,7 @@
/* Begin PBXShellScriptBuildPhase section */
F4B62A791AF91F7500AFCEDC /* Script: Check Runtime Stamps */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@ -882,7 +883,7 @@
PRODUCT_NAME = UnitTests;
SWIFT_OBJC_BRIDGING_HEADER = "Tests/UnitTests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = (
"${PROJECT_DERIVED_FILE_DIR}/protos",
@ -919,7 +920,7 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = UnitTests;
SWIFT_OBJC_BRIDGING_HEADER = "Tests/UnitTests-Bridging-Header.h";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = (
"${PROJECT_DERIVED_FILE_DIR}/protos",
@ -938,6 +939,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
@ -955,6 +957,7 @@
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
@ -990,7 +993,7 @@
GCC_WARN_UNUSED_PARAMETER = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
GENERATE_PROFILING_CODE = NO;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
ONLY_ACTIVE_ARCH = YES;
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
@ -1009,6 +1012,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
@ -1026,6 +1030,7 @@
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
@ -1059,7 +1064,7 @@
GCC_WARN_UNUSED_PARAMETER = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
GENERATE_PROFILING_CODE = NO;
IPHONEOS_DEPLOYMENT_TARGET = 10.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -293,17 +293,6 @@
</SkippedTests>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8B9A5EA41831993600A9D33B"
BuildableName = "iOSTestHarness.app"
BlueprintName = "iOSTestHarness"
ReferencedContainer = "container:ProtocolBuffers_iOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
@ -315,8 +304,6 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -54,8 +54,8 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<Testables>
<TestableReference
skipped = "NO">
@ -73,17 +73,6 @@
</SkippedTests>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "8B9A5EA41831993600A9D33B"
BuildableName = "iOSTestHarness.app"
BlueprintName = "iOSTestHarness"
ReferencedContainer = "container:ProtocolBuffers_iOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@ -104,8 +93,6 @@
ReferencedContainer = "container:ProtocolBuffers_iOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

@ -658,7 +658,7 @@
attributes = {
LastSwiftUpdateCheck = 0710;
LastTestingUpgradeCheck = 0600;
LastUpgradeCheck = 0930;
LastUpgradeCheck = 1400;
TargetAttributes = {
8BBEA4A5147C727100C4ADB7 = {
LastSwiftMigration = 0940;
@ -671,11 +671,11 @@
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ProtocolBuffers_tvOS" */;
compatibilityVersion = "Xcode 13.0";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 1;
knownRegions = (
English,
en,
Base,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
projectDirPath = "";
@ -707,6 +707,7 @@
/* Begin PBXShellScriptBuildPhase section */
F4B62A791AF91F7500AFCEDC /* Script: Check Runtime Stamps */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@ -878,7 +879,7 @@
PRODUCT_NAME = UnitTests;
SWIFT_OBJC_BRIDGING_HEADER = "Tests/UnitTests-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
USER_HEADER_SEARCH_PATHS = (
"${PROJECT_DERIVED_FILE_DIR}/protos",
"$(SRCROOT)",
@ -914,7 +915,7 @@
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = UnitTests;
SWIFT_OBJC_BRIDGING_HEADER = "Tests/UnitTests-Bridging-Header.h";
SWIFT_VERSION = 4.0;
SWIFT_VERSION = 5.0;
USER_HEADER_SEARCH_PATHS = (
"${PROJECT_DERIVED_FILE_DIR}/protos",
"$(SRCROOT)",
@ -932,6 +933,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
@ -949,6 +951,7 @@
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
@ -1003,6 +1006,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES;
@ -1020,6 +1024,7 @@
CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -41,6 +41,15 @@
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7461B52D0F94FAF800A0C422"
BuildableName = "libProtocolBuffers.a"
BlueprintName = "ProtocolBuffers"
ReferencedContainer = "container:ProtocolBuffers_tvOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
@ -310,17 +319,6 @@
</SkippedTests>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7461B52D0F94FAF800A0C422"
BuildableName = "libProtocolBuffers.a"
BlueprintName = "ProtocolBuffers"
ReferencedContainer = "container:ProtocolBuffers_tvOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Release"
@ -341,8 +339,6 @@
ReferencedContainer = "container:ProtocolBuffers_tvOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0930"
LastUpgradeVersion = "1400"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
@ -54,8 +54,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7461B52D0F94FAF800A0C422"
BuildableName = "libProtocolBuffers.a"
BlueprintName = "ProtocolBuffers"
ReferencedContainer = "container:ProtocolBuffers_tvOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
@ -73,17 +82,6 @@
</SkippedTests>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "7461B52D0F94FAF800A0C422"
BuildableName = "libProtocolBuffers.a"
BlueprintName = "ProtocolBuffers"
ReferencedContainer = "container:ProtocolBuffers_tvOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@ -104,8 +102,6 @@
ReferencedContainer = "container:ProtocolBuffers_tvOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"

@ -1481,6 +1481,82 @@
XCTAssertEqualObjects(message, message2);
}
- (void)testClosedEnumsInExtensions {
// Only unknown values.
NSData *data =
DataFromCStr("\xA8\x01\x0A" // optional_nested_enum_extension set to 10
"\x98\x03\x0B" // repeated_nested_enum_extension set to 11
"\xA2\x03\x01\x0C" // repeated_foreign_enum_extension set to 12 (packed)
);
NSError *error = nil;
TestAllExtensions *msg = [TestAllExtensions parseFromData:data
extensionRegistry:[self extensionRegistry]
error:&error];
XCTAssertNil(error);
XCTAssertFalse([msg hasExtension:[UnittestRoot optionalNestedEnumExtension]]);
XCTAssertFalse([msg hasExtension:[UnittestRoot repeatedNestedEnumExtension]]);
XCTAssertFalse([msg hasExtension:[UnittestRoot repeatedForeignEnumExtension]]);
GPBUnknownFieldSet *unknownFields = msg.unknownFields;
GPBUnknownField *field =
[unknownFields getField:[UnittestRoot optionalNestedEnumExtension].fieldNumber];
XCTAssertNotNil(field);
XCTAssertEqual(field.varintList.count, 1);
XCTAssertEqual([field.varintList valueAtIndex:0], 10);
field = [unknownFields getField:[UnittestRoot repeatedNestedEnumExtension].fieldNumber];
XCTAssertNotNil(field);
XCTAssertEqual(field.varintList.count, 1);
XCTAssertEqual([field.varintList valueAtIndex:0], 11);
field = [unknownFields getField:[UnittestRoot repeatedForeignEnumExtension].fieldNumber];
XCTAssertNotNil(field);
XCTAssertEqual(field.varintList.count, 1);
XCTAssertEqual([field.varintList valueAtIndex:0], 12);
// Unknown and known, the known come though an unknown go to unknown fields.
data = DataFromCStr(
"\xA8\x01\x01" // optional_nested_enum_extension set to 1
"\xA8\x01\x0A" // optional_nested_enum_extension set to 10
"\xA8\x01\x02" // optional_nested_enum_extension set to 2
"\x98\x03\x02" // repeated_nested_enum_extension set to 2
"\x98\x03\x0B" // repeated_nested_enum_extension set to 11
"\x98\x03\x03" // repeated_nested_enum_extension set to 3
"\xA2\x03\x03\x04\x0C\x06" // repeated_foreign_enum_extension set to 4, 12, 6 (packed)
);
error = nil;
msg = [TestAllExtensions parseFromData:data
extensionRegistry:[self extensionRegistry]
error:&error];
XCTAssertNil(error);
XCTAssertTrue([msg hasExtension:[UnittestRoot optionalNestedEnumExtension]]);
XCTAssertEqualObjects([msg getExtension:[UnittestRoot optionalNestedEnumExtension]], @2);
XCTAssertTrue([msg hasExtension:[UnittestRoot repeatedNestedEnumExtension]]);
id expected = @[ @2, @3 ];
XCTAssertEqualObjects([msg getExtension:[UnittestRoot repeatedNestedEnumExtension]], expected);
XCTAssertTrue([msg hasExtension:[UnittestRoot repeatedForeignEnumExtension]]);
expected = @[ @4, @6 ];
XCTAssertEqualObjects([msg getExtension:[UnittestRoot repeatedForeignEnumExtension]], expected);
unknownFields = msg.unknownFields;
field = [unknownFields getField:[UnittestRoot optionalNestedEnumExtension].fieldNumber];
XCTAssertNotNil(field);
XCTAssertEqual(field.varintList.count, 1);
XCTAssertEqual([field.varintList valueAtIndex:0], 10);
field = [unknownFields getField:[UnittestRoot repeatedNestedEnumExtension].fieldNumber];
XCTAssertNotNil(field);
XCTAssertEqual(field.varintList.count, 1);
XCTAssertEqual([field.varintList valueAtIndex:0], 11);
field = [unknownFields getField:[UnittestRoot repeatedForeignEnumExtension].fieldNumber];
XCTAssertNotNil(field);
XCTAssertEqual(field.varintList.count, 1);
XCTAssertEqual([field.varintList valueAtIndex:0], 12);
}
- (void)testDefaultingExtensionMessages {
TestAllExtensions *message = [TestAllExtensions message];

@ -5,7 +5,7 @@ if test "$PHP_PROTOBUF" != "no"; then
PHP_NEW_EXTENSION(
protobuf,
arena.c array.c convert.c def.c map.c message.c names.c php-upb.c protobuf.c third_party/utf8_range/naive.c third_party/utf8_range/range2-neon.c third_party/utf8_range/range2-sse.c,
$ext_shared, , -std=gnu99)
$ext_shared, , -std=gnu99 -I@ext_srcdir@/third_party/utf8_range)
PHP_ADD_BUILD_DIR($ext_builddir/third_party/utf8_range)
fi

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

Loading…
Cancel
Save