diff --git a/CHANGES.txt b/CHANGES.txt
index 0713945939961..f9d694a7c4914 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,9 +1,19 @@
+2021-05-25 version 3.17.2 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
+ Kotlin
+ * Fix duplicate class error (#8653)
+
+ PHP
+ * Fixed SEGV in sub-message getters for well-known types when message is unset
+ (#8670)
+
2021-05-07 version 3.17.1 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)
PHP
+ * Fixed PHP memory leaks and arginfo errors. (#8614)
* Fixed JSON parser to allow multiple values from the same oneof as long as
all but one are null.
Ruby
+ * Fixed memory bug: properly root repeated/map field when assigning. (#8639)
* Fixed JSON parser to allow multiple values from the same oneof as long as
all but one are null.
diff --git a/Protobuf-C++.podspec b/Protobuf-C++.podspec
index fbb1ef9265bc4..18d262dcc77bc 100644
--- a/Protobuf-C++.podspec
+++ b/Protobuf-C++.podspec
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Protobuf-C++'
- s.version = '3.17.1'
+ s.version = '3.17.2'
s.summary = 'Protocol Buffers v3 runtime library for C++.'
s.homepage = 'https://github.com/google/protobuf'
s.license = '3-Clause BSD License'
diff --git a/Protobuf.podspec b/Protobuf.podspec
index 0f98517bcd0df..30d8e64d4eca5 100644
--- a/Protobuf.podspec
+++ b/Protobuf.podspec
@@ -5,7 +5,7 @@
# dependent projects use the :git notation to refer to the library.
Pod::Spec.new do |s|
s.name = 'Protobuf'
- s.version = '3.17.1'
+ s.version = '3.17.2'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/protocolbuffers/protobuf'
s.license = '3-Clause BSD License'
diff --git a/configure.ac b/configure.ac
index 0c1276b734092..bf6251644363a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@ AC_PREREQ(2.59)
# In the SVN trunk, the version should always be the next anticipated release
# version with the "-pre" suffix. (We used to use "-SNAPSHOT" but this pushed
# the size of one file name in the dist tarfile over the 99-char limit.)
-AC_INIT([Protocol Buffers],[3.17.1],[protobuf@googlegroups.com],[protobuf])
+AC_INIT([Protocol Buffers],[3.17.2],[protobuf@googlegroups.com],[protobuf])
AM_MAINTAINER_MODE([enable])
diff --git a/csharp/Google.Protobuf.Tools.nuspec b/csharp/Google.Protobuf.Tools.nuspec
index 3cec102d3fb0a..3e2bc21ffd98b 100644
--- a/csharp/Google.Protobuf.Tools.nuspec
+++ b/csharp/Google.Protobuf.Tools.nuspec
@@ -5,7 +5,7 @@
Google Protocol Buffers toolsTools for Protocol Buffers - Google's data interchange format.See project site for more info.
- 3.17.1
+ 3.17.2Google Inc.protobuf-packageshttps://github.com/protocolbuffers/protobuf/blob/master/LICENSE
diff --git a/csharp/src/Google.Protobuf/Google.Protobuf.csproj b/csharp/src/Google.Protobuf/Google.Protobuf.csproj
index 5348df09e2e36..01f0a53ed0563 100644
--- a/csharp/src/Google.Protobuf/Google.Protobuf.csproj
+++ b/csharp/src/Google.Protobuf/Google.Protobuf.csproj
@@ -4,7 +4,7 @@
C# runtime library for Protocol Buffers - Google's data interchange format.Copyright 2015, Google Inc.Google Protocol Buffers
- 3.17.1
+ 3.17.27.2Google Inc.
diff --git a/java/bom/pom.xml b/java/bom/pom.xml
index b4a757f49f2cb..b78963ee8d7a1 100644
--- a/java/bom/pom.xml
+++ b/java/bom/pom.xml
@@ -4,7 +4,7 @@
com.google.protobufprotobuf-bom
- 3.17.1
+ 3.17.2pomProtocol Buffers [BOM]
diff --git a/java/core/pom.xml b/java/core/pom.xml
index 97b0c3beba34b..1855ba7629adf 100644
--- a/java/core/pom.xml
+++ b/java/core/pom.xml
@@ -4,7 +4,7 @@
com.google.protobufprotobuf-parent
- 3.17.1
+ 3.17.2protobuf-java
diff --git a/java/kotlin-lite/pom.xml b/java/kotlin-lite/pom.xml
index c7201ae20b54b..409ba220bedcc 100644
--- a/java/kotlin-lite/pom.xml
+++ b/java/kotlin-lite/pom.xml
@@ -4,11 +4,10 @@
com.google.protobufprotobuf-parent
- 3.17.1
+ 3.17.2protobuf-kotlin-lite
- bundleProtocol Buffers [Lite]
@@ -263,22 +262,6 @@
-
-
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
- com.google.protobuf
- https://developers.google.com/protocol-buffers/
- com.google.protobuf
- com.google.protobuf;version=${project.version}
- sun.misc;resolution:=optional,*
-
-
-
diff --git a/java/kotlin/pom.xml b/java/kotlin/pom.xml
index cf48a1c343132..6e8c93dcac595 100644
--- a/java/kotlin/pom.xml
+++ b/java/kotlin/pom.xml
@@ -4,11 +4,10 @@
com.google.protobufprotobuf-parent
- 3.17.1
+ 3.17.2protobuf-kotlin
- bundleProtocol Buffers [Core]
@@ -219,21 +218,6 @@
-
-
- org.apache.felix
- maven-bundle-plugin
- true
-
-
- com.google.protobuf
- https://developers.google.com/protocol-buffers/
- com.google.protobuf
- com.google.protobuf;version=${project.version}
- sun.misc;resolution:=optional,*
-
-
-
diff --git a/java/lite/pom.xml b/java/lite/pom.xml
index ef7c1d58b9fe0..8887c8a72f187 100644
--- a/java/lite/pom.xml
+++ b/java/lite/pom.xml
@@ -4,7 +4,7 @@
com.google.protobufprotobuf-parent
- 3.17.1
+ 3.17.2protobuf-javalite
diff --git a/java/pom.xml b/java/pom.xml
index d6d8001ee6c7e..3a774ec2b00b8 100644
--- a/java/pom.xml
+++ b/java/pom.xml
@@ -4,7 +4,7 @@
com.google.protobufprotobuf-parent
- 3.17.1
+ 3.17.2pomProtocol Buffers [Parent]
@@ -228,6 +228,19 @@
false
+
+ org.jetbrains.dokka
+ dokka-maven-plugin
+ 1.4.32
+
+
+ prepare-package
+
+ javadocJar
+
+
+
+
diff --git a/java/util/pom.xml b/java/util/pom.xml
index 34b5d3d2b1869..e4d3df2c24d60 100644
--- a/java/util/pom.xml
+++ b/java/util/pom.xml
@@ -4,7 +4,7 @@
com.google.protobufprotobuf-parent
- 3.17.1
+ 3.17.2protobuf-java-util
diff --git a/js/package.json b/js/package.json
index 3886918e6a92e..f126067ab4d0f 100644
--- a/js/package.json
+++ b/js/package.json
@@ -1,6 +1,6 @@
{
"name": "google-protobuf",
- "version": "3.17.1",
+ "version": "3.17.2",
"description": "Protocol Buffers for JavaScript",
"main": "google-protobuf.js",
"files": [
diff --git a/php/ext/google/protobuf/message.c b/php/ext/google/protobuf/message.c
index b32b325555dc1..7a1aefa6f7299 100644
--- a/php/ext/google/protobuf/message.c
+++ b/php/ext/google/protobuf/message.c
@@ -134,6 +134,10 @@ static void Message_get(Message *intern, const upb_fielddef *f, zval *rv) {
RepeatedField_GetPhpWrapper(rv, msgval.array, TypeInfo_Get(f),
&intern->arena);
} else {
+ if (upb_fielddef_issubmsg(f) && !upb_msg_has(intern->msg, f)) {
+ ZVAL_NULL(rv);
+ return;
+ }
upb_msgval msgval = upb_msg_get(intern->msg, f);
Convert_UpbToPhp(msgval, rv, TypeInfo_Get(f), &intern->arena);
}
@@ -280,7 +284,6 @@ static int Message_has_property(PROTO_VAL *obj, PROTO_STR *member,
* Message_unset_property()
*
* Object handler for unsetting a property. Called when PHP code calls:
- * does any of:
*
* unset($message->foobar);
*
diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml
index 4dbd351e5b180..b27ac4bbee61b 100644
--- a/php/ext/google/protobuf/package.xml
+++ b/php/ext/google/protobuf/package.xml
@@ -10,11 +10,11 @@
protobuf-opensource@google.comyes
- 2021-05-19
-
+ 2021-05-25
+
- 3.17.1
- 3.17.1
+ 3.17.2
+ 3.17.2stable
@@ -22,7 +22,7 @@
3-Clause BSD License
- No new changes in 3.17.0
+ * No new changes in 3.17.2
@@ -975,6 +975,24 @@ G A release.
3-Clause BSD License
+ * Fixed PHP memory leaks and arginfo errors. (#8614)
+ * Fixed JSON parser to allow multiple values from the same oneof as long as
+ all but one are null.
+
+
+
+
+ 3.17.2
+ 3.17.2
+
+
+ stable
+ stable
+
+ 2021-05-25
+
+ 3-Clause BSD License
+
diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h
index 530efbd8e4a1a..7d30d26e0cfbc 100644
--- a/php/ext/google/protobuf/protobuf.h
+++ b/php/ext/google/protobuf/protobuf.h
@@ -81,7 +81,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setter, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
-#define PHP_PROTOBUF_VERSION "3.17.1"
+#define PHP_PROTOBUF_VERSION "3.17.2"
// ptr -> PHP object cache. This is a weak map that caches lazily-created
// wrapper objects around upb types:
diff --git a/php/src/Google/Protobuf/Api.php b/php/src/Google/Protobuf/Api.php
index 7cbb30eb42846..e7d76c01d6cfe 100644
--- a/php/src/Google/Protobuf/Api.php
+++ b/php/src/Google/Protobuf/Api.php
@@ -275,7 +275,7 @@ public function setVersion($var)
*/
public function getSourceContext()
{
- return isset($this->source_context) ? $this->source_context : null;
+ return $this->source_context;
}
public function hasSourceContext()
diff --git a/php/src/Google/Protobuf/Enum.php b/php/src/Google/Protobuf/Enum.php
index 2e0ac9987b6b8..e803e930d8f21 100644
--- a/php/src/Google/Protobuf/Enum.php
+++ b/php/src/Google/Protobuf/Enum.php
@@ -155,7 +155,7 @@ public function setOptions($var)
*/
public function getSourceContext()
{
- return isset($this->source_context) ? $this->source_context : null;
+ return $this->source_context;
}
public function hasSourceContext()
diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto.php b/php/src/Google/Protobuf/Internal/DescriptorProto.php
index ff308e7eeb146..c58c5739e57ff 100644
--- a/php/src/Google/Protobuf/Internal/DescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/DescriptorProto.php
@@ -256,7 +256,7 @@ public function setOneofDecl($var)
*/
public function getOptions()
{
- return isset($this->options) ? $this->options : null;
+ return $this->options;
}
public function hasOptions()
diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php
index bbe4a6a84f9f8..43c33c4a91034 100644
--- a/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php
+++ b/php/src/Google/Protobuf/Internal/DescriptorProto/ExtensionRange.php
@@ -128,7 +128,7 @@ public function setEnd($var)
*/
public function getOptions()
{
- return isset($this->options) ? $this->options : null;
+ return $this->options;
}
public function hasOptions()
diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
index b9b634282906e..bd50834f81834 100644
--- a/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto.php
@@ -128,7 +128,7 @@ public function setValue($var)
*/
public function getOptions()
{
- return isset($this->options) ? $this->options : null;
+ return $this->options;
}
public function hasOptions()
diff --git a/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php b/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php
index eff1452eed4eb..0feaea6f182f4 100644
--- a/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/EnumValueDescriptorProto.php
@@ -116,7 +116,7 @@ public function setNumber($var)
*/
public function getOptions()
{
- return isset($this->options) ? $this->options : null;
+ return $this->options;
}
public function hasOptions()
diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php
index 94e5fe12ecc9e..9cf6f10cfd2a7 100644
--- a/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto.php
@@ -515,7 +515,7 @@ public function setJsonName($var)
*/
public function getOptions()
{
- return isset($this->options) ? $this->options : null;
+ return $this->options;
}
public function hasOptions()
diff --git a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php
index d96c7a78ecc51..435bd5fb6f061 100644
--- a/php/src/Google/Protobuf/Internal/FileDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/FileDescriptorProto.php
@@ -375,7 +375,7 @@ public function setExtension($var)
*/
public function getOptions()
{
- return isset($this->options) ? $this->options : null;
+ return $this->options;
}
public function hasOptions()
@@ -412,7 +412,7 @@ public function setOptions($var)
*/
public function getSourceCodeInfo()
{
- return isset($this->source_code_info) ? $this->source_code_info : null;
+ return $this->source_code_info;
}
public function hasSourceCodeInfo()
diff --git a/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php b/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php
index 5814f08852961..96efb02d24a10 100644
--- a/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/MethodDescriptorProto.php
@@ -180,7 +180,7 @@ public function setOutputType($var)
*/
public function getOptions()
{
- return isset($this->options) ? $this->options : null;
+ return $this->options;
}
public function hasOptions()
diff --git a/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php b/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php
index 33cf487a8a2ba..3cb9f25c212d2 100644
--- a/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/OneofDescriptorProto.php
@@ -79,7 +79,7 @@ public function setName($var)
*/
public function getOptions()
{
- return isset($this->options) ? $this->options : null;
+ return $this->options;
}
public function hasOptions()
diff --git a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
index f60561c1822cb..c511247692cb7 100644
--- a/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
+++ b/php/src/Google/Protobuf/Internal/ServiceDescriptorProto.php
@@ -106,7 +106,7 @@ public function setMethod($var)
*/
public function getOptions()
{
- return isset($this->options) ? $this->options : null;
+ return $this->options;
}
public function hasOptions()
diff --git a/php/src/Google/Protobuf/Option.php b/php/src/Google/Protobuf/Option.php
index 5166a08db6157..31249e5131145 100644
--- a/php/src/Google/Protobuf/Option.php
+++ b/php/src/Google/Protobuf/Option.php
@@ -101,7 +101,7 @@ public function setName($var)
*/
public function getValue()
{
- return isset($this->value) ? $this->value : null;
+ return $this->value;
}
public function hasValue()
diff --git a/php/src/Google/Protobuf/Type.php b/php/src/Google/Protobuf/Type.php
index 3f2835927396c..41b9e3602f84f 100644
--- a/php/src/Google/Protobuf/Type.php
+++ b/php/src/Google/Protobuf/Type.php
@@ -189,7 +189,7 @@ public function setOptions($var)
*/
public function getSourceContext()
{
- return isset($this->source_context) ? $this->source_context : null;
+ return $this->source_context;
}
public function hasSourceContext()
diff --git a/php/tests/GeneratedClassTest.php b/php/tests/GeneratedClassTest.php
index 5c0f0c70d0ee7..540105c376b72 100644
--- a/php/tests/GeneratedClassTest.php
+++ b/php/tests/GeneratedClassTest.php
@@ -472,6 +472,8 @@ public function testMessageField()
{
$m = new TestMessage();
+ $this->assertNull($m->getOptionalMessage());
+
$sub_m = new Sub();
$sub_m->setA(1);
$m->setOptionalMessage($sub_m);
diff --git a/php/tests/WellKnownTest.php b/php/tests/WellKnownTest.php
index 27b7e1463cec8..486c65ffca8e1 100644
--- a/php/tests/WellKnownTest.php
+++ b/php/tests/WellKnownTest.php
@@ -270,6 +270,8 @@ public function testStruct()
$m = new Value();
+ $this->assertNull($m->getStructValue());
+
$m->setNullValue(NullValue::NULL_VALUE);
$this->assertSame(NullValue::NULL_VALUE, $m->getNullValue());
$this->assertSame("null_value", $m->getKind());
diff --git a/protoc-artifacts/pom.xml b/protoc-artifacts/pom.xml
index c1ff3a6f90841..54e1e269bfd93 100644
--- a/protoc-artifacts/pom.xml
+++ b/protoc-artifacts/pom.xml
@@ -8,7 +8,7 @@
com.google.protobufprotoc
- 3.17.1
+ 3.17.2pomProtobuf Compiler
diff --git a/python/google/protobuf/__init__.py b/python/google/protobuf/__init__.py
index 9f66585651540..67502f0fc80be 100644
--- a/python/google/protobuf/__init__.py
+++ b/python/google/protobuf/__init__.py
@@ -30,4 +30,4 @@
# Copyright 2007 Google Inc. All Rights Reserved.
-__version__ = '3.17.1'
+__version__ = '3.17.2'
diff --git a/ruby/google-protobuf.gemspec b/ruby/google-protobuf.gemspec
index bfc053f49c87c..322939b8db161 100644
--- a/ruby/google-protobuf.gemspec
+++ b/ruby/google-protobuf.gemspec
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "google-protobuf"
- s.version = "3.17.1"
+ s.version = "3.17.2"
git_tag = "v#{s.version.to_s.sub('.rc.', '-rc')}" # Converts X.Y.Z.rc.N to vX.Y.Z-rcN, used for the git tag
s.licenses = ["BSD-3-Clause"]
s.summary = "Protocol Buffers"
diff --git a/src/Makefile.am b/src/Makefile.am
index 12eb70743bbbd..d62aef28f32c0 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -18,7 +18,7 @@ else
PTHREAD_DEF =
endif
-PROTOBUF_VERSION = 28:1:0
+PROTOBUF_VERSION = 28:2:0
if GCC
# Turn on all warnings except for sign comparison (we ignore sign comparison
diff --git a/src/google/protobuf/any.pb.h b/src/google/protobuf/any.pb.h
index 8dc01caeed5c6..e7836ba5a739d 100644
--- a/src/google/protobuf/any.pb.h
+++ b/src/google/protobuf/any.pb.h
@@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3017001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3017002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
diff --git a/src/google/protobuf/api.pb.h b/src/google/protobuf/api.pb.h
index 1f92d4337f53a..7fb45f00aa8a2 100644
--- a/src/google/protobuf/api.pb.h
+++ b/src/google/protobuf/api.pb.h
@@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3017001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3017002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
diff --git a/src/google/protobuf/compiler/php/php_generator.cc b/src/google/protobuf/compiler/php/php_generator.cc
index 45eb4c619637a..f351ccd2a48e0 100644
--- a/src/google/protobuf/compiler/php/php_generator.cc
+++ b/src/google/protobuf/compiler/php/php_generator.cc
@@ -648,32 +648,21 @@ void GenerateFieldAccessor(const FieldDescriptor* field, const Options& options,
std::string deprecation_trigger = (field->options().deprecated()) ? "@trigger_error('" +
field->name() + " is deprecated.', E_USER_DEPRECATED);\n " : "";
+ // Emit getter.
if (oneof != NULL) {
printer->Print(
"public function get^camel_name^()\n"
"{\n"
" ^deprecation_trigger^return $this->readOneof(^number^);\n"
- "}\n\n"
- "public function has^camel_name^()\n"
- "{\n"
- " ^deprecation_trigger^return $this->hasOneof(^number^);\n"
"}\n\n",
"camel_name", UnderscoresToCamelCase(field->name(), true),
"number", IntToString(field->number()),
"deprecation_trigger", deprecation_trigger);
- } else if (field->has_presence()) {
+ } else if (field->has_presence() && !field->message_type()) {
printer->Print(
"public function get^camel_name^()\n"
"{\n"
" ^deprecation_trigger^return isset($this->^name^) ? $this->^name^ : ^default_value^;\n"
- "}\n\n"
- "public function has^camel_name^()\n"
- "{\n"
- " ^deprecation_trigger^return isset($this->^name^);\n"
- "}\n\n"
- "public function clear^camel_name^()\n"
- "{\n"
- " ^deprecation_trigger^unset($this->^name^);\n"
"}\n\n",
"camel_name", UnderscoresToCamelCase(field->name(), true),
"name", field->name(),
@@ -690,6 +679,32 @@ void GenerateFieldAccessor(const FieldDescriptor* field, const Options& options,
"deprecation_trigger", deprecation_trigger);
}
+ // Emit hazzers/clear.
+ if (oneof) {
+ printer->Print(
+ "public function has^camel_name^()\n"
+ "{\n"
+ " ^deprecation_trigger^return $this->hasOneof(^number^);\n"
+ "}\n\n",
+ "camel_name", UnderscoresToCamelCase(field->name(), true),
+ "number", IntToString(field->number()),
+ "deprecation_trigger", deprecation_trigger);
+ } else if (field->has_presence()) {
+ printer->Print(
+ "public function has^camel_name^()\n"
+ "{\n"
+ " ^deprecation_trigger^return isset($this->^name^);\n"
+ "}\n\n"
+ "public function clear^camel_name^()\n"
+ "{\n"
+ " ^deprecation_trigger^unset($this->^name^);\n"
+ "}\n\n",
+ "camel_name", UnderscoresToCamelCase(field->name(), true),
+ "name", field->name(),
+ "default_value", DefaultForField(field),
+ "deprecation_trigger", deprecation_trigger);
+ }
+
// For wrapper types, generate an additional getXXXUnwrapped getter
if (!field->is_map() &&
!field->is_repeated() &&
diff --git a/src/google/protobuf/compiler/plugin.pb.h b/src/google/protobuf/compiler/plugin.pb.h
index 0cb7941eaa0cd..3a2dd0608bfec 100644
--- a/src/google/protobuf/compiler/plugin.pb.h
+++ b/src/google/protobuf/compiler/plugin.pb.h
@@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3017001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3017002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h
index ad1ce4c057b9c..5ec12dcf11290 100644
--- a/src/google/protobuf/descriptor.pb.h
+++ b/src/google/protobuf/descriptor.pb.h
@@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3017001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3017002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
diff --git a/src/google/protobuf/duration.pb.h b/src/google/protobuf/duration.pb.h
index ef343d99011df..05a65ab594a0e 100644
--- a/src/google/protobuf/duration.pb.h
+++ b/src/google/protobuf/duration.pb.h
@@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3017001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3017002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
diff --git a/src/google/protobuf/empty.pb.h b/src/google/protobuf/empty.pb.h
index 40a77fed6c6ae..57f4f04be07bb 100644
--- a/src/google/protobuf/empty.pb.h
+++ b/src/google/protobuf/empty.pb.h
@@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3017001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3017002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
diff --git a/src/google/protobuf/field_mask.pb.h b/src/google/protobuf/field_mask.pb.h
index e71551e822132..dab327f8acc52 100644
--- a/src/google/protobuf/field_mask.pb.h
+++ b/src/google/protobuf/field_mask.pb.h
@@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3017001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3017002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
diff --git a/src/google/protobuf/port_def.inc b/src/google/protobuf/port_def.inc
index 61f085970d9cb..e0406be150235 100644
--- a/src/google/protobuf/port_def.inc
+++ b/src/google/protobuf/port_def.inc
@@ -107,7 +107,7 @@
#ifdef PROTOBUF_VERSION
#error PROTOBUF_VERSION was previously defined
#endif
-#define PROTOBUF_VERSION 3017001
+#define PROTOBUF_VERSION 3017002
#ifdef PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC
#error PROTOBUF_MIN_HEADER_VERSION_FOR_PROTOC was previously defined
diff --git a/src/google/protobuf/source_context.pb.h b/src/google/protobuf/source_context.pb.h
index cf2999e630554..9867f0b4aaa11 100644
--- a/src/google/protobuf/source_context.pb.h
+++ b/src/google/protobuf/source_context.pb.h
@@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3017001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3017002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
diff --git a/src/google/protobuf/struct.pb.h b/src/google/protobuf/struct.pb.h
index 0fec29c0f0e76..d47ae123b1923 100644
--- a/src/google/protobuf/struct.pb.h
+++ b/src/google/protobuf/struct.pb.h
@@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3017001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3017002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
diff --git a/src/google/protobuf/stubs/common.h b/src/google/protobuf/stubs/common.h
index 497a91e266a3a..06ace3d67e9ce 100644
--- a/src/google/protobuf/stubs/common.h
+++ b/src/google/protobuf/stubs/common.h
@@ -82,7 +82,7 @@ namespace internal {
// The current version, represented as a single integer to make comparison
// easier: major * 10^6 + minor * 10^3 + micro
-#define GOOGLE_PROTOBUF_VERSION 3017001
+#define GOOGLE_PROTOBUF_VERSION 3017002
// A suffix string for alpha, beta or rc releases. Empty for stable releases.
#define GOOGLE_PROTOBUF_VERSION_SUFFIX ""
diff --git a/src/google/protobuf/timestamp.pb.h b/src/google/protobuf/timestamp.pb.h
index 3acaca9c482f8..2970c1a34703f 100644
--- a/src/google/protobuf/timestamp.pb.h
+++ b/src/google/protobuf/timestamp.pb.h
@@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3017001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3017002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
diff --git a/src/google/protobuf/type.pb.h b/src/google/protobuf/type.pb.h
index 3242d4b8908f5..1ea54e3f93d5d 100644
--- a/src/google/protobuf/type.pb.h
+++ b/src/google/protobuf/type.pb.h
@@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3017001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3017002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
diff --git a/src/google/protobuf/wrappers.pb.h b/src/google/protobuf/wrappers.pb.h
index e890dffba90f3..9f94177ffa6be 100644
--- a/src/google/protobuf/wrappers.pb.h
+++ b/src/google/protobuf/wrappers.pb.h
@@ -13,7 +13,7 @@
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
-#if 3017001 < PROTOBUF_MIN_PROTOC_VERSION
+#if 3017002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.