瀏覽代碼

Merge pull request #1542 from google/beta-3

Merge Beta 3 release branch into master
Jisi Liu 9 年之前
父節點
當前提交
c8be6ee00c

+ 132 - 0
CHANGES.txt

@@ -1,3 +1,135 @@
+2016-05-16 version 3.0.0-beta-3 (C++/Java/Python/Ruby/Nano/Objective-C/C#/JavaScript)
+  General
+  * Supported Proto3 lite-runtime in C++/Java for mobile platforms.
+  * Any type now supports APIs to specify prefixes other than
+    type.googleapis.com
+  * Removed javanano_use_deprecated_package option; Nano will always has its own
+    ".nano" package.
+
+  C++ (Beta)
+  * Improved hash maps.
+      - Improved hash maps comments. In particular, please note that equal hash
+        maps will not necessarily have the same iteration order and
+        serialization.
+      - Added a new hash maps implementation that will become the default in a
+        later release.
+  * Arenas
+      - Several inlined methods in Arena were moved to out-of-line to improve
+        build performance and code size.
+      - Added SpaceAllocatedAndUsed() to report both space used and allocated
+      - Added convenient class UnsafeArenaAllocatedRepeatedPtrFieldBackInserter
+  * Any
+      - Allow custom type URL prefixes in Any packing.
+      - TextFormat now expand the Any type rather than printing bytes.
+  * Performance optimizations and various bug fixes.
+
+  Java (Beta)
+  * Introduced an ExperimentalApi annotation. Annotated APIs are experimental
+    and are subject to change in a backward incompatible way in future releases.
+  * Introduced zero-copy serialization as an ExperimentalApi
+      - Introduction of the `ByteOutput` interface. This is similar to
+        `OutputStream` but provides semantics for lazy writing (i.e. no
+        immediate copy required) of fields that are considered to be immutable.
+      - `ByteString` now supports writing to a `ByteOutput`, which will directly
+        expose the internals of the `ByteString` (i.e. `byte[]` or `ByteBuffer`)
+        to the `ByteOutput` without copying.
+      - `CodedOutputStream` now supports writing to a `ByteOutput`. `ByteString`
+        instances that are too large to fit in the internal buffer will be
+        (lazily) written to the `ByteOutput` directly.
+      - This allows applications using large `ByteString` fields to avoid
+        duplication of these fields entirely. Such an application can supply a
+        `ByteOutput` that chains together the chunks received from
+        `CodedOutputStream` before forwarding them onto the IO system.
+  * Other related changes to `CodedOutputStream`
+      - Additional use of `sun.misc.Unsafe` where possible to perform fast
+        access to `byte[]` and `ByteBuffer` values and avoiding unnecessary
+        range checking.
+      - `ByteBuffer`-backed `CodedOutputStream` now writes directly to the
+        `ByteBuffer` rather than to an intermediate array.
+  * Improved lite-runtime.
+      - Lite protos now implement deep equals/hashCode/toString
+      - Significantly improved the performance of Builder#mergeFrom() and
+        Builder#mergeDelimitedFrom()
+  * Various bug fixes and small feature enhancement.
+      - Fixed stack overflow when in hashCode() for infinite recursive oneofs.
+      - Fixed the lazy field parsing in lite to merge rather than overwrite.
+      - TextFormat now supports reporting line/column numbers on errors.
+      - Updated to add appropriate @Override for better compiler errors.
+
+  Python (Beta)
+  * Added JSON format for Any, Struct, Value and ListValue
+  * [ ] is now accepted for both repeated scalar fields and repeated message
+    fields in text format parser.
+  * Numerical field name is now supported in text format.
+  * Added DiscardUnknownFields API for python protobuf message.
+
+  Objective-C (Beta)
+  * Proto comments now come over as HeaderDoc comments in the generated sources
+    so Xcode can pick them up and display them.
+  * The library headers have been updated to use HeaderDoc comments so Xcode can
+    pick them up and display them.
+  * The per message and per field overhead in both generated code and runtime
+    object sizes was reduced.
+  * Generated code now include deprecated annotations when the proto file
+    included them.
+
+  C# (Beta)
+  In general: some changes are breaking, which require regenerating messages.
+  Most user-written code will not be impacted *except* for the renaming of enum
+  values.
+
+  * Allow custom type URL prefixes in `Any` packing, and ignore them when
+    unpacking
+  * `protoc` is now in a separate NuGet package (Google.Protobuf.Tools)
+  * New option: `internal_access` to generate internal classes
+  * Enum values are now PascalCased, and if there's a prefix which matches the
+    name of the enum, that is removed (so an enum `COLOR` with a value
+    `COLOR_BLUE` would generate a value of just `Blue`). An option
+    (`legacy_enum_values`) is temporarily available to disable this, but the
+    option will be removed for GA.
+  * `json_name` option is now honored
+  * If group tags are encountered when parsing, they are validated more
+    thoroughly (although we don't support actual groups)
+  * NuGet dependencies are better specified
+  * Breaking: `Preconditions` is renamed to `ProtoPreconditions`
+  * Breaking: `GeneratedCodeInfo` is renamed to `GeneratedClrTypeInfo`
+  * `JsonFormatter` now allows writing to a `TextWriter`
+  * New interface, `ICustomDiagnosticMessage` to allow more compact
+    representations from `ToString`
+  * `CodedInputStream` and `CodedOutputStream` now implement `IDisposable`,
+    which simply disposes of the streams they were constructed with
+  * Map fields no longer support null values (in line with other languages)
+  * Improvements in JSON formatting and parsing
+
+  Javascript (Alpha)
+  * Better support for "bytes" fields: bytes fields can be read as either a
+    base64 string or UInt8Array (in environments where TypedArray is supported).
+  * New support for CommonJS imports.  This should make it easier to use the
+    JavaScript support in Node.js and tools like WebPack.  See js/README.md for
+    more information.
+  * Some significant internal refactoring to simplify and modularize the code.
+
+  Ruby (Alpha)
+  * JSON serialization now properly uses camelCased names, with a runtime option
+    that will preserve original names from .proto files instead.
+  * Well-known types are now included in the distribution.
+  * Release now includes binary gems for Windows, Mac, and Linux instead of just
+    source gems.
+  * Bugfix for serializing oneofs.
+
+  C++/Java Lite (Alpha)
+    A new "lite" generator parameter was introduced in the protoc for C++ and
+    Java for Proto3 syntax messages. Example usage:
+
+     ./protoc --cpp_out=lite:$OUTPUT_PATH foo.proto
+
+    The protoc will treat the current input and all the transitive dependencies
+    as LITE. The same generator parameter must be used to generate the
+    dependencies.
+
+    In Proto3 syntax files, "optimized_for=LITE_RUNTIME" is no longer supported.
+
+
 2015-12-30 version 3.0.0-beta-2 (C++/Java/Python/Ruby/Nano/Objective-C/C#/JavaScript)
 2015-12-30 version 3.0.0-beta-2 (C++/Java/Python/Ruby/Nano/Objective-C/C#/JavaScript)
   General
   General
   * Introduced a new language implementation: JavaScript.
   * Introduced a new language implementation: JavaScript.

+ 1 - 1
configure.ac

@@ -12,7 +12,7 @@ AC_PREREQ(2.59)
 # In the SVN trunk, the version should always be the next anticipated release
 # In the SVN trunk, the version should always be the next anticipated release
 # version with the "-pre" suffix.  (We used to use "-SNAPSHOT" but this pushed
 # version with the "-pre" suffix.  (We used to use "-SNAPSHOT" but this pushed
 # the size of one file name in the dist tarfile over the 99-char limit.)
 # the size of one file name in the dist tarfile over the 99-char limit.)
-AC_INIT([Protocol Buffers],[3.0.0-beta-2],[protobuf@googlegroups.com],[protobuf])
+AC_INIT([Protocol Buffers],[3.0.0-beta-3],[protobuf@googlegroups.com],[protobuf])
 
 
 AM_MAINTAINER_MODE([enable])
 AM_MAINTAINER_MODE([enable])
 
 

+ 2 - 2
csharp/Google.Protobuf.Tools.nuspec

@@ -5,7 +5,7 @@
     <title>Google Protocol Buffers tools</title>
     <title>Google Protocol Buffers tools</title>
     <summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
     <summary>Tools for Protocol Buffers - Google's data interchange format.</summary>
     <description>See project site for more info.</description>
     <description>See project site for more info.</description>
-    <version>3.0.0-beta2</version>
+    <version>3.0.0-beta3</version>
     <authors>Google Inc.</authors>
     <authors>Google Inc.</authors>
     <owners>protobuf-packages</owners>
     <owners>protobuf-packages</owners>
     <licenseUrl>https://github.com/google/protobuf/blob/master/LICENSE</licenseUrl>
     <licenseUrl>https://github.com/google/protobuf/blob/master/LICENSE</licenseUrl>
@@ -34,4 +34,4 @@
     <file src="..\src\google\protobuf\type.proto" target="tools\google\protobuf" />
     <file src="..\src\google\protobuf\type.proto" target="tools\google\protobuf" />
     <file src="..\src\google\protobuf\wrappers.proto" target="tools\google\protobuf" />
     <file src="..\src\google\protobuf\wrappers.proto" target="tools\google\protobuf" />
   </files>
   </files>
-</package>
+</package>

+ 2 - 2
csharp/src/Google.Protobuf/Google.Protobuf.nuspec

@@ -5,7 +5,7 @@
     <title>Google Protocol Buffers C#</title>
     <title>Google Protocol Buffers C#</title>
     <summary>C# runtime library for Protocol Buffers - Google's data interchange format.</summary>
     <summary>C# runtime library for Protocol Buffers - Google's data interchange format.</summary>
     <description>See project site for more info.</description>
     <description>See project site for more info.</description>
-    <version>3.0.0-beta2</version>
+    <version>3.0.0-beta3</version>
     <authors>Google Inc.</authors>
     <authors>Google Inc.</authors>
     <owners>protobuf-packages</owners>
     <owners>protobuf-packages</owners>
     <licenseUrl>https://github.com/google/protobuf/blob/master/LICENSE</licenseUrl>
     <licenseUrl>https://github.com/google/protobuf/blob/master/LICENSE</licenseUrl>
@@ -51,4 +51,4 @@
     <file src="bin/ReleaseSigned/Google.Protobuf.xml" target="lib/dotnet" />
     <file src="bin/ReleaseSigned/Google.Protobuf.xml" target="lib/dotnet" />
     <file src="**\*.cs" target="src" />
     <file src="**\*.cs" target="src" />
   </files>
   </files>
-</package>
+</package>

+ 1 - 1
csharp/src/Google.Protobuf/Properties/AssemblyInfo.cs

@@ -64,4 +64,4 @@ using System.Security;
 
 
 [assembly: AssemblyVersion("3.0.0.0")]
 [assembly: AssemblyVersion("3.0.0.0")]
 [assembly: AssemblyFileVersion("3.0.0.0")]
 [assembly: AssemblyFileVersion("3.0.0.0")]
-[assembly: AssemblyInformationalVersion("3.0.0-alpha4")]
+[assembly: AssemblyInformationalVersion("3.0.0-beta3")]

+ 1 - 1
java/core/pom.xml

@@ -6,7 +6,7 @@
   <parent>
   <parent>
     <groupId>com.google.protobuf</groupId>
     <groupId>com.google.protobuf</groupId>
     <artifactId>protobuf-parent</artifactId>
     <artifactId>protobuf-parent</artifactId>
-    <version>3.0.0-beta-2</version>
+    <version>3.0.0-beta-3</version>
   </parent>
   </parent>
 
 
   <artifactId>protobuf-java</artifactId>
   <artifactId>protobuf-java</artifactId>

+ 1 - 1
java/lite/pom.xml

@@ -6,7 +6,7 @@
   <parent>
   <parent>
     <groupId>com.google.protobuf</groupId>
     <groupId>com.google.protobuf</groupId>
     <artifactId>protobuf-parent</artifactId>
     <artifactId>protobuf-parent</artifactId>
-    <version>3.0.0-beta-2</version>
+    <version>3.0.0-beta-3</version>
   </parent>
   </parent>
 
 
   <artifactId>protobuf-lite</artifactId>
   <artifactId>protobuf-lite</artifactId>

+ 1 - 1
java/pom.xml

@@ -11,7 +11,7 @@
 
 
   <groupId>com.google.protobuf</groupId>
   <groupId>com.google.protobuf</groupId>
   <artifactId>protobuf-parent</artifactId>
   <artifactId>protobuf-parent</artifactId>
-  <version>3.0.0-beta-2</version>
+  <version>3.0.0-beta-3</version>
   <packaging>pom</packaging>
   <packaging>pom</packaging>
 
 
   <name>Protocol Buffers [Parent]</name>
   <name>Protocol Buffers [Parent]</name>

+ 1 - 1
java/util/pom.xml

@@ -6,7 +6,7 @@
   <parent>
   <parent>
     <groupId>com.google.protobuf</groupId>
     <groupId>com.google.protobuf</groupId>
     <artifactId>protobuf-parent</artifactId>
     <artifactId>protobuf-parent</artifactId>
-    <version>3.0.0-beta-2</version>
+    <version>3.0.0-beta-3</version>
   </parent>
   </parent>
 
 
   <artifactId>protobuf-java-util</artifactId>
   <artifactId>protobuf-java-util</artifactId>

+ 1 - 1
javanano/pom.xml

@@ -10,7 +10,7 @@
   </parent>
   </parent>
   <groupId>com.google.protobuf.nano</groupId>
   <groupId>com.google.protobuf.nano</groupId>
   <artifactId>protobuf-javanano</artifactId>
   <artifactId>protobuf-javanano</artifactId>
-  <version>3.0.0-alpha-5</version>
+  <version>3.0.0-alpha-6</version>
   <packaging>bundle</packaging>
   <packaging>bundle</packaging>
   <name>Protocol Buffer JavaNano API</name>
   <name>Protocol Buffer JavaNano API</name>
   <description>
   <description>

+ 1 - 1
js/package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "google-protobuf",
   "name": "google-protobuf",
-  "version": "3.0.0-alpha.5",
+  "version": "3.0.0-alpha.6",
   "description": "Protocol Buffers for JavaScript",
   "description": "Protocol Buffers for JavaScript",
   "main": "google-protobuf.js",
   "main": "google-protobuf.js",
   "dependencies": {
   "dependencies": {

+ 1 - 1
python/google/protobuf/__init__.py

@@ -30,7 +30,7 @@
 
 
 # Copyright 2007 Google Inc. All Rights Reserved.
 # Copyright 2007 Google Inc. All Rights Reserved.
 
 
-__version__ = '3.0.0b2.post2'
+__version__ = '3.0.0b3'
 
 
 if __name__ != '__main__':
 if __name__ != '__main__':
   try:
   try:

+ 1 - 1
ruby/google-protobuf.gemspec

@@ -1,6 +1,6 @@
 Gem::Specification.new do |s|
 Gem::Specification.new do |s|
   s.name        = "google-protobuf"
   s.name        = "google-protobuf"
-  s.version     = "3.0.0.alpha.5.0.5"
+  s.version     = "3.0.0.alpha.6.0.0"
   s.licenses    = ["BSD"]
   s.licenses    = ["BSD"]
   s.summary     = "Protocol Buffers"
   s.summary     = "Protocol Buffers"
   s.description = "Protocol Buffers are Google's data interchange format."
   s.description = "Protocol Buffers are Google's data interchange format."

+ 4 - 3
src/google/protobuf/compiler/command_line_interface_unittest.cc

@@ -65,13 +65,14 @@
 #include <gtest/gtest.h>
 #include <gtest/gtest.h>
 
 
 
 
-// Disable the whole test when we use tcmalloc for "draconian" heap checks, in
-// which case tcmalloc will print warnings that fail the plugin tests.
-#if !GOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN
 namespace google {
 namespace google {
 namespace protobuf {
 namespace protobuf {
 namespace compiler {
 namespace compiler {
 
 
+// Disable the whole test when we use tcmalloc for "draconian" heap checks, in
+// which case tcmalloc will print warnings that fail the plugin tests.
+#if !GOOGLE_PROTOBUF_HEAP_CHECK_DRACONIAN
+
 #if defined(_WIN32)
 #if defined(_WIN32)
 #ifndef STDIN_FILENO
 #ifndef STDIN_FILENO
 #define STDIN_FILENO 0
 #define STDIN_FILENO 0

+ 1 - 3
src/google/protobuf/map.h

@@ -504,9 +504,7 @@ class MapPair {
 //  assert(m0.begin()->first == m1.begin()->first);  // Bug!
 //  assert(m0.begin()->first == m1.begin()->first);  // Bug!
 //
 //
 // Map's interface is similar to std::unordered_map, except that Map is not
 // Map's interface is similar to std::unordered_map, except that Map is not
-// designed to play well with exceptions.  Mutations to a Map do not invalidate
-// a Map's iterators, pointers to elements, or references to elements.  Except
-// for erase(iterator), any non-const method can reorder iterators.
+// designed to play well with exceptions.
 template <typename Key, typename T>
 template <typename Key, typename T>
 class Map {
 class Map {
  public:
  public:

+ 55 - 3
src/google/protobuf/stubs/hash.h

@@ -108,8 +108,13 @@
 #  define GOOGLE_PROTOBUF_HAS_CXX11_HASH
 #  define GOOGLE_PROTOBUF_HAS_CXX11_HASH
 #  define GOOGLE_PROTOBUF_HASH_COMPARE std::hash_compare
 #  define GOOGLE_PROTOBUF_HASH_COMPARE std::hash_compare
 # elif _MSC_VER >= 1500  // Since Visual Studio 2008
 # elif _MSC_VER >= 1500  // Since Visual Studio 2008
-#  undef GOOGLE_PROTOBUF_HAVE_HASH_MAP
-#  undef GOOGLE_PROTOBUF_HAVE_HASH_SET
+#  define GOOGLE_PROTOBUF_HASH_NAMESPACE stdext
+#  include <hash_map>
+#  define GOOGLE_PROTOBUF_HASH_MAP_CLASS hash_map
+#  include <hash_set>
+#  define GOOGLE_PROTOBUF_HASH_SET_CLASS hash_set
+#  define GOOGLE_PROTOBUF_HASH_COMPARE stdext::hash_compare
+#  define GOOGLE_PROTOBUF_CONTAINERS_NEED_HASH_COMPARE
 # elif _MSC_VER >= 1310
 # elif _MSC_VER >= 1310
 #  define GOOGLE_PROTOBUF_HASH_NAMESPACE stdext
 #  define GOOGLE_PROTOBUF_HASH_NAMESPACE stdext
 #  include <hash_map>
 #  include <hash_map>
@@ -247,6 +252,52 @@ template <>
 struct hash<const char*>
 struct hash<const char*>
     : public GOOGLE_PROTOBUF_HASH_COMPARE<const char*, CstringLess> {};
     : public GOOGLE_PROTOBUF_HASH_COMPARE<const char*, CstringLess> {};
 
 
+#ifdef GOOGLE_PROTOBUF_CONTAINERS_NEED_HASH_COMPARE
+
+template <typename Key, typename HashFcn, typename EqualKey>
+struct InternalHashCompare : public GOOGLE_PROTOBUF_HASH_COMPARE<Key> {
+  InternalHashCompare() {}
+  InternalHashCompare(HashFcn hashfcn, EqualKey equalkey)
+      : hashfcn_(hashfcn), equalkey_(equalkey) {}
+  size_t operator()(const Key& key) const { return hashfcn_(key); }
+  bool operator()(const Key& key1, const Key& key2) const {
+    return !equalkey_(key1, key2);
+  }
+  HashFcn hashfcn_;
+  EqualKey equalkey_;
+};
+
+template <typename Key, typename Data,
+          typename HashFcn = hash<Key>,
+          typename EqualKey = std::equal_to<Key>,
+          typename Alloc = std::allocator< std::pair<const Key, Data> > >
+class hash_map
+    : public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS<
+          Key, Data, InternalHashCompare<Key, HashFcn, EqualKey>, Alloc> {
+  typedef GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_MAP_CLASS<
+      Key, Data, InternalHashCompare<Key, HashFcn, EqualKey>, Alloc> BaseClass;
+
+ public:
+  hash_map(int a = 0, const HashFcn& b = HashFcn(),
+           const EqualKey& c = EqualKey(), const Alloc& d = Alloc())
+      : BaseClass(InternalHashCompare<Key, HashFcn, EqualKey>(b, c), d) {}
+
+  HashFcn hash_function() const { return HashFcn(); }
+};
+
+template <typename Key, typename HashFcn = hash<Key>,
+          typename EqualKey = std::equal_to<Key> >
+class hash_set
+    : public GOOGLE_PROTOBUF_HASH_NAMESPACE::GOOGLE_PROTOBUF_HASH_SET_CLASS<
+          Key, InternalHashCompare<Key, HashFcn, EqualKey> > {
+ public:
+  hash_set(int = 0) {}
+
+  HashFcn hash_function() const { return HashFcn(); }
+};
+
+#else  // GOOGLE_PROTOBUF_CONTAINERS_NEED_HASH_COMPARE
+
 template <typename Key, typename Data,
 template <typename Key, typename Data,
           typename HashFcn = hash<Key>,
           typename HashFcn = hash<Key>,
           typename EqualKey = std::equal_to<Key>,
           typename EqualKey = std::equal_to<Key>,
@@ -275,8 +326,9 @@ class hash_set
 
 
   HashFcn hash_function() const { return HashFcn(); }
   HashFcn hash_function() const { return HashFcn(); }
 };
 };
+#endif  // GOOGLE_PROTOBUF_CONTAINERS_NEED_HASH_COMPARE
 
 
-#else
+#else  // defined(_MSC_VER) && !defined(_STLPORT_VERSION)
 
 
 template <typename Key>
 template <typename Key>
 struct hash : public GOOGLE_PROTOBUF_HASH_NAMESPACE::hash<Key> {
 struct hash : public GOOGLE_PROTOBUF_HASH_NAMESPACE::hash<Key> {