Skip to content

Commit

Permalink
down-integrate internal changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TeBoring committed May 22, 2015
1 parent 5609502 commit 5db2173
Show file tree
Hide file tree
Showing 227 changed files with 25,713 additions and 3,789 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ src/.libs

.dirstamp

any_test.pb.*
map*unittest.pb.*
unittest*.pb.*
cpp_test*.pb.*
Expand Down
6 changes: 6 additions & 0 deletions Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,20 @@ COMPILER_SRC_FILES := \
src/google/protobuf/compiler/cpp/cpp_string_field.cc \
src/google/protobuf/compiler/java/java_enum.cc \
src/google/protobuf/compiler/java/java_enum_field.cc \
src/google/protobuf/compiler/java/java_enum_field_lite.cc \
src/google/protobuf/compiler/java/java_extension.cc \
src/google/protobuf/compiler/java/java_field.cc \
src/google/protobuf/compiler/java/java_file.cc \
src/google/protobuf/compiler/java/java_generator.cc \
src/google/protobuf/compiler/java/java_helpers.cc \
src/google/protobuf/compiler/java/java_message.cc \
src/google/protobuf/compiler/java/java_message_lite.cc \
src/google/protobuf/compiler/java/java_message_builder.cc \
src/google/protobuf/compiler/java/java_message_builder_lite.cc \
src/google/protobuf/compiler/java/java_message_field.cc \
src/google/protobuf/compiler/java/java_message_field_lite.cc \
src/google/protobuf/compiler/java/java_primitive_field.cc \
src/google/protobuf/compiler/java/java_primitive_field_lite.cc \
src/google/protobuf/compiler/java/java_service.cc \
src/google/protobuf/compiler/javamicro/javamicro_enum.cc \
src/google/protobuf/compiler/javamicro/javamicro_enum_field.cc \
Expand Down
14 changes: 14 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -43,28 +43,34 @@ java_EXTRA_DIST= \
java/src/main/java/com/google/protobuf/AbstractMessage.java \
java/src/main/java/com/google/protobuf/AbstractMessageLite.java \
java/src/main/java/com/google/protobuf/AbstractParser.java \
java/src/main/java/com/google/protobuf/AbstractProtobufList.java \
java/src/main/java/com/google/protobuf/BlockingRpcChannel.java \
java/src/main/java/com/google/protobuf/BlockingService.java \
java/src/main/java/com/google/protobuf/BoundedByteString.java \
java/src/main/java/com/google/protobuf/BooleanArrayList.java \
java/src/main/java/com/google/protobuf/ByteString.java \
java/src/main/java/com/google/protobuf/CodedInputStream.java \
java/src/main/java/com/google/protobuf/CodedOutputStream.java \
java/src/main/java/com/google/protobuf/Descriptors.java \
java/src/main/java/com/google/protobuf/DoubleArrayList.java \
java/src/main/java/com/google/protobuf/DynamicMessage.java \
java/src/main/java/com/google/protobuf/Extension.java \
java/src/main/java/com/google/protobuf/ExtensionLite.java \
java/src/main/java/com/google/protobuf/ExtensionRegistry.java \
java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java \
java/src/main/java/com/google/protobuf/FieldSet.java \
java/src/main/java/com/google/protobuf/FloatArrayList.java \
java/src/main/java/com/google/protobuf/GeneratedMessage.java \
java/src/main/java/com/google/protobuf/GeneratedMessageLite.java \
java/src/main/java/com/google/protobuf/Internal.java \
java/src/main/java/com/google/protobuf/IntArrayList.java \
java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java \
java/src/main/java/com/google/protobuf/LazyField.java \
java/src/main/java/com/google/protobuf/LazyFieldLite.java \
java/src/main/java/com/google/protobuf/LazyStringArrayList.java \
java/src/main/java/com/google/protobuf/LazyStringList.java \
java/src/main/java/com/google/protobuf/LiteralByteString.java \
java/src/main/java/com/google/protobuf/LongArrayList.java \
java/src/main/java/com/google/protobuf/MapEntry.java \
java/src/main/java/com/google/protobuf/MapEntryLite.java \
java/src/main/java/com/google/protobuf/MapField.java \
Expand All @@ -74,7 +80,9 @@ java_EXTRA_DIST= \
java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java \
java/src/main/java/com/google/protobuf/MessageOrBuilder.java \
java/src/main/java/com/google/protobuf/MessageReflection.java \
java/src/main/java/com/google/protobuf/MutabilityOracle.java \
java/src/main/java/com/google/protobuf/Parser.java \
java/src/main/java/com/google/protobuf/ProtobufArrayList.java \
java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java \
java/src/main/java/com/google/protobuf/ProtocolStringList.java \
java/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java \
Expand All @@ -96,16 +104,20 @@ java_EXTRA_DIST= \
java/src/main/java/com/google/protobuf/WireFormat.java \
java/src/test/java/com/google/protobuf/AbstractMessageTest.java \
java/src/test/java/com/google/protobuf/BoundedByteStringTest.java \
java/src/test/java/com/google/protobuf/BooleanArrayListTest.java \
java/src/test/java/com/google/protobuf/ByteStringTest.java \
java/src/test/java/com/google/protobuf/CheckUtf8Test.java \
java/src/test/java/com/google/protobuf/CodedInputStreamTest.java \
java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java \
java/src/test/java/com/google/protobuf/DeprecatedFieldTest.java \
java/src/test/java/com/google/protobuf/DescriptorsTest.java \
java/src/test/java/com/google/protobuf/DoubleArrayListTest.java \
java/src/test/java/com/google/protobuf/DynamicMessageTest.java \
java/src/test/java/com/google/protobuf/FieldPresenceTest.java \
java/src/test/java/com/google/protobuf/FloatArrayListTest.java \
java/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java \
java/src/test/java/com/google/protobuf/GeneratedMessageTest.java \
java/src/test/java/com/google/protobuf/IntArrayListTest.java \
java/src/test/java/com/google/protobuf/IsValidUtf8Test.java \
java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java \
java/src/test/java/com/google/protobuf/LazyFieldLiteTest.java \
Expand All @@ -116,12 +128,14 @@ java_EXTRA_DIST= \
java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java \
java/src/test/java/com/google/protobuf/LiteralByteStringTest.java \
java/src/test/java/com/google/protobuf/LiteTest.java \
java/src/test/java/com/google/protobuf/LongArrayListTest.java \
java/src/test/java/com/google/protobuf/MapForProto2LiteTest.java \
java/src/test/java/com/google/protobuf/MapForProto2Test.java \
java/src/test/java/com/google/protobuf/MapTest.java \
java/src/test/java/com/google/protobuf/MessageTest.java \
java/src/test/java/com/google/protobuf/NestedBuildersTest.java \
java/src/test/java/com/google/protobuf/ParserTest.java \
java/src/test/java/com/google/protobuf/ProtobufArrayListTest.java \
java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java \
java/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java \
java/src/test/java/com/google/protobuf/RopeByteStringTest.java \
Expand Down
68 changes: 30 additions & 38 deletions conformance/conformance.proto
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ message ConformanceRequest {
}

