Skip to content

Commit

Permalink
Merge 3.9.x 201908071359 to master (#6484)
Browse files Browse the repository at this point in the history
* Add changelog for 3.9.x

* Revert "Make php message class final to avoid mocking (#6277)" (#6324)

This reverts commit 7f84a94.
This is just temporary. Eventually, we still want to roll forward this
change. Some users are complaining they need more time to clean up their
code.

* Update extract_includes.bat.in

File io_win32.h is not in directory google\protobuf\stubs under directory google\protobuf\io

* Set oneof case in array constructor (#6351)

Forgot to set it previously.

* Update protobuf version (#6366)

* Drop building wheel for python 3.4 (#6406)

https://github.com/matthew-brett/multibuild/pull/240

* Fix binary compatibility in FieldCodec factory methods (#6380) (#6424)

* Fix binary compatibility in FieldCodec factory messages

* Make default value parameter for current factories required

* Route old methods through default value overloads

* Remove ExtensionRegistry.Add(params) overload

* Rename ExtensionRegistry.Add(IEnumerable<Extension>) overload to AddRange

* Edit naming of parameters in Extension classes

* * Fix add API warnings to docs for extension APIs
* Rename internal ExtensionSet.GetValue to TryGetValue

* Disable javadoc error (#6371)

* Disable javadoc error

Actual fixes of the javadoc will be followed up

* Remove duplicated configuration

* Update javadoc plugin version

* Updated Bazel test script to use most recent Bazel version (#6413) (#6433)

I'm not exactly sure why, but this fixes the failing Bazel presubmit
test. Using the most recent version seems like a good idea anyway so
that we can make sure we're compatible with any new Bazel changes.

* [bazel] Add fixes for --incompatible_load_{cc,java,proto}_rules_from_bzl

* No need to update version in generated code (#6471)

generate_descriptor will handle that

* Update protobuf version (#6472)
  • Loading branch information
anandolee committed Aug 9, 2019
1 parent 56988be commit 4315677
Show file tree
Hide file tree
Showing 69 changed files with 943 additions and 271 deletions.
53 changes: 53 additions & 0 deletions CHANGES.txt
@@ -1,3 +1,56 @@
2019-06-28 version 3.9.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

C++
* Optimize and simplify implementation of RepeatedPtrFieldBase
* Don't create unnecessary unknown field sets.
* Remove branch from accessors to repeated field element array.
* Added delimited parse and serialize util.
* Reduce size by not emitting constants for fieldnumbers
* Fix a bug when comparing finite and infinite field values with explicit tolerances.
* TextFormat::Parser should use a custom Finder to look up extensions by number if one is provided.
* Add MessageLite::Utf8DebugString() to make MessageLite more compatible with Message.
* Fail fast for better performance in DescriptorPool::FindExtensionByNumber() if descriptor has no defined extensions.
* Adding the file name to help debug colliding extensions
* Added FieldDescriptor::PrintableNameForExtension() and DescriptorPool::FindExtensionByPrintableName().
The latter will replace Reflection::FindKnownExtensionByName().
* Replace NULL with nullptr
* Created a new Add method in repeated field that allows adding a range of elements all at once.
* Enabled enum name-to-value mapping functions for C++ lite
* Avoid dynamic initialization in descriptor.proto generated code
* Move stream functions to MessageLite from Message.
* Move all zero_copy_stream functionality to io_lite.
* Do not create array of matched fields for simple repeated fields
* Enabling silent mode by default to reduce make compilation noise. (#6237)

Java
* Expose TextFormat.Printer and make it configurable. Deprecate the static methods.
* Library for constructing google.protobuf.Struct and google.protobuf.Value
* Make OneofDescriptor extend GenericDescriptor.
* Expose streamingness of service methods from MethodDescriptor.
* Fix a bug where TextFormat fails to parse Any filed with > 1 embedded message sub-fields.
* Establish consistent JsonFormat behavior for nulls in oneofs, regardless of order.
* Update GSON version to 3.8.5. (#6268)
* Add `protobuf_java_lite` Bazel target. (#6177)

Python
* Change implementation of Name() for enums that allow aliases in proto2 in Python
to be in line with claims in C++ implementation (to return first value).
* Explicitly say what field cannot be set when the new value fails a type check.
* Duplicate register in descriptor pool will raise errors
* Add __slots__ to all well_known_types classes, custom attributes are not allowed anymore.
* text_format only present 8 valid digits for float fields by default

JavaScript
* Add Oneof enum to the list of goog.provide

PHP
* Make php message class final to avoid mocking. (#6277)
* Rename get/setXXXValue to get/setXXXWrapper. (#6295)

Ruby
* Remove to_hash methods. (#6166)


2019-04-29 version 3.8.0 (C++/Java/Python/PHP/Objective-C/C#/Ruby/JavaScript)

C++
Expand Down
2 changes: 1 addition & 1 deletion Protobuf.podspec
Expand Up @@ -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.9.0-rc2'
s.version = '3.9.1'
s.summary = 'Protocol Buffers v.3 runtime library for Objective-C.'
s.homepage = 'https://github.com/protocolbuffers/protobuf'
s.license = '3-Clause BSD License'
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Expand Up @@ -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.9.0-rc-1],[protobuf@googlegroups.com],[protobuf])
AC_INIT([Protocol Buffers],[3.9.1],[protobuf@googlegroups.com],[protobuf])

AM_MAINTAINER_MODE([enable])

Expand Down
2 changes: 1 addition & 1 deletion csharp/Google.Protobuf.Tools.nuspec
Expand Up @@ -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.9.0-rc1</version>
<version>3.9.1</version>
<authors>Google Inc.</authors>
<owners>protobuf-packages</owners>
<licenseUrl>https://github.com/protocolbuffers/protobuf/blob/master/LICENSE</licenseUrl>
Expand Down
895 changes: 755 additions & 140 deletions csharp/src/Google.Protobuf.Test/TestProtos/TestMessagesProto3.cs

Large diffs are not rendered by default.

Binary file modified csharp/src/Google.Protobuf.Test/testprotos.pb
Binary file not shown.
16 changes: 9 additions & 7 deletions csharp/src/Google.Protobuf/Extension.cs
Expand Up @@ -35,7 +35,7 @@
namespace Google.Protobuf
{
/// <summary>
/// Represents a non-generic extension definition
/// Represents a non-generic extension definition. This API is experimental and subject to change.
/// </summary>
public abstract class Extension
{
Expand All @@ -44,9 +44,9 @@ public abstract class Extension
/// <summary>
/// Internal use. Creates a new extension with the specified field number.
/// </summary>
protected Extension(int number)
protected Extension(int fieldNumber)
{
FieldNumber = number;
FieldNumber = fieldNumber;
}

internal abstract IExtensionValue CreateValue();
Expand All @@ -58,7 +58,8 @@ protected Extension(int number)
}

/// <summary>
/// Represents a type-safe extension identifier used for getting and setting single extension values in <see cref="IExtendableMessage{T}"/> instances
/// Represents a type-safe extension identifier used for getting and setting single extension values in <see cref="IExtendableMessage{T}"/> instances.
/// This API is experimental and subject to change.
/// </summary>
/// <typeparam name="TTarget">The message type this field applies to</typeparam>
/// <typeparam name="TValue">The field value type of this extension</typeparam>
Expand All @@ -69,7 +70,7 @@ public sealed class Extension<TTarget, TValue> : Extension where TTarget : IExte
/// <summary>
/// Creates a new extension identifier with the specified field number and codec
/// </summary>
public Extension(int number, FieldCodec<TValue> codec) : base(number)
public Extension(int fieldNumber, FieldCodec<TValue> codec) : base(fieldNumber)
{
this.codec = codec;
}
Expand All @@ -85,7 +86,8 @@ internal override IExtensionValue CreateValue()
}

/// <summary>
/// Represents a type-safe extension identifier used for getting repeated extension values in <see cref="IExtendableMessage{T}"/> instances
/// Represents a type-safe extension identifier used for getting repeated extension values in <see cref="IExtendableMessage{T}"/> instances.
/// This API is experimental and subject to change.
/// </summary>
/// <typeparam name="TTarget">The message type this field applies to</typeparam>
/// <typeparam name="TValue">The repeated field value type of this extension</typeparam>
Expand All @@ -96,7 +98,7 @@ public sealed class RepeatedExtension<TTarget, TValue> : Extension where TTarget
/// <summary>
/// Creates a new repeated extension identifier with the specified field number and codec
/// </summary>
public RepeatedExtension(int number, FieldCodec<TValue> codec) : base(number)
public RepeatedExtension(int fieldNumber, FieldCodec<TValue> codec) : base(fieldNumber)
{
this.codec = codec;
}
Expand Down
32 changes: 11 additions & 21 deletions csharp/src/Google.Protobuf/ExtensionRegistry.cs
Expand Up @@ -38,7 +38,7 @@
namespace Google.Protobuf
{
/// <summary>
/// Provides extensions to messages while parsing
/// Provides extensions to messages while parsing. This API is experimental and subject to change.
/// </summary>
public sealed class ExtensionRegistry : ICollection<Extension>, IDeepCloneable<ExtensionRegistry>
{
Expand Down Expand Up @@ -67,9 +67,9 @@ private ExtensionRegistry(IDictionary<ObjectIntPair<Type>, Extension> collection
/// </summary>
bool ICollection<Extension>.IsReadOnly => false;

internal bool ContainsInputField(CodedInputStream stream, Type target, out Extension extension)
{
return extensions.TryGetValue(new ObjectIntPair<Type>(target, WireFormat.GetTagFieldNumber(stream.LastTag)), out extension);
internal bool ContainsInputField(CodedInputStream stream, Type target, out Extension extension)
{
return extensions.TryGetValue(new ObjectIntPair<Type>(target, WireFormat.GetTagFieldNumber(stream.LastTag)), out extension);
}

/// <summary>
Expand All @@ -82,24 +82,14 @@ public void Add(Extension extension)
extensions.Add(new ObjectIntPair<Type>(extension.TargetType, extension.FieldNumber), extension);
}

/// <summary>
/// Adds the specified extensions to the registry
/// </summary>
public void Add(params Extension[] newExtensions)
{
ProtoPreconditions.CheckNotNull(newExtensions, nameof(newExtensions));

Add((IEnumerable<Extension>)newExtensions);
}

/// <summary>
/// Adds the specified extensions to the reigstry
/// </summary>
public void Add(IEnumerable<Extension> newExtensions)
public void AddRange(IEnumerable<Extension> extensions)
{
ProtoPreconditions.CheckNotNull(newExtensions, nameof(newExtensions));
ProtoPreconditions.CheckNotNull(extensions, nameof(extensions));

foreach (var extension in newExtensions)
foreach (var extension in extensions)
Add(extension);
}

Expand Down Expand Up @@ -134,10 +124,10 @@ void ICollection<Extension>.CopyTo(Extension[] array, int arrayIndex)
if (array.Length - arrayIndex < Count)
throw new ArgumentException("The provided array is shorter than the number of elements in the registry");

for (int i = 0; i < array.Length; i++)
{
Extension extension = array[i];
extensions.Add(new ObjectIntPair<Type>(extension.TargetType, extension.FieldNumber), extension);
for (int i = 0; i < array.Length; i++)
{
Extension extension = array[i];
extensions.Add(new ObjectIntPair<Type>(extension.TargetType, extension.FieldNumber), extension);
}
}

Expand Down
19 changes: 6 additions & 13 deletions csharp/src/Google.Protobuf/ExtensionSet.cs
Expand Up @@ -40,11 +40,11 @@ namespace Google.Protobuf
/// <summary>
/// Methods for managing <see cref="ExtensionSet{TTarget}"/>s with null checking.
///
/// Most users will not use this class directly
/// Most users will not use this class directly and its API is experimental and subject to change.
/// </summary>
public static class ExtensionSet
{
private static bool GetValue<TTarget>(ref ExtensionSet<TTarget> set, Extension extension, out IExtensionValue value) where TTarget : IExtendableMessage<TTarget>
private static bool TryGetValue<TTarget>(ref ExtensionSet<TTarget> set, Extension extension, out IExtensionValue value) where TTarget : IExtendableMessage<TTarget>
{
if (set == null)
{
Expand All @@ -60,7 +60,7 @@ public static class ExtensionSet
public static TValue Get<TTarget, TValue>(ref ExtensionSet<TTarget> set, Extension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>
{
IExtensionValue value;
if (GetValue(ref set, extension, out value))
if (TryGetValue(ref set, extension, out value))
{
return ((ExtensionValue<TValue>)value).GetValue();
}
Expand All @@ -76,7 +76,7 @@ public static class ExtensionSet
public static RepeatedField<TValue> Get<TTarget, TValue>(ref ExtensionSet<TTarget> set, RepeatedExtension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>
{
IExtensionValue value;
if (GetValue(ref set, extension, out value))
if (TryGetValue(ref set, extension, out value))
{
return ((RepeatedExtensionValue<TValue>)value).GetValue();
}
Expand Down Expand Up @@ -111,7 +111,7 @@ public static class ExtensionSet
}

/// <summary>
/// Sets the value of the specified extension
/// Sets the value of the specified extension. This will make a new instance of ExtensionSet if the set is null.
/// </summary>
public static void Set<TTarget, TValue>(ref ExtensionSet<TTarget> set, Extension<TTarget, TValue> extension, TValue value) where TTarget : IExtendableMessage<TTarget>
{
Expand Down Expand Up @@ -140,14 +140,7 @@ public static class ExtensionSet
public static bool Has<TTarget, TValue>(ref ExtensionSet<TTarget> set, Extension<TTarget, TValue> extension) where TTarget : IExtendableMessage<TTarget>
{
IExtensionValue value;
if (GetValue(ref set, extension, out value))
{
return ((ExtensionValue<TValue>)value).HasValue;
}
else
{
return false;
}
return TryGetValue(ref set, extension, out value);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Google.Protobuf/Google.Protobuf.csproj
Expand Up @@ -4,7 +4,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.9.0-rc1</VersionPrefix>
<VersionPrefix>3.9.1</VersionPrefix>
<LangVersion>6</LangVersion>
<Authors>Google Inc.</Authors>
<TargetFrameworks>netstandard1.0;netstandard2.0;net45</TargetFrameworks>
Expand Down
2 changes: 1 addition & 1 deletion csharp/src/Google.Protobuf/Reflection/FileDescriptor.cs
Expand Up @@ -407,7 +407,7 @@ private void CrossLink()

private static void AddAllExtensions(FileDescriptor[] dependencies, GeneratedClrTypeInfo generatedInfo, ExtensionRegistry registry)
{
registry.Add(dependencies.SelectMany(GetAllDependedExtensions).Concat(GetAllGeneratedExtensions(generatedInfo)).ToArray());
registry.AddRange(dependencies.SelectMany(GetAllDependedExtensions).Concat(GetAllGeneratedExtensions(generatedInfo)).ToArray());
}

private static IEnumerable<Extension> GetAllGeneratedExtensions(GeneratedClrTypeInfo generated)
Expand Down
2 changes: 1 addition & 1 deletion java/bom/pom.xml
Expand Up @@ -4,7 +4,7 @@

<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-bom</artifactId>
<version>3.9.0-rc-1</version>
<version>3.9.1</version>
<packaging>pom</packaging>

<name>Protocol Buffers [BOM]</name>
Expand Down
2 changes: 1 addition & 1 deletion java/core/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.9.0-rc-1</version>
<version>3.9.1</version>
</parent>

<artifactId>protobuf-java</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion java/lite/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.9.0-rc-1</version>
<version>3.9.1</version>
</parent>

<artifactId>protobuf-javalite</artifactId>
Expand Down
10 changes: 8 additions & 2 deletions java/pom.xml
Expand Up @@ -4,7 +4,7 @@

<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.9.0-rc-1</version>
<version>3.9.1</version>
<packaging>pom</packaging>

<name>Protocol Buffers [Parent]</name>
Expand Down Expand Up @@ -142,6 +142,9 @@
<goals>
<goal>jar</goal>
</goals>
<configuration>
<failOnError>false</failOnError>
</configuration>
</execution>
</executions>
</plugin>
Expand Down Expand Up @@ -188,13 +191,16 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<version>2.10.3</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<failOnError>false</failOnError>
</configuration>
</execution>
</executions>
</plugin>
Expand Down
2 changes: 1 addition & 1 deletion java/util/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-parent</artifactId>
<version>3.9.0-rc-1</version>
<version>3.9.1</version>
</parent>

<artifactId>protobuf-java-util</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion js/package.json
@@ -1,6 +1,6 @@
{
"name": "google-protobuf",
"version": "3.9.0-rc.1",
"version": "3.9.1",
"description": "Protocol Buffers for JavaScript",
"main": "google-protobuf.js",
"files": [
Expand Down
3 changes: 3 additions & 0 deletions php/ext/google/protobuf/message.c
Expand Up @@ -471,11 +471,14 @@ void Message_construct(zval* msg, zval* array_wrapper) {
if (upb_fielddef_containingoneof(field)) {
void* memory = slot_memory(intern->descriptor->layout,
message_data(intern), field);
uint32_t* oneof_case = slot_oneof_case(intern->descriptor->layout,
message_data(intern), field);
int property_cache_index =
intern->descriptor->layout->fields[upb_fielddef_index(field)]
.cache_index;
cached = OBJ_PROP(Z_OBJ_P(msg), property_cache_index);
*(CACHED_VALUE**)(memory) = cached;
*oneof_case = upb_fielddef_number(field);
} else {
zend_property_info* property_info;
PHP_PROTO_FAKE_SCOPE_BEGIN(Z_OBJCE_P(msg));
Expand Down

0 comments on commit 4315677

Please sign in to comment.