Skip to content

Commit 5db2173

Browse files
committed
down-integrate internal changes
1 parent 5609502 commit 5db2173

File tree

227 files changed

+25713
-3789
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

227 files changed

+25713
-3789
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ src/.libs
4444

4545
.dirstamp
4646

47+
any_test.pb.*
4748
map*unittest.pb.*
4849
unittest*.pb.*
4950
cpp_test*.pb.*

Android.mk

+6
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,20 @@ COMPILER_SRC_FILES := \
9090
src/google/protobuf/compiler/cpp/cpp_string_field.cc \
9191
src/google/protobuf/compiler/java/java_enum.cc \
9292
src/google/protobuf/compiler/java/java_enum_field.cc \
93+
src/google/protobuf/compiler/java/java_enum_field_lite.cc \
9394
src/google/protobuf/compiler/java/java_extension.cc \
9495
src/google/protobuf/compiler/java/java_field.cc \
9596
src/google/protobuf/compiler/java/java_file.cc \
9697
src/google/protobuf/compiler/java/java_generator.cc \
9798
src/google/protobuf/compiler/java/java_helpers.cc \
9899
src/google/protobuf/compiler/java/java_message.cc \
100+
src/google/protobuf/compiler/java/java_message_lite.cc \
101+
src/google/protobuf/compiler/java/java_message_builder.cc \
102+
src/google/protobuf/compiler/java/java_message_builder_lite.cc \
99103
src/google/protobuf/compiler/java/java_message_field.cc \
104+
src/google/protobuf/compiler/java/java_message_field_lite.cc \
100105
src/google/protobuf/compiler/java/java_primitive_field.cc \
106+
src/google/protobuf/compiler/java/java_primitive_field_lite.cc \
101107
src/google/protobuf/compiler/java/java_service.cc \
102108
src/google/protobuf/compiler/javamicro/javamicro_enum.cc \
103109
src/google/protobuf/compiler/javamicro/javamicro_enum_field.cc \

Makefile.am