// Which format should the testee serialize its message to?
optional RequestedOutput requested_output = 3;
RequestedOutput requested_output = 3;
}

// Represents a single test case's output.
Expand Down Expand Up @@ -103,8 +103,8 @@ message ConformanceResponse {
// forms.
message TestAllTypes {
message NestedMessage {
optional int32 a = 1;
optional TestAllTypes corecursive = 2;
int32 a = 1;
TestAllTypes corecursive = 2;
}

enum NestedEnum {
Expand All @@ -115,36 +115,32 @@ message TestAllTypes {
}

// Singular
optional int32 optional_int32 = 1;
optional int64 optional_int64 = 2;
optional uint32 optional_uint32 = 3;
optional uint64 optional_uint64 = 4;
optional sint32 optional_sint32 = 5;
optional sint64 optional_sint64 = 6;
optional fixed32 optional_fixed32 = 7;
optional fixed64 optional_fixed64 = 8;
optional sfixed32 optional_sfixed32 = 9;
optional sfixed64 optional_sfixed64 = 10;
optional float optional_float = 11;
optional double optional_double = 12;
optional bool optional_bool = 13;
optional string optional_string = 14;
optional bytes optional_bytes = 15;

optional group OptionalGroup = 16 {
optional int32 a = 17;
}

optional NestedMessage optional_nested_message = 18;
optional ForeignMessage optional_foreign_message = 19;

optional NestedEnum optional_nested_enum = 21;
optional ForeignEnum optional_foreign_enum = 22;

optional string optional_string_piece = 24 [ctype=STRING_PIECE];
optional string optional_cord = 25 [ctype=CORD];

optional TestAllTypes recursive_message = 27;
int32 optional_int32 = 1;
int64 optional_int64 = 2;
uint32 optional_uint32 = 3;
uint64 optional_uint64 = 4;
sint32 optional_sint32 = 5;
sint64 optional_sint64 = 6;
fixed32 optional_fixed32 = 7;
fixed64 optional_fixed64 = 8;
sfixed32 optional_sfixed32 = 9;
sfixed64 optional_sfixed64 = 10;
float optional_float = 11;
double optional_double = 12;
bool optional_bool = 13;
string optional_string = 14;
bytes optional_bytes = 15;

NestedMessage optional_nested_message = 18;
ForeignMessage optional_foreign_message = 19;

NestedEnum optional_nested_enum = 21;
ForeignEnum optional_foreign_enum = 22;

string optional_string_piece = 24 [ctype=STRING_PIECE];
string optional_cord = 25 [ctype=CORD];

TestAllTypes recursive_message = 27;

// Repeated
repeated int32 repeated_int32 = 31;
Expand All @@ -163,10 +159,6 @@ message TestAllTypes {
repeated string repeated_string = 44;
repeated bytes repeated_bytes = 45;

repeated group RepeatedGroup = 46 {
optional int32 a = 47;
}

repeated NestedMessage repeated_nested_message = 48;
repeated ForeignMessage repeated_foreign_message = 49;

Expand Down Expand Up @@ -206,7 +198,7 @@ message TestAllTypes {
}

message ForeignMessage {
optional int32 c = 1;
int32 c = 1;
}

enum ForeignEnum {
Expand Down
1 change: 1 addition & 0 deletions conformance/conformance_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ void ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
failures_ = 0;

for (int i = 1; i <= FieldDescriptor::MAX_TYPE; i++) {
if (i == FieldDescriptor::TYPE_GROUP) continue;
TestPrematureEOFForType(static_cast<WireFormatLite::FieldType>(i));
}

Expand Down
2 changes: 1 addition & 1 deletion editors/proto.vim
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ syn keyword pbSyntax syntax import option
syn keyword pbStructure package message group oneof
syn keyword pbRepeat optional required repeated
syn keyword pbDefault default
syn keyword pbExtend extend extensions to max
syn keyword pbExtend extend extensions to max reserved
syn keyword pbRPC service rpc returns

syn keyword pbType int32 int64 uint32 uint64 sint32 sint64
Expand Down
2 changes: 1 addition & 1 deletion editors/protobuf-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@
;; cc-mode. So, we approximate as best we can.

(c-lang-defconst c-type-list-kwds
protobuf '("extensions" "to"))
protobuf '("extensions" "to" "reserved"))

(c-lang-defconst c-typeless-decl-kwds
protobuf '("extend" "rpc" "option" "returns"))
Expand Down
5 changes: 5 additions & 0 deletions generate_descriptor_proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ declare -a RUNTIME_PROTO_FILES=(\
google/protobuf/wrappers.proto)

CORE_PROTO_IS_CORRECT=0
PROCESS_ROUND=1
echo "Updating descriptor protos..."
while [ $CORE_PROTO_IS_CORRECT -ne 1 ]
do
echo "Round $PROCESS_ROUND"
CORE_PROTO_IS_CORRECT=1
for PROTO_FILE in ${RUNTIME_PROTO_FILES[@]}; do
BASE_NAME=${PROTO_FILE%.*}
Expand Down Expand Up @@ -86,5 +89,7 @@ do
done
rm google/protobuf/compiler/plugin.pb.h.tmp
rm google/protobuf/compiler/plugin.pb.cc.tmp

PROCESS_ROUND=$((PROCESS_ROUND + 1))
done
cd ..
15 changes: 15 additions & 0 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
<arg value="src/test/java/com/google/protobuf/map_for_proto2_lite_test.proto" />
<arg value="src/test/java/com/google/protobuf/map_for_proto2_test.proto" />
<arg value="src/test/java/com/google/protobuf/map_test.proto" />
<arg value="src/test/java/com/google/protobuf/map_initialization_order_test.proto" />
</exec>
</tasks>
<testSourceRoot>target/generated-test-sources</testSourceRoot>
Expand Down Expand Up @@ -227,25 +228,33 @@
<includes>
<include>**/AbstractMessageLite.java</include>
<include>**/AbstractParser.java</include>
<include>**/AbstractProtobufList.java</include>
<include>**/BoundedByteString.java</include>
<include>**/BooleanArrayList.java</include>
<include>**/ByteString.java</include>
<include>**/CodedInputStream.java</include>
<include>**/CodedOutputStream.java</include>
<include>**/DoublerrayList.java</include>
<include>**/ExtensionLite.java</include>
<include>**/ExtensionRegistryLite.java</include>
<include>**/FieldSet.java</include>
<include>**/FloatArrayList.java</include>
<include>**/GeneratedMessageLite.java</include>
<include>**/IntArrayList.java</include>
<include>**/Internal.java</include>
<include>**/InvalidProtocolBufferException.java</include>
<include>**/LazyFieldLite.java</include>
<include>**/LazyStringArrayList.java</include>
<include>**/LazyStringList.java</include>
<include>**/LiteralByteString.java</include>
<include>**/LongArrayList.java</include>
<include>**/MapEntryLite.java</include>
<include>**/MapFieldLite.java</include>
<include>**/MessageLite.java</include>
<include>**/MessageLiteOrBuilder.java</include>
<include>**/MutabilityOracle.java</include>
<include>**/Parser.java</include>
<include>**/ProtobufArrayList.java</include>
<include>**/ProtocolStringList.java</include>
<include>**/RopeByteString.java</include>
<include>**/SmallSortedMap.java</include>
Expand All @@ -257,8 +266,14 @@
</includes>
<testIncludes>
<testInclude>**/*Lite.java</testInclude>
<testInclude>**/BooleanArrayListTest.java</testInclude>
<testInclude>**/DoubleArrayListTest.java</testInclude>
<testInclude>**/FloatArrayListTest.java</testInclude>
<testInclude>**/IntArrayListTest.java</testInclude>
<testInclude>**/LazyMessageLiteTest.java</testInclude>
<testInclude>**/LiteTest.java</testInclude>
<testInclude>**/LongArrayListTest.java</testInclude>
<testInclude>**/ProtobufArrayListTest.java</testInclude>
<testInclude>**/UnknownFieldSetLiteTest.java</testInclude>
</testIncludes>
</configuration>
Expand Down
16 changes: 12 additions & 4 deletions java/src/main/java/com/google/protobuf/AbstractMessageLite.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
package com.google.protobuf;

import java.io.FilterInputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collection;

Expand Down Expand Up @@ -109,6 +109,11 @@ protected static void checkByteStringIsUtf8(ByteString byteString)
}
}

protected static <T> void addAll(final Iterable<T> values,
final Collection<? super T> list) {
Builder.addAll(values, list);
}

/**
* A partial implementation of the {@link Message.Builder} interface which
* implements as many methods of that interface as possible in terms of
Expand Down Expand Up @@ -320,12 +325,15 @@ public boolean mergeDelimitedFrom(final InputStream input)
* Adds the {@code values} to the {@code list}. This is a helper method
* used by generated code. Users should ignore it.
*
* @throws NullPointerException if any of the elements of {@code values} is
* null. When that happens, some elements of {@code values} may have already
* been added to the result {@code list}.
* @throws NullPointerException if {@code values} or any of the elements of
* {@code values} is null. When that happens, some elements of
* {@code values} may have already been added to the result {@code list}.
*/
protected static <T> void addAll(final Iterable<T> values,
final Collection<? super T> list) {
if (values == null) {
throw new NullPointerException();
}
if (values instanceof LazyStringList) {
// For StringOrByteStringLists, check the underlying elements to avoid
// forcing conversions of ByteStrings to Strings.
Expand Down
Loading

0 comments on commit 5db2173

Please sign in to comment.