+14
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,34 @@ java_EXTRA_DIST= \
4343
java/src/main/java/com/google/protobuf/AbstractMessage.java \
4444
java/src/main/java/com/google/protobuf/AbstractMessageLite.java \
4545
java/src/main/java/com/google/protobuf/AbstractParser.java \
46+
java/src/main/java/com/google/protobuf/AbstractProtobufList.java \
4647
java/src/main/java/com/google/protobuf/BlockingRpcChannel.java \
4748
java/src/main/java/com/google/protobuf/BlockingService.java \
4849
java/src/main/java/com/google/protobuf/BoundedByteString.java \
50+
java/src/main/java/com/google/protobuf/BooleanArrayList.java \
4951
java/src/main/java/com/google/protobuf/ByteString.java \
5052
java/src/main/java/com/google/protobuf/CodedInputStream.java \
5153
java/src/main/java/com/google/protobuf/CodedOutputStream.java \
5254
java/src/main/java/com/google/protobuf/Descriptors.java \
55+
java/src/main/java/com/google/protobuf/DoubleArrayList.java \
5356
java/src/main/java/com/google/protobuf/DynamicMessage.java \
5457
java/src/main/java/com/google/protobuf/Extension.java \
5558
java/src/main/java/com/google/protobuf/ExtensionLite.java \
5659
java/src/main/java/com/google/protobuf/ExtensionRegistry.java \
5760
java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java \
5861
java/src/main/java/com/google/protobuf/FieldSet.java \
62+
java/src/main/java/com/google/protobuf/FloatArrayList.java \
5963
java/src/main/java/com/google/protobuf/GeneratedMessage.java \
6064
java/src/main/java/com/google/protobuf/GeneratedMessageLite.java \
6165
java/src/main/java/com/google/protobuf/Internal.java \
66+
java/src/main/java/com/google/protobuf/IntArrayList.java \
6267
java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java \
6368
java/src/main/java/com/google/protobuf/LazyField.java \
6469
java/src/main/java/com/google/protobuf/LazyFieldLite.java \
6570
java/src/main/java/com/google/protobuf/LazyStringArrayList.java \
6671
java/src/main/java/com/google/protobuf/LazyStringList.java \
6772
java/src/main/java/com/google/protobuf/LiteralByteString.java \
73+
java/src/main/java/com/google/protobuf/LongArrayList.java \
6874
java/src/main/java/com/google/protobuf/MapEntry.java \
6975
java/src/main/java/com/google/protobuf/MapEntryLite.java \
7076
java/src/main/java/com/google/protobuf/MapField.java \
@@ -74,7 +80,9 @@ java_EXTRA_DIST= \
7480
java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java \
7581
java/src/main/java/com/google/protobuf/MessageOrBuilder.java \
7682
java/src/main/java/com/google/protobuf/MessageReflection.java \
83+
java/src/main/java/com/google/protobuf/MutabilityOracle.java \
7784
java/src/main/java/com/google/protobuf/Parser.java \
85+
java/src/main/java/com/google/protobuf/ProtobufArrayList.java \
7886
java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java \
7987
java/src/main/java/com/google/protobuf/ProtocolStringList.java \
8088
java/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java \
@@ -96,16 +104,20 @@ java_EXTRA_DIST= \
96104
java/src/main/java/com/google/protobuf/WireFormat.java \
97105
java/src/test/java/com/google/protobuf/AbstractMessageTest.java \
98106
java/src/test/java/com/google/protobuf/BoundedByteStringTest.java \
107+
java/src/test/java/com/google/protobuf/BooleanArrayListTest.java \
99108
java/src/test/java/com/google/protobuf/ByteStringTest.java \
100109
java/src/test/java/com/google/protobuf/CheckUtf8Test.java \
101110
java/src/test/java/com/google/protobuf/CodedInputStreamTest.java \
102111
java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java \
103112
java/src/test/java/com/google/protobuf/DeprecatedFieldTest.java \
104113
java/src/test/java/com/google/protobuf/DescriptorsTest.java \
114+
java/src/test/java/com/google/protobuf/DoubleArrayListTest.java \
105115
java/src/test/java/com/google/protobuf/DynamicMessageTest.java \
106116
java/src/test/java/com/google/protobuf/FieldPresenceTest.java \
117+
java/src/test/java/com/google/protobuf/FloatArrayListTest.java \
107118
java/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java \
108119
java/src/test/java/com/google/protobuf/GeneratedMessageTest.java \
120+
java/src/test/java/com/google/protobuf/IntArrayListTest.java \
109121
java/src/test/java/com/google/protobuf/IsValidUtf8Test.java \
110122
java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java \
111123
java/src/test/java/com/google/protobuf/LazyFieldLiteTest.java \
@@ -116,12 +128,14 @@ java_EXTRA_DIST= \
116128
java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java \
117129
java/src/test/java/com/google/protobuf/LiteralByteStringTest.java \
118130
java/src/test/java/com/google/protobuf/LiteTest.java \
131+
java/src/test/java/com/google/protobuf/LongArrayListTest.java \
119132
java/src/test/java/com/google/protobuf/MapForProto2LiteTest.java \
120133
java/src/test/java/com/google/protobuf/MapForProto2Test.java \
121134
java/src/test/java/com/google/protobuf/MapTest.java \
122135
java/src/test/java/com/google/protobuf/MessageTest.java \
123136
java/src/test/java/com/google/protobuf/NestedBuildersTest.java \
124137
java/src/test/java/com/google/protobuf/ParserTest.java \
138+
java/src/test/java/com/google/protobuf/ProtobufArrayListTest.java \
125139
java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java \
126140
java/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java \
127141
java/src/test/java/com/google/protobuf/RopeByteStringTest.java \

conformance/conformance.proto

+30-38
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ message ConformanceRequest {
7171
}
7272

7373
// Which format should the testee serialize its message to?
74-
optional RequestedOutput requested_output = 3;
74+
RequestedOutput requested_output = 3;
7575
}
7676

7777
// Represents a single test case's output.
@@ -103,8 +103,8 @@ message ConformanceResponse {
103103
// forms.
104104
message TestAllTypes {
105105
message NestedMessage {
106-
optional int32 a = 1;
107-
optional TestAllTypes corecursive = 2;
106+
int32 a = 1;
107+
TestAllTypes corecursive = 2;
108108
}
109109

110110
enum NestedEnum {
@@ -115,36 +115,32 @@ message TestAllTypes {
115115
}
116116

117117
// Singular
118-
optional int32 optional_int32 = 1;
119-
optional int64 optional_int64 = 2;
120-
optional uint32 optional_uint32 = 3;
121-
optional uint64 optional_uint64 = 4;
122-
optional sint32 optional_sint32 = 5;
123-
optional sint64 optional_sint64 = 6;
124-
optional fixed32 optional_fixed32 = 7;
125-
optional fixed64 optional_fixed64 = 8;
126-
optional sfixed32 optional_sfixed32 = 9;
127-
optional sfixed64 optional_sfixed64 = 10;
128-
optional float optional_float = 11;
129-
optional double optional_double = 12;
130-
optional bool optional_bool = 13;
131-
optional string optional_string = 14;
132-
optional bytes optional_bytes = 15;
133-
134-
optional group OptionalGroup = 16 {
135-
optional int32 a = 17;
136-
}
137-
138-
optional NestedMessage optional_nested_message = 18;
139-
optional ForeignMessage optional_foreign_message = 19;
140-
141-
optional NestedEnum optional_nested_enum = 21;
142-
optional ForeignEnum optional_foreign_enum = 22;
143-
144-
optional string optional_string_piece = 24 [ctype=STRING_PIECE];
145-
optional string optional_cord = 25 [ctype=CORD];
146-
147-
optional TestAllTypes recursive_message = 27;
118+
int32 optional_int32 = 1;
119+
int64 optional_int64 = 2;
120+
uint32 optional_uint32 = 3;
121+
uint64 optional_uint64 = 4;
122+
sint32 optional_sint32 = 5;
123+
sint64 optional_sint64 = 6;
124+
fixed32 optional_fixed32 = 7;
125+
fixed64 optional_fixed64 = 8;
126+
sfixed32 optional_sfixed32 = 9;
127+
sfixed64 optional_sfixed64 = 10;
128+
float optional_float = 11;
129+
double optional_double = 12;
130+
bool optional_bool = 13;
131+
string optional_string = 14;
132+
bytes optional_bytes = 15;
133+
134+
NestedMessage optional_nested_message = 18;
135+
ForeignMessage optional_foreign_message = 19;
136+
137+
NestedEnum optional_nested_enum = 21;
138+
ForeignEnum optional_foreign_enum = 22;
139+
140+
string optional_string_piece = 24 [ctype=STRING_PIECE];
141+
string optional_cord = 25 [ctype=CORD];
142+
143+
TestAllTypes recursive_message = 27;
148144

149145
// Repeated
150146
repeated int32 repeated_int32 = 31;
@@ -163,10 +159,6 @@ message TestAllTypes {
163159
repeated string repeated_string = 44;
164160
repeated bytes repeated_bytes = 45;
165161

166-
repeated group RepeatedGroup = 46 {
167-
optional int32 a = 47;
168-
}
169-
170162
repeated NestedMessage repeated_nested_message = 48;
171163
repeated ForeignMessage repeated_foreign_message = 49;
172164

@@ -206,7 +198,7 @@ message TestAllTypes {
206198
}
207199

208200
message ForeignMessage {
209-
optional int32 c = 1;
201+
int32 c = 1;
210202
}
211203

212204
enum ForeignEnum {

conformance/conformance_test.cc

+1
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ void ConformanceTestSuite::RunSuite(ConformanceTestRunner* runner,
295295
failures_ = 0;
296296

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

editors/proto.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ syn keyword pbSyntax syntax import option
5757
syn keyword pbStructure package message group oneof
5858
syn keyword pbRepeat optional required repeated
5959
syn keyword pbDefault default
60-
syn keyword pbExtend extend extensions to max
60+
syn keyword pbExtend extend extensions to max reserved
6161
syn keyword pbRPC service rpc returns
6262

6363
syn keyword pbType int32 int64 uint32 uint64 sint32 sint64

editors/protobuf-mode.el

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@
106106
;; cc-mode. So, we approximate as best we can.
107107

108108
(c-lang-defconst c-type-list-kwds
109-
protobuf '("extensions" "to"))
109+
protobuf '("extensions" "to" "reserved"))
110110

111111
(c-lang-defconst c-typeless-decl-kwds
112112
protobuf '("extend" "rpc" "option" "returns"))

generate_descriptor_proto.sh

+5
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,11 @@ declare -a RUNTIME_PROTO_FILES=(\
4343
google/protobuf/wrappers.proto)
4444

4545
CORE_PROTO_IS_CORRECT=0
46+
PROCESS_ROUND=1
47+
echo "Updating descriptor protos..."
4648
while [ $CORE_PROTO_IS_CORRECT -ne 1 ]
4749
do
50+
echo "Round $PROCESS_ROUND"
4851
CORE_PROTO_IS_CORRECT=1
4952
for PROTO_FILE in ${RUNTIME_PROTO_FILES[@]}; do
5053
BASE_NAME=${PROTO_FILE%.*}
@@ -86,5 +89,7 @@ do
8689
done
8790
rm google/protobuf/compiler/plugin.pb.h.tmp
8891
rm google/protobuf/compiler/plugin.pb.cc.tmp
92+
93+
PROCESS_ROUND=$((PROCESS_ROUND + 1))
8994
done
9095
cd ..

java/pom.xml

+15
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@
134134
<arg value="src/test/java/com/google/protobuf/map_for_proto2_lite_test.proto" />
135135
<arg value="src/test/java/com/google/protobuf/map_for_proto2_test.proto" />
136136
<arg value="src/test/java/com/google/protobuf/map_test.proto" />
137+
<arg value="src/test/java/com/google/protobuf/map_initialization_order_test.proto" />
137138
</exec>
138139
</tasks>
139140
<testSourceRoot>target/generated-test-sources</testSourceRoot>
@@ -227,25 +228,33 @@
227228
<includes>
228229
<include>**/AbstractMessageLite.java</include>
229230
<include>**/AbstractParser.java</include>
231+
<include>**/AbstractProtobufList.java</include>
230232
<include>**/BoundedByteString.java</include>
233+
<include>**/BooleanArrayList.java</include>
231234
<include>**/ByteString.java</include>
232235
<include>**/CodedInputStream.java</include>
233236
<include>**/CodedOutputStream.java</include>
237+
<include>**/DoublerrayList.java</include>
234238
<include>**/ExtensionLite.java</include>
235239
<include>**/ExtensionRegistryLite.java</include>
236240
<include>**/FieldSet.java</include>
241+
<include>**/FloatArrayList.java</include>
237242
<include>**/GeneratedMessageLite.java</include>
243+
<include>**/IntArrayList.java</include>
238244
<include>**/Internal.java</include>
239245
<include>**/InvalidProtocolBufferException.java</include>
240246
<include>**/LazyFieldLite.java</include>
241247
<include>**/LazyStringArrayList.java</include>
242248
<include>**/LazyStringList.java</include>
243249
<include>**/LiteralByteString.java</include>
250+
<include>**/LongArrayList.java</include>
244251
<include>**/MapEntryLite.java</include>
245252
<include>**/MapFieldLite.java</include>
246253
<include>**/MessageLite.java</include>
247254
<include>**/MessageLiteOrBuilder.java</include>
255+
<include>**/MutabilityOracle.java</include>
248256
<include>**/Parser.java</include>
257+
<include>**/ProtobufArrayList.java</include>
249258
<include>**/ProtocolStringList.java</include>
250259
<include>**/RopeByteString.java</include>
251260
<include>**/SmallSortedMap.java</include>
@@ -257,8 +266,14 @@
257266
</includes>
258267
<testIncludes>
259268
<testInclude>**/*Lite.java</testInclude>
269+
<testInclude>**/BooleanArrayListTest.java</testInclude>
270+
<testInclude>**/DoubleArrayListTest.java</testInclude>
271+
<testInclude>**/FloatArrayListTest.java</testInclude>
272+
<testInclude>**/IntArrayListTest.java</testInclude>
260273
<testInclude>**/LazyMessageLiteTest.java</testInclude>
261274
<testInclude>**/LiteTest.java</testInclude>
275+
<testInclude>**/LongArrayListTest.java</testInclude>
276+
<testInclude>**/ProtobufArrayListTest.java</testInclude>
262277
<testInclude>**/UnknownFieldSetLiteTest.java</testInclude>
263278
</testIncludes>
264279
</configuration>

java/src/main/java/com/google/protobuf/AbstractMessageLite.java

+12-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
package com.google.protobuf;
3232

3333
import java.io.FilterInputStream;
34-
import java.io.InputStream;
3534
import java.io.IOException;
35+
import java.io.InputStream;
3636
import java.io.OutputStream;
3737
import java.util.Collection;
3838

@@ -109,6 +109,11 @@ protected static void checkByteStringIsUtf8(ByteString byteString)
109109
}
110110
}
111111

112+
protected static <T> void addAll(final Iterable<T> values,
113+
final Collection<? super T> list) {
114+
Builder.addAll(values, list);
115+
}
116+
112117
/**
113118
* A partial implementation of the {@link Message.Builder} interface which
114119
* implements as many methods of that interface as possible in terms of
@@ -320,12 +325,15 @@ public boolean mergeDelimitedFrom(final InputStream input)
320325
* Adds the {@code values} to the {@code list}. This is a helper method
321326
* used by generated code. Users should ignore it.
322327
*
323-
* @throws NullPointerException if any of the elements of {@code values} is
324-
* null. When that happens, some elements of {@code values} may have already
325-
* been added to the result {@code list}.
328+
* @throws NullPointerException if {@code values} or any of the elements of
329+
* {@code values} is null. When that happens, some elements of
330+
* {@code values} may have already been added to the result {@code list}.
326331
*/
327332
protected static <T> void addAll(final Iterable<T> values,
328333
final Collection<? super T> list) {
334+
if (values == null) {
335+
throw new NullPointerException();
336+
}
329337
if (values instanceof LazyStringList) {
330338
// For StringOrByteStringLists, check the underlying elements to avoid
331339
// forcing conversions of ByteStrings to Strings.

0 commit comments

Comments
 (0)