From cb3f428810456dbb31211ed421401b90fb3b6586 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Thu, 28 Jan 2016 13:33:04 -0800 Subject: [PATCH 1/4] Undo the Java module change for integration. Moving the files to their original location, so that opensource changes can be picked during the internal merge. Those files will be moved into the correct location after merging with internal code. Note: do NOT merge this into master without the other internal down-integration commit. --- .../src/main/java/com/google/protobuf/AbstractMessage.java | 0 .../src/main/java/com/google/protobuf/AbstractMessageLite.java | 0 .../src/main/java/com/google/protobuf/AbstractParser.java | 0 .../src/main/java/com/google/protobuf/AbstractProtobufList.java | 0 .../src/main/java/com/google/protobuf/BlockingRpcChannel.java | 0 .../src/main/java/com/google/protobuf/BlockingService.java | 0 .../src/main/java/com/google/protobuf/BooleanArrayList.java | 0 .../src/main/java/com/google/protobuf/BoundedByteString.java | 0 java/{core => }/src/main/java/com/google/protobuf/ByteString.java | 0 .../src/main/java/com/google/protobuf/CodedInputStream.java | 0 .../src/main/java/com/google/protobuf/CodedOutputStream.java | 0 .../{core => }/src/main/java/com/google/protobuf/Descriptors.java | 0 .../src/main/java/com/google/protobuf/DoubleArrayList.java | 0 .../src/main/java/com/google/protobuf/DynamicMessage.java | 0 java/{core => }/src/main/java/com/google/protobuf/Extension.java | 0 .../src/main/java/com/google/protobuf/ExtensionLite.java | 0 .../src/main/java/com/google/protobuf/ExtensionRegistry.java | 0 .../src/main/java/com/google/protobuf/ExtensionRegistryLite.java | 0 java/{core => }/src/main/java/com/google/protobuf/FieldSet.java | 0 .../src/main/java/com/google/protobuf/FloatArrayList.java | 0 .../src/main/java/com/google/protobuf/GeneratedMessage.java | 0 .../src/main/java/com/google/protobuf/GeneratedMessageLite.java | 0 .../src/main/java/com/google/protobuf/IntArrayList.java | 0 java/{core => }/src/main/java/com/google/protobuf/Internal.java | 0 .../java/com/google/protobuf/InvalidProtocolBufferException.java | 0 java/{core => }/src/main/java/com/google/protobuf/LazyField.java | 0 .../src/main/java/com/google/protobuf/LazyFieldLite.java | 0 .../src/main/java/com/google/protobuf/LazyStringArrayList.java | 0 .../src/main/java/com/google/protobuf/LazyStringList.java | 0 .../src/main/java/com/google/protobuf/LiteralByteString.java | 0 .../src/main/java/com/google/protobuf/LongArrayList.java | 0 java/{core => }/src/main/java/com/google/protobuf/MapEntry.java | 0 .../src/main/java/com/google/protobuf/MapEntryLite.java | 0 java/{core => }/src/main/java/com/google/protobuf/MapField.java | 0 .../src/main/java/com/google/protobuf/MapFieldLite.java | 0 java/{core => }/src/main/java/com/google/protobuf/Message.java | 0 .../{core => }/src/main/java/com/google/protobuf/MessageLite.java | 0 .../src/main/java/com/google/protobuf/MessageLiteOrBuilder.java | 0 .../src/main/java/com/google/protobuf/MessageLiteToString.java | 0 .../src/main/java/com/google/protobuf/MessageOrBuilder.java | 0 .../src/main/java/com/google/protobuf/MessageReflection.java | 0 .../src/main/java/com/google/protobuf/MutabilityOracle.java | 0 .../src/main/java/com/google/protobuf/NioByteString.java | 0 java/{core => }/src/main/java/com/google/protobuf/Parser.java | 0 .../src/main/java/com/google/protobuf/ProtobufArrayList.java | 0 .../src/main/java/com/google/protobuf/ProtocolMessageEnum.java | 0 .../src/main/java/com/google/protobuf/ProtocolStringList.java | 0 .../src/main/java/com/google/protobuf/RepeatedFieldBuilder.java | 0 .../src/main/java/com/google/protobuf/RopeByteString.java | 0 .../{core => }/src/main/java/com/google/protobuf/RpcCallback.java | 0 java/{core => }/src/main/java/com/google/protobuf/RpcChannel.java | 0 .../src/main/java/com/google/protobuf/RpcController.java | 0 java/{core => }/src/main/java/com/google/protobuf/RpcUtil.java | 0 java/{core => }/src/main/java/com/google/protobuf/Service.java | 0 .../src/main/java/com/google/protobuf/ServiceException.java | 0 .../src/main/java/com/google/protobuf/SingleFieldBuilder.java | 0 .../src/main/java/com/google/protobuf/SmallSortedMap.java | 0 java/{core => }/src/main/java/com/google/protobuf/TextFormat.java | 0 .../src/main/java/com/google/protobuf/TextFormatEscaper.java | 0 .../java/com/google/protobuf/UninitializedMessageException.java | 0 .../src/main/java/com/google/protobuf/UnknownFieldSet.java | 0 .../src/main/java/com/google/protobuf/UnknownFieldSetLite.java | 0 .../main/java/com/google/protobuf/UnmodifiableLazyStringList.java | 0 .../src/main/java/com/google/protobuf/UnsafeByteStrings.java | 0 java/{core => }/src/main/java/com/google/protobuf/Utf8.java | 0 java/{core => }/src/main/java/com/google/protobuf/WireFormat.java | 0 .../src/test/java/com/google/protobuf/AbstractMessageTest.java | 0 java/{core => }/src/test/java/com/google/protobuf/AnyTest.java | 0 .../src/test/java/com/google/protobuf/BooleanArrayListTest.java | 0 .../src/test/java/com/google/protobuf/BoundedByteStringTest.java | 0 .../src/test/java/com/google/protobuf/ByteStringTest.java | 0 .../src/test/java/com/google/protobuf/CheckUtf8Test.java | 0 .../src/test/java/com/google/protobuf/CodedInputStreamTest.java | 0 .../src/test/java/com/google/protobuf/CodedOutputStreamTest.java | 0 .../src/test/java/com/google/protobuf/DeprecatedFieldTest.java | 0 .../src/test/java/com/google/protobuf/DescriptorsTest.java | 0 .../src/test/java/com/google/protobuf/DoubleArrayListTest.java | 0 .../src/test/java/com/google/protobuf/DynamicMessageTest.java | 0 .../src/test/java/com/google/protobuf/FieldPresenceTest.java | 0 .../src/test/java/com/google/protobuf/FloatArrayListTest.java | 0 .../test/java/com/google/protobuf/ForceFieldBuildersPreRun.java | 0 .../src/test/java/com/google/protobuf/GeneratedMessageTest.java | 0 .../src/test/java/com/google/protobuf/IntArrayListTest.java | 0 .../src/test/java/com/google/protobuf/IsValidUtf8Test.java | 0 .../src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java | 0 .../src/test/java/com/google/protobuf/LazyFieldLiteTest.java | 0 .../src/test/java/com/google/protobuf/LazyFieldTest.java | 0 .../src/test/java/com/google/protobuf/LazyMessageLiteTest.java | 0 .../test/java/com/google/protobuf/LazyStringArrayListTest.java | 0 .../src/test/java/com/google/protobuf/LazyStringEndToEndTest.java | 0 .../src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java | 0 java/{core => }/src/test/java/com/google/protobuf/LiteTest.java | 0 .../src/test/java/com/google/protobuf/LiteralByteStringTest.java | 0 .../src/test/java/com/google/protobuf/LongArrayListTest.java | 0 .../src/test/java/com/google/protobuf/MapForProto2LiteTest.java | 0 .../src/test/java/com/google/protobuf/MapForProto2Test.java | 0 java/{core => }/src/test/java/com/google/protobuf/MapTest.java | 0 .../{core => }/src/test/java/com/google/protobuf/MessageTest.java | 0 .../src/test/java/com/google/protobuf/NestedBuildersTest.java | 0 .../src/test/java/com/google/protobuf/NioByteStringTest.java | 0 .../src/test/java/com/google/protobuf/ParseExceptionsTest.java | 0 java/{core => }/src/test/java/com/google/protobuf/ParserTest.java | 0 .../src/test/java/com/google/protobuf/ProtobufArrayListTest.java | 0 .../test/java/com/google/protobuf/RepeatedFieldBuilderTest.java | 0 .../java/com/google/protobuf/RopeByteStringSubstringTest.java | 0 .../src/test/java/com/google/protobuf/RopeByteStringTest.java | 0 .../{core => }/src/test/java/com/google/protobuf/ServiceTest.java | 0 .../src/test/java/com/google/protobuf/SingleFieldBuilderTest.java | 0 .../src/test/java/com/google/protobuf/SmallSortedMapTest.java | 0 .../src/test/java/com/google/protobuf/TestBadIdentifiers.java | 0 java/{core => }/src/test/java/com/google/protobuf/TestUtil.java | 0 .../src/test/java/com/google/protobuf/TextFormatTest.java | 0 .../src/test/java/com/google/protobuf/UnknownEnumValueTest.java | 0 .../test/java/com/google/protobuf/UnknownFieldSetLiteTest.java | 0 .../src/test/java/com/google/protobuf/UnknownFieldSetTest.java | 0 .../java/com/google/protobuf/UnmodifiableLazyStringListTest.java | 0 .../src/test/java/com/google/protobuf/WellKnownTypesTest.java | 0 .../src/test/java/com/google/protobuf/WireFormatTest.java | 0 .../proto => src/test/java}/com/google/protobuf/any_test.proto | 0 .../test/java}/com/google/protobuf/field_presence_test.proto | 0 .../test/java}/com/google/protobuf/lazy_fields_lite.proto | 0 .../test/java}/com/google/protobuf/lite_equals_and_hash.proto | 0 .../test/java}/com/google/protobuf/map_for_proto2_lite_test.proto | 0 .../test/java}/com/google/protobuf/map_for_proto2_test.proto | 0 .../java}/com/google/protobuf/map_initialization_order_test.proto | 0 .../proto => src/test/java}/com/google/protobuf/map_test.proto | 0 .../test/java}/com/google/protobuf/multiple_files_test.proto | 0 .../test/java}/com/google/protobuf/nested_builders_test.proto | 0 .../test/java}/com/google/protobuf/nested_extension.proto | 0 .../test/java}/com/google/protobuf/nested_extension_lite.proto | 0 .../test/java}/com/google/protobuf/non_nested_extension.proto | 0 .../java}/com/google/protobuf/non_nested_extension_lite.proto | 0 .../test/java}/com/google/protobuf/outer_class_name_test.proto | 0 .../test/java}/com/google/protobuf/outer_class_name_test2.proto | 0 .../test/java}/com/google/protobuf/outer_class_name_test3.proto | 0 .../test/java}/com/google/protobuf/test_bad_identifiers.proto | 0 .../test/java}/com/google/protobuf/test_check_utf8.proto | 0 .../test/java}/com/google/protobuf/test_check_utf8_size.proto | 0 .../test/java}/com/google/protobuf/test_custom_options.proto | 0 .../test/java}/com/google/protobuf/test_extra_interfaces.proto | 0 .../test/{proto => java}/com/google/protobuf/util/json_test.proto | 0 141 files changed, 0 insertions(+), 0 deletions(-) rename java/{core => }/src/main/java/com/google/protobuf/AbstractMessage.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/AbstractMessageLite.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/AbstractParser.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/AbstractProtobufList.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/BlockingRpcChannel.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/BlockingService.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/BooleanArrayList.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/BoundedByteString.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/ByteString.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/CodedInputStream.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/CodedOutputStream.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/Descriptors.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/DoubleArrayList.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/DynamicMessage.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/Extension.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/ExtensionLite.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/ExtensionRegistry.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/ExtensionRegistryLite.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/FieldSet.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/FloatArrayList.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/GeneratedMessage.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/GeneratedMessageLite.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/IntArrayList.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/Internal.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/LazyField.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/LazyFieldLite.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/LazyStringArrayList.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/LazyStringList.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/LiteralByteString.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/LongArrayList.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/MapEntry.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/MapEntryLite.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/MapField.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/MapFieldLite.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/Message.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/MessageLite.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/MessageLiteToString.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/MessageOrBuilder.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/MessageReflection.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/MutabilityOracle.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/NioByteString.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/Parser.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/ProtobufArrayList.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/ProtocolMessageEnum.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/ProtocolStringList.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/RopeByteString.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/RpcCallback.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/RpcChannel.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/RpcController.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/RpcUtil.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/Service.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/ServiceException.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/SingleFieldBuilder.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/SmallSortedMap.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/TextFormat.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/TextFormatEscaper.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/UninitializedMessageException.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/UnknownFieldSet.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/UnknownFieldSetLite.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/UnsafeByteStrings.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/Utf8.java (100%) rename java/{core => }/src/main/java/com/google/protobuf/WireFormat.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/AbstractMessageTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/AnyTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/BooleanArrayListTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/BoundedByteStringTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/ByteStringTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/CheckUtf8Test.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/CodedInputStreamTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/CodedOutputStreamTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/DeprecatedFieldTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/DescriptorsTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/DoubleArrayListTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/DynamicMessageTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/FieldPresenceTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/FloatArrayListTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/GeneratedMessageTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/IntArrayListTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/IsValidUtf8Test.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/LazyFieldLiteTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/LazyFieldTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/LazyMessageLiteTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/LazyStringArrayListTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/LiteTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/LiteralByteStringTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/LongArrayListTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/MapForProto2LiteTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/MapForProto2Test.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/MapTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/MessageTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/NestedBuildersTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/NioByteStringTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/ParseExceptionsTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/ParserTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/ProtobufArrayListTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/RopeByteStringTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/ServiceTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/SmallSortedMapTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/TestBadIdentifiers.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/TestUtil.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/TextFormatTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/UnknownEnumValueTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/UnknownFieldSetTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/WellKnownTypesTest.java (100%) rename java/{core => }/src/test/java/com/google/protobuf/WireFormatTest.java (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/any_test.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/field_presence_test.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/lazy_fields_lite.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/lite_equals_and_hash.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/map_for_proto2_lite_test.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/map_for_proto2_test.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/map_initialization_order_test.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/map_test.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/multiple_files_test.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/nested_builders_test.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/nested_extension.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/nested_extension_lite.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/non_nested_extension.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/non_nested_extension_lite.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/outer_class_name_test.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/outer_class_name_test2.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/outer_class_name_test3.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/test_bad_identifiers.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/test_check_utf8.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/test_check_utf8_size.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/test_custom_options.proto (100%) rename java/{core/src/test/proto => src/test/java}/com/google/protobuf/test_extra_interfaces.proto (100%) rename java/util/src/test/{proto => java}/com/google/protobuf/util/json_test.proto (100%) diff --git a/java/core/src/main/java/com/google/protobuf/AbstractMessage.java b/java/src/main/java/com/google/protobuf/AbstractMessage.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/AbstractMessage.java rename to java/src/main/java/com/google/protobuf/AbstractMessage.java diff --git a/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java b/java/src/main/java/com/google/protobuf/AbstractMessageLite.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java rename to java/src/main/java/com/google/protobuf/AbstractMessageLite.java diff --git a/java/core/src/main/java/com/google/protobuf/AbstractParser.java b/java/src/main/java/com/google/protobuf/AbstractParser.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/AbstractParser.java rename to java/src/main/java/com/google/protobuf/AbstractParser.java diff --git a/java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java b/java/src/main/java/com/google/protobuf/AbstractProtobufList.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java rename to java/src/main/java/com/google/protobuf/AbstractProtobufList.java diff --git a/java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java b/java/src/main/java/com/google/protobuf/BlockingRpcChannel.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java rename to java/src/main/java/com/google/protobuf/BlockingRpcChannel.java diff --git a/java/core/src/main/java/com/google/protobuf/BlockingService.java b/java/src/main/java/com/google/protobuf/BlockingService.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/BlockingService.java rename to java/src/main/java/com/google/protobuf/BlockingService.java diff --git a/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java b/java/src/main/java/com/google/protobuf/BooleanArrayList.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/BooleanArrayList.java rename to java/src/main/java/com/google/protobuf/BooleanArrayList.java diff --git a/java/core/src/main/java/com/google/protobuf/BoundedByteString.java b/java/src/main/java/com/google/protobuf/BoundedByteString.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/BoundedByteString.java rename to java/src/main/java/com/google/protobuf/BoundedByteString.java diff --git a/java/core/src/main/java/com/google/protobuf/ByteString.java b/java/src/main/java/com/google/protobuf/ByteString.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/ByteString.java rename to java/src/main/java/com/google/protobuf/ByteString.java diff --git a/java/core/src/main/java/com/google/protobuf/CodedInputStream.java b/java/src/main/java/com/google/protobuf/CodedInputStream.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/CodedInputStream.java rename to java/src/main/java/com/google/protobuf/CodedInputStream.java diff --git a/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java b/java/src/main/java/com/google/protobuf/CodedOutputStream.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/CodedOutputStream.java rename to java/src/main/java/com/google/protobuf/CodedOutputStream.java diff --git a/java/core/src/main/java/com/google/protobuf/Descriptors.java b/java/src/main/java/com/google/protobuf/Descriptors.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/Descriptors.java rename to java/src/main/java/com/google/protobuf/Descriptors.java diff --git a/java/core/src/main/java/com/google/protobuf/DoubleArrayList.java b/java/src/main/java/com/google/protobuf/DoubleArrayList.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/DoubleArrayList.java rename to java/src/main/java/com/google/protobuf/DoubleArrayList.java diff --git a/java/core/src/main/java/com/google/protobuf/DynamicMessage.java b/java/src/main/java/com/google/protobuf/DynamicMessage.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/DynamicMessage.java rename to java/src/main/java/com/google/protobuf/DynamicMessage.java diff --git a/java/core/src/main/java/com/google/protobuf/Extension.java b/java/src/main/java/com/google/protobuf/Extension.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/Extension.java rename to java/src/main/java/com/google/protobuf/Extension.java diff --git a/java/core/src/main/java/com/google/protobuf/ExtensionLite.java b/java/src/main/java/com/google/protobuf/ExtensionLite.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/ExtensionLite.java rename to java/src/main/java/com/google/protobuf/ExtensionLite.java diff --git a/java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java b/java/src/main/java/com/google/protobuf/ExtensionRegistry.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java rename to java/src/main/java/com/google/protobuf/ExtensionRegistry.java diff --git a/java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java b/java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java rename to java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java diff --git a/java/core/src/main/java/com/google/protobuf/FieldSet.java b/java/src/main/java/com/google/protobuf/FieldSet.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/FieldSet.java rename to java/src/main/java/com/google/protobuf/FieldSet.java diff --git a/java/core/src/main/java/com/google/protobuf/FloatArrayList.java b/java/src/main/java/com/google/protobuf/FloatArrayList.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/FloatArrayList.java rename to java/src/main/java/com/google/protobuf/FloatArrayList.java diff --git a/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java b/java/src/main/java/com/google/protobuf/GeneratedMessage.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/GeneratedMessage.java rename to java/src/main/java/com/google/protobuf/GeneratedMessage.java diff --git a/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java b/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java rename to java/src/main/java/com/google/protobuf/GeneratedMessageLite.java diff --git a/java/core/src/main/java/com/google/protobuf/IntArrayList.java b/java/src/main/java/com/google/protobuf/IntArrayList.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/IntArrayList.java rename to java/src/main/java/com/google/protobuf/IntArrayList.java diff --git a/java/core/src/main/java/com/google/protobuf/Internal.java b/java/src/main/java/com/google/protobuf/Internal.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/Internal.java rename to java/src/main/java/com/google/protobuf/Internal.java diff --git a/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java b/java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java rename to java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java diff --git a/java/core/src/main/java/com/google/protobuf/LazyField.java b/java/src/main/java/com/google/protobuf/LazyField.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/LazyField.java rename to java/src/main/java/com/google/protobuf/LazyField.java diff --git a/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java b/java/src/main/java/com/google/protobuf/LazyFieldLite.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/LazyFieldLite.java rename to java/src/main/java/com/google/protobuf/LazyFieldLite.java diff --git a/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java b/java/src/main/java/com/google/protobuf/LazyStringArrayList.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java rename to java/src/main/java/com/google/protobuf/LazyStringArrayList.java diff --git a/java/core/src/main/java/com/google/protobuf/LazyStringList.java b/java/src/main/java/com/google/protobuf/LazyStringList.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/LazyStringList.java rename to java/src/main/java/com/google/protobuf/LazyStringList.java diff --git a/java/core/src/main/java/com/google/protobuf/LiteralByteString.java b/java/src/main/java/com/google/protobuf/LiteralByteString.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/LiteralByteString.java rename to java/src/main/java/com/google/protobuf/LiteralByteString.java diff --git a/java/core/src/main/java/com/google/protobuf/LongArrayList.java b/java/src/main/java/com/google/protobuf/LongArrayList.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/LongArrayList.java rename to java/src/main/java/com/google/protobuf/LongArrayList.java diff --git a/java/core/src/main/java/com/google/protobuf/MapEntry.java b/java/src/main/java/com/google/protobuf/MapEntry.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/MapEntry.java rename to java/src/main/java/com/google/protobuf/MapEntry.java diff --git a/java/core/src/main/java/com/google/protobuf/MapEntryLite.java b/java/src/main/java/com/google/protobuf/MapEntryLite.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/MapEntryLite.java rename to java/src/main/java/com/google/protobuf/MapEntryLite.java diff --git a/java/core/src/main/java/com/google/protobuf/MapField.java b/java/src/main/java/com/google/protobuf/MapField.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/MapField.java rename to java/src/main/java/com/google/protobuf/MapField.java diff --git a/java/core/src/main/java/com/google/protobuf/MapFieldLite.java b/java/src/main/java/com/google/protobuf/MapFieldLite.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/MapFieldLite.java rename to java/src/main/java/com/google/protobuf/MapFieldLite.java diff --git a/java/core/src/main/java/com/google/protobuf/Message.java b/java/src/main/java/com/google/protobuf/Message.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/Message.java rename to java/src/main/java/com/google/protobuf/Message.java diff --git a/java/core/src/main/java/com/google/protobuf/MessageLite.java b/java/src/main/java/com/google/protobuf/MessageLite.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/MessageLite.java rename to java/src/main/java/com/google/protobuf/MessageLite.java diff --git a/java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java b/java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java rename to java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java diff --git a/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java b/java/src/main/java/com/google/protobuf/MessageLiteToString.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/MessageLiteToString.java rename to java/src/main/java/com/google/protobuf/MessageLiteToString.java diff --git a/java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java b/java/src/main/java/com/google/protobuf/MessageOrBuilder.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java rename to java/src/main/java/com/google/protobuf/MessageOrBuilder.java diff --git a/java/core/src/main/java/com/google/protobuf/MessageReflection.java b/java/src/main/java/com/google/protobuf/MessageReflection.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/MessageReflection.java rename to java/src/main/java/com/google/protobuf/MessageReflection.java diff --git a/java/core/src/main/java/com/google/protobuf/MutabilityOracle.java b/java/src/main/java/com/google/protobuf/MutabilityOracle.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/MutabilityOracle.java rename to java/src/main/java/com/google/protobuf/MutabilityOracle.java diff --git a/java/core/src/main/java/com/google/protobuf/NioByteString.java b/java/src/main/java/com/google/protobuf/NioByteString.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/NioByteString.java rename to java/src/main/java/com/google/protobuf/NioByteString.java diff --git a/java/core/src/main/java/com/google/protobuf/Parser.java b/java/src/main/java/com/google/protobuf/Parser.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/Parser.java rename to java/src/main/java/com/google/protobuf/Parser.java diff --git a/java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java b/java/src/main/java/com/google/protobuf/ProtobufArrayList.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java rename to java/src/main/java/com/google/protobuf/ProtobufArrayList.java diff --git a/java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java b/java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java rename to java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java diff --git a/java/core/src/main/java/com/google/protobuf/ProtocolStringList.java b/java/src/main/java/com/google/protobuf/ProtocolStringList.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/ProtocolStringList.java rename to java/src/main/java/com/google/protobuf/ProtocolStringList.java diff --git a/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java b/java/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java rename to java/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java diff --git a/java/core/src/main/java/com/google/protobuf/RopeByteString.java b/java/src/main/java/com/google/protobuf/RopeByteString.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/RopeByteString.java rename to java/src/main/java/com/google/protobuf/RopeByteString.java diff --git a/java/core/src/main/java/com/google/protobuf/RpcCallback.java b/java/src/main/java/com/google/protobuf/RpcCallback.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/RpcCallback.java rename to java/src/main/java/com/google/protobuf/RpcCallback.java diff --git a/java/core/src/main/java/com/google/protobuf/RpcChannel.java b/java/src/main/java/com/google/protobuf/RpcChannel.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/RpcChannel.java rename to java/src/main/java/com/google/protobuf/RpcChannel.java diff --git a/java/core/src/main/java/com/google/protobuf/RpcController.java b/java/src/main/java/com/google/protobuf/RpcController.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/RpcController.java rename to java/src/main/java/com/google/protobuf/RpcController.java diff --git a/java/core/src/main/java/com/google/protobuf/RpcUtil.java b/java/src/main/java/com/google/protobuf/RpcUtil.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/RpcUtil.java rename to java/src/main/java/com/google/protobuf/RpcUtil.java diff --git a/java/core/src/main/java/com/google/protobuf/Service.java b/java/src/main/java/com/google/protobuf/Service.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/Service.java rename to java/src/main/java/com/google/protobuf/Service.java diff --git a/java/core/src/main/java/com/google/protobuf/ServiceException.java b/java/src/main/java/com/google/protobuf/ServiceException.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/ServiceException.java rename to java/src/main/java/com/google/protobuf/ServiceException.java diff --git a/java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java b/java/src/main/java/com/google/protobuf/SingleFieldBuilder.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java rename to java/src/main/java/com/google/protobuf/SingleFieldBuilder.java diff --git a/java/core/src/main/java/com/google/protobuf/SmallSortedMap.java b/java/src/main/java/com/google/protobuf/SmallSortedMap.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/SmallSortedMap.java rename to java/src/main/java/com/google/protobuf/SmallSortedMap.java diff --git a/java/core/src/main/java/com/google/protobuf/TextFormat.java b/java/src/main/java/com/google/protobuf/TextFormat.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/TextFormat.java rename to java/src/main/java/com/google/protobuf/TextFormat.java diff --git a/java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java b/java/src/main/java/com/google/protobuf/TextFormatEscaper.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java rename to java/src/main/java/com/google/protobuf/TextFormatEscaper.java diff --git a/java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java b/java/src/main/java/com/google/protobuf/UninitializedMessageException.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java rename to java/src/main/java/com/google/protobuf/UninitializedMessageException.java diff --git a/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java b/java/src/main/java/com/google/protobuf/UnknownFieldSet.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java rename to java/src/main/java/com/google/protobuf/UnknownFieldSet.java diff --git a/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java b/java/src/main/java/com/google/protobuf/UnknownFieldSetLite.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java rename to java/src/main/java/com/google/protobuf/UnknownFieldSetLite.java diff --git a/java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java b/java/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java rename to java/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java diff --git a/java/core/src/main/java/com/google/protobuf/UnsafeByteStrings.java b/java/src/main/java/com/google/protobuf/UnsafeByteStrings.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/UnsafeByteStrings.java rename to java/src/main/java/com/google/protobuf/UnsafeByteStrings.java diff --git a/java/core/src/main/java/com/google/protobuf/Utf8.java b/java/src/main/java/com/google/protobuf/Utf8.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/Utf8.java rename to java/src/main/java/com/google/protobuf/Utf8.java diff --git a/java/core/src/main/java/com/google/protobuf/WireFormat.java b/java/src/main/java/com/google/protobuf/WireFormat.java similarity index 100% rename from java/core/src/main/java/com/google/protobuf/WireFormat.java rename to java/src/main/java/com/google/protobuf/WireFormat.java diff --git a/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java b/java/src/test/java/com/google/protobuf/AbstractMessageTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java rename to java/src/test/java/com/google/protobuf/AbstractMessageTest.java diff --git a/java/core/src/test/java/com/google/protobuf/AnyTest.java b/java/src/test/java/com/google/protobuf/AnyTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/AnyTest.java rename to java/src/test/java/com/google/protobuf/AnyTest.java diff --git a/java/core/src/test/java/com/google/protobuf/BooleanArrayListTest.java b/java/src/test/java/com/google/protobuf/BooleanArrayListTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/BooleanArrayListTest.java rename to java/src/test/java/com/google/protobuf/BooleanArrayListTest.java diff --git a/java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java b/java/src/test/java/com/google/protobuf/BoundedByteStringTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java rename to java/src/test/java/com/google/protobuf/BoundedByteStringTest.java diff --git a/java/core/src/test/java/com/google/protobuf/ByteStringTest.java b/java/src/test/java/com/google/protobuf/ByteStringTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/ByteStringTest.java rename to java/src/test/java/com/google/protobuf/ByteStringTest.java diff --git a/java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java b/java/src/test/java/com/google/protobuf/CheckUtf8Test.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java rename to java/src/test/java/com/google/protobuf/CheckUtf8Test.java diff --git a/java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java b/java/src/test/java/com/google/protobuf/CodedInputStreamTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java rename to java/src/test/java/com/google/protobuf/CodedInputStreamTest.java diff --git a/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java b/java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java rename to java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java diff --git a/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java b/java/src/test/java/com/google/protobuf/DeprecatedFieldTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java rename to java/src/test/java/com/google/protobuf/DeprecatedFieldTest.java diff --git a/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java b/java/src/test/java/com/google/protobuf/DescriptorsTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/DescriptorsTest.java rename to java/src/test/java/com/google/protobuf/DescriptorsTest.java diff --git a/java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java b/java/src/test/java/com/google/protobuf/DoubleArrayListTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java rename to java/src/test/java/com/google/protobuf/DoubleArrayListTest.java diff --git a/java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java b/java/src/test/java/com/google/protobuf/DynamicMessageTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java rename to java/src/test/java/com/google/protobuf/DynamicMessageTest.java diff --git a/java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java b/java/src/test/java/com/google/protobuf/FieldPresenceTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java rename to java/src/test/java/com/google/protobuf/FieldPresenceTest.java diff --git a/java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java b/java/src/test/java/com/google/protobuf/FloatArrayListTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java rename to java/src/test/java/com/google/protobuf/FloatArrayListTest.java diff --git a/java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java b/java/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java rename to java/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java diff --git a/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java b/java/src/test/java/com/google/protobuf/GeneratedMessageTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java rename to java/src/test/java/com/google/protobuf/GeneratedMessageTest.java diff --git a/java/core/src/test/java/com/google/protobuf/IntArrayListTest.java b/java/src/test/java/com/google/protobuf/IntArrayListTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/IntArrayListTest.java rename to java/src/test/java/com/google/protobuf/IntArrayListTest.java diff --git a/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java b/java/src/test/java/com/google/protobuf/IsValidUtf8Test.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java rename to java/src/test/java/com/google/protobuf/IsValidUtf8Test.java diff --git a/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java b/java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java rename to java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java diff --git a/java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java b/java/src/test/java/com/google/protobuf/LazyFieldLiteTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java rename to java/src/test/java/com/google/protobuf/LazyFieldLiteTest.java diff --git a/java/core/src/test/java/com/google/protobuf/LazyFieldTest.java b/java/src/test/java/com/google/protobuf/LazyFieldTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/LazyFieldTest.java rename to java/src/test/java/com/google/protobuf/LazyFieldTest.java diff --git a/java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java b/java/src/test/java/com/google/protobuf/LazyMessageLiteTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java rename to java/src/test/java/com/google/protobuf/LazyMessageLiteTest.java diff --git a/java/core/src/test/java/com/google/protobuf/LazyStringArrayListTest.java b/java/src/test/java/com/google/protobuf/LazyStringArrayListTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/LazyStringArrayListTest.java rename to java/src/test/java/com/google/protobuf/LazyStringArrayListTest.java diff --git a/java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java b/java/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java rename to java/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java diff --git a/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java b/java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java rename to java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java diff --git a/java/core/src/test/java/com/google/protobuf/LiteTest.java b/java/src/test/java/com/google/protobuf/LiteTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/LiteTest.java rename to java/src/test/java/com/google/protobuf/LiteTest.java diff --git a/java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java b/java/src/test/java/com/google/protobuf/LiteralByteStringTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java rename to java/src/test/java/com/google/protobuf/LiteralByteStringTest.java diff --git a/java/core/src/test/java/com/google/protobuf/LongArrayListTest.java b/java/src/test/java/com/google/protobuf/LongArrayListTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/LongArrayListTest.java rename to java/src/test/java/com/google/protobuf/LongArrayListTest.java diff --git a/java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java b/java/src/test/java/com/google/protobuf/MapForProto2LiteTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java rename to java/src/test/java/com/google/protobuf/MapForProto2LiteTest.java diff --git a/java/core/src/test/java/com/google/protobuf/MapForProto2Test.java b/java/src/test/java/com/google/protobuf/MapForProto2Test.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/MapForProto2Test.java rename to java/src/test/java/com/google/protobuf/MapForProto2Test.java diff --git a/java/core/src/test/java/com/google/protobuf/MapTest.java b/java/src/test/java/com/google/protobuf/MapTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/MapTest.java rename to java/src/test/java/com/google/protobuf/MapTest.java diff --git a/java/core/src/test/java/com/google/protobuf/MessageTest.java b/java/src/test/java/com/google/protobuf/MessageTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/MessageTest.java rename to java/src/test/java/com/google/protobuf/MessageTest.java diff --git a/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java b/java/src/test/java/com/google/protobuf/NestedBuildersTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java rename to java/src/test/java/com/google/protobuf/NestedBuildersTest.java diff --git a/java/core/src/test/java/com/google/protobuf/NioByteStringTest.java b/java/src/test/java/com/google/protobuf/NioByteStringTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/NioByteStringTest.java rename to java/src/test/java/com/google/protobuf/NioByteStringTest.java diff --git a/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java b/java/src/test/java/com/google/protobuf/ParseExceptionsTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java rename to java/src/test/java/com/google/protobuf/ParseExceptionsTest.java diff --git a/java/core/src/test/java/com/google/protobuf/ParserTest.java b/java/src/test/java/com/google/protobuf/ParserTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/ParserTest.java rename to java/src/test/java/com/google/protobuf/ParserTest.java diff --git a/java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java b/java/src/test/java/com/google/protobuf/ProtobufArrayListTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java rename to java/src/test/java/com/google/protobuf/ProtobufArrayListTest.java diff --git a/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java b/java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java rename to java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java diff --git a/java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java b/java/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java rename to java/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java diff --git a/java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java b/java/src/test/java/com/google/protobuf/RopeByteStringTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java rename to java/src/test/java/com/google/protobuf/RopeByteStringTest.java diff --git a/java/core/src/test/java/com/google/protobuf/ServiceTest.java b/java/src/test/java/com/google/protobuf/ServiceTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/ServiceTest.java rename to java/src/test/java/com/google/protobuf/ServiceTest.java diff --git a/java/core/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java b/java/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java rename to java/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java diff --git a/java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java b/java/src/test/java/com/google/protobuf/SmallSortedMapTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java rename to java/src/test/java/com/google/protobuf/SmallSortedMapTest.java diff --git a/java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java b/java/src/test/java/com/google/protobuf/TestBadIdentifiers.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java rename to java/src/test/java/com/google/protobuf/TestBadIdentifiers.java diff --git a/java/core/src/test/java/com/google/protobuf/TestUtil.java b/java/src/test/java/com/google/protobuf/TestUtil.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/TestUtil.java rename to java/src/test/java/com/google/protobuf/TestUtil.java diff --git a/java/core/src/test/java/com/google/protobuf/TextFormatTest.java b/java/src/test/java/com/google/protobuf/TextFormatTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/TextFormatTest.java rename to java/src/test/java/com/google/protobuf/TextFormatTest.java diff --git a/java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java b/java/src/test/java/com/google/protobuf/UnknownEnumValueTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java rename to java/src/test/java/com/google/protobuf/UnknownEnumValueTest.java diff --git a/java/core/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java b/java/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java rename to java/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java diff --git a/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java b/java/src/test/java/com/google/protobuf/UnknownFieldSetTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java rename to java/src/test/java/com/google/protobuf/UnknownFieldSetTest.java diff --git a/java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java b/java/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java rename to java/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java diff --git a/java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java b/java/src/test/java/com/google/protobuf/WellKnownTypesTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java rename to java/src/test/java/com/google/protobuf/WellKnownTypesTest.java diff --git a/java/core/src/test/java/com/google/protobuf/WireFormatTest.java b/java/src/test/java/com/google/protobuf/WireFormatTest.java similarity index 100% rename from java/core/src/test/java/com/google/protobuf/WireFormatTest.java rename to java/src/test/java/com/google/protobuf/WireFormatTest.java diff --git a/java/core/src/test/proto/com/google/protobuf/any_test.proto b/java/src/test/java/com/google/protobuf/any_test.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/any_test.proto rename to java/src/test/java/com/google/protobuf/any_test.proto diff --git a/java/core/src/test/proto/com/google/protobuf/field_presence_test.proto b/java/src/test/java/com/google/protobuf/field_presence_test.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/field_presence_test.proto rename to java/src/test/java/com/google/protobuf/field_presence_test.proto diff --git a/java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto b/java/src/test/java/com/google/protobuf/lazy_fields_lite.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto rename to java/src/test/java/com/google/protobuf/lazy_fields_lite.proto diff --git a/java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto b/java/src/test/java/com/google/protobuf/lite_equals_and_hash.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto rename to java/src/test/java/com/google/protobuf/lite_equals_and_hash.proto diff --git a/java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto b/java/src/test/java/com/google/protobuf/map_for_proto2_lite_test.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto rename to java/src/test/java/com/google/protobuf/map_for_proto2_lite_test.proto diff --git a/java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto b/java/src/test/java/com/google/protobuf/map_for_proto2_test.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto rename to java/src/test/java/com/google/protobuf/map_for_proto2_test.proto diff --git a/java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto b/java/src/test/java/com/google/protobuf/map_initialization_order_test.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto rename to java/src/test/java/com/google/protobuf/map_initialization_order_test.proto diff --git a/java/core/src/test/proto/com/google/protobuf/map_test.proto b/java/src/test/java/com/google/protobuf/map_test.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/map_test.proto rename to java/src/test/java/com/google/protobuf/map_test.proto diff --git a/java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto b/java/src/test/java/com/google/protobuf/multiple_files_test.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto rename to java/src/test/java/com/google/protobuf/multiple_files_test.proto diff --git a/java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto b/java/src/test/java/com/google/protobuf/nested_builders_test.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto rename to java/src/test/java/com/google/protobuf/nested_builders_test.proto diff --git a/java/core/src/test/proto/com/google/protobuf/nested_extension.proto b/java/src/test/java/com/google/protobuf/nested_extension.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/nested_extension.proto rename to java/src/test/java/com/google/protobuf/nested_extension.proto diff --git a/java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto b/java/src/test/java/com/google/protobuf/nested_extension_lite.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto rename to java/src/test/java/com/google/protobuf/nested_extension_lite.proto diff --git a/java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto b/java/src/test/java/com/google/protobuf/non_nested_extension.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto rename to java/src/test/java/com/google/protobuf/non_nested_extension.proto diff --git a/java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto b/java/src/test/java/com/google/protobuf/non_nested_extension_lite.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto rename to java/src/test/java/com/google/protobuf/non_nested_extension_lite.proto diff --git a/java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto b/java/src/test/java/com/google/protobuf/outer_class_name_test.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto rename to java/src/test/java/com/google/protobuf/outer_class_name_test.proto diff --git a/java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto b/java/src/test/java/com/google/protobuf/outer_class_name_test2.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto rename to java/src/test/java/com/google/protobuf/outer_class_name_test2.proto diff --git a/java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto b/java/src/test/java/com/google/protobuf/outer_class_name_test3.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto rename to java/src/test/java/com/google/protobuf/outer_class_name_test3.proto diff --git a/java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto b/java/src/test/java/com/google/protobuf/test_bad_identifiers.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto rename to java/src/test/java/com/google/protobuf/test_bad_identifiers.proto diff --git a/java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto b/java/src/test/java/com/google/protobuf/test_check_utf8.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto rename to java/src/test/java/com/google/protobuf/test_check_utf8.proto diff --git a/java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto b/java/src/test/java/com/google/protobuf/test_check_utf8_size.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto rename to java/src/test/java/com/google/protobuf/test_check_utf8_size.proto diff --git a/java/core/src/test/proto/com/google/protobuf/test_custom_options.proto b/java/src/test/java/com/google/protobuf/test_custom_options.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/test_custom_options.proto rename to java/src/test/java/com/google/protobuf/test_custom_options.proto diff --git a/java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto b/java/src/test/java/com/google/protobuf/test_extra_interfaces.proto similarity index 100% rename from java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto rename to java/src/test/java/com/google/protobuf/test_extra_interfaces.proto diff --git a/java/util/src/test/proto/com/google/protobuf/util/json_test.proto b/java/util/src/test/java/com/google/protobuf/util/json_test.proto similarity index 100% rename from java/util/src/test/proto/com/google/protobuf/util/json_test.proto rename to java/util/src/test/java/com/google/protobuf/util/json_test.proto From 5221dcbe479ed765d8103ed7601c69b6d8d6ca4f Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Fri, 29 Jan 2016 13:51:05 -0800 Subject: [PATCH 2/4] Integrate from google internal. Java files are moved to un-do the hack in the prevous commit, which moved the java files to the original position for integration. --- Makefile.am | 4 +- cmake/libprotoc.cmake | 1 + generate_descriptor_proto.sh | 39 +- .../com/google/protobuf/AbstractMessage.java | 0 .../google/protobuf/AbstractMessageLite.java | 0 .../com/google/protobuf/AbstractParser.java | 0 .../google/protobuf/AbstractProtobufList.java | 0 .../google/protobuf/BlockingRpcChannel.java | 0 .../com/google/protobuf/BlockingService.java | 0 .../com/google/protobuf/BooleanArrayList.java | 0 .../java/com/google/protobuf/ByteString.java | 364 ++++++- .../com/google/protobuf/CodedInputStream.java | 52 +- .../google/protobuf/CodedOutputStream.java | 0 .../java/com/google/protobuf/Descriptors.java | 0 .../com/google/protobuf/DoubleArrayList.java | 0 .../com/google/protobuf/DynamicMessage.java | 0 .../com/google/protobuf/ExperimentalApi.java | 36 + .../java/com/google/protobuf/Extension.java | 0 .../com/google/protobuf/ExtensionLite.java | 0 .../google/protobuf/ExtensionRegistry.java | 0 .../protobuf/ExtensionRegistryLite.java | 0 .../java/com/google/protobuf/FieldSet.java | 0 .../com/google/protobuf/FloatArrayList.java | 0 .../com/google/protobuf/GeneratedMessage.java | 0 .../google/protobuf/GeneratedMessageLite.java | 0 .../com/google/protobuf/IntArrayList.java | 0 .../java/com/google/protobuf/Internal.java | 60 +- .../InvalidProtocolBufferException.java | 0 .../java/com/google/protobuf/LazyField.java | 0 .../com/google/protobuf/LazyFieldLite.java | 0 .../google/protobuf/LazyStringArrayList.java | 0 .../com/google/protobuf/LazyStringList.java | 0 .../com/google/protobuf/LongArrayList.java | 0 .../java/com/google/protobuf/MapEntry.java | 0 .../com/google/protobuf/MapEntryLite.java | 0 .../java/com/google/protobuf/MapField.java | 0 .../com/google/protobuf/MapFieldLite.java | 2 +- .../java/com/google/protobuf/Message.java | 0 .../java/com/google/protobuf/MessageLite.java | 0 .../google/protobuf/MessageLiteOrBuilder.java | 0 .../google/protobuf/MessageLiteToString.java | 0 .../com/google/protobuf/MessageOrBuilder.java | 0 .../google/protobuf/MessageReflection.java | 0 .../com/google/protobuf/MutabilityOracle.java | 0 .../com/google/protobuf/NioByteString.java | 0 .../main/java/com/google/protobuf/Parser.java | 0 .../google/protobuf/ProtobufArrayList.java | 0 .../google/protobuf/ProtocolMessageEnum.java | 0 .../google/protobuf/ProtocolStringList.java | 0 .../google/protobuf/RepeatedFieldBuilder.java | 0 .../com/google/protobuf/RopeByteString.java | 6 +- .../java/com/google/protobuf/RpcCallback.java | 0 .../java/com/google/protobuf/RpcChannel.java | 0 .../com/google/protobuf/RpcController.java | 0 .../java/com/google/protobuf/RpcUtil.java | 0 .../java/com/google/protobuf/Service.java | 0 .../com/google/protobuf/ServiceException.java | 0 .../google/protobuf/SingleFieldBuilder.java | 0 .../com/google/protobuf/SmallSortedMap.java | 0 .../java/com/google/protobuf/TextFormat.java | 0 .../google/protobuf/TextFormatEscaper.java | 0 .../UninitializedMessageException.java | 0 .../com/google/protobuf/UnknownFieldSet.java | 0 .../google/protobuf/UnknownFieldSetLite.java | 0 .../protobuf/UnmodifiableLazyStringList.java | 0 .../protobuf/UnsafeByteOperations.java} | 16 +- .../main/java/com/google/protobuf/Utf8.java | 0 .../java/com/google/protobuf/WireFormat.java | 0 .../google/protobuf/AbstractMessageTest.java | 0 .../java/com/google/protobuf/AnyTest.java | 0 .../google/protobuf/BooleanArrayListTest.java | 0 .../protobuf/BoundedByteStringTest.java | 4 +- .../com/google/protobuf/ByteStringTest.java | 8 +- .../com/google/protobuf/CheckUtf8Test.java | 0 .../google/protobuf/CodedInputStreamTest.java | 0 .../protobuf/CodedOutputStreamTest.java | 0 .../google/protobuf/DeprecatedFieldTest.java | 0 .../com/google/protobuf/DescriptorsTest.java | 0 .../google/protobuf/DoubleArrayListTest.java | 0 .../google/protobuf/DynamicMessageTest.java | 0 .../google/protobuf/FieldPresenceTest.java | 0 .../google/protobuf/FloatArrayListTest.java | 0 .../protobuf/ForceFieldBuildersPreRun.java | 0 .../google/protobuf/GeneratedMessageTest.java | 0 .../com/google/protobuf/IntArrayListTest.java | 0 .../com/google/protobuf/IsValidUtf8Test.java | 0 .../google/protobuf/IsValidUtf8TestUtil.java | 0 .../google/protobuf/LazyFieldLiteTest.java | 0 .../com/google/protobuf/LazyFieldTest.java | 0 .../google/protobuf/LazyMessageLiteTest.java | 0 .../protobuf/LazyStringArrayListTest.java | 0 .../protobuf/LazyStringEndToEndTest.java | 0 .../protobuf/LiteEqualsAndHashTest.java | 0 .../java/com/google/protobuf/LiteTest.java | 0 .../protobuf/LiteralByteStringTest.java | 18 +- .../google/protobuf/LongArrayListTest.java | 0 .../google/protobuf/MapForProto2LiteTest.java | 0 .../com/google/protobuf/MapForProto2Test.java | 0 .../java/com/google/protobuf/MapTest.java | 0 .../java/com/google/protobuf/MessageTest.java | 0 .../google/protobuf/NestedBuildersTest.java | 0 .../google/protobuf/NioByteStringTest.java | 17 +- .../google/protobuf/ParseExceptionsTest.java | 212 ++++ .../java/com/google/protobuf/ParserTest.java | 0 .../protobuf/ProtobufArrayListTest.java | 0 .../protobuf/RepeatedFieldBuilderTest.java | 0 .../protobuf/RopeByteStringSubstringTest.java | 0 .../google/protobuf/RopeByteStringTest.java | 0 .../java/com/google/protobuf/ServiceTest.java | 0 .../protobuf/SingleFieldBuilderTest.java | 0 .../google/protobuf/SmallSortedMapTest.java | 0 .../google/protobuf/TestBadIdentifiers.java | 0 .../java/com/google/protobuf/TestUtil.java | 0 .../com/google/protobuf/TextFormatTest.java | 0 .../google/protobuf/UnknownEnumValueTest.java | 0 .../protobuf/UnknownFieldSetLiteTest.java | 0 .../google/protobuf/UnknownFieldSetTest.java | 0 .../UnmodifiableLazyStringListTest.java | 0 .../google/protobuf/WellKnownTypesTest.java | 0 .../com/google/protobuf/WireFormatTest.java | 0 .../proto}/com/google/protobuf/any_test.proto | 0 .../google/protobuf/field_presence_test.proto | 0 .../google/protobuf/lazy_fields_lite.proto | 0 .../protobuf/lite_equals_and_hash.proto | 0 .../protobuf/map_for_proto2_lite_test.proto | 0 .../google/protobuf/map_for_proto2_test.proto | 0 .../map_initialization_order_test.proto | 0 .../proto}/com/google/protobuf/map_test.proto | 0 .../google/protobuf/multiple_files_test.proto | 0 .../protobuf/nested_builders_test.proto | 0 .../google/protobuf/nested_extension.proto | 0 .../protobuf/nested_extension_lite.proto | 0 .../protobuf/non_nested_extension.proto | 0 .../protobuf/non_nested_extension_lite.proto | 0 .../protobuf/outer_class_name_test.proto | 0 .../protobuf/outer_class_name_test2.proto | 0 .../protobuf/outer_class_name_test3.proto | 0 .../protobuf/test_bad_identifiers.proto | 0 .../com/google/protobuf/test_check_utf8.proto | 0 .../protobuf/test_check_utf8_size.proto | 0 .../google/protobuf/test_custom_options.proto | 0 .../protobuf/test_extra_interfaces.proto | 0 java/lite/pom.xml | 4 +- .../google/protobuf/BoundedByteString.java | 124 --- .../google/protobuf/LiteralByteString.java | 267 ----- .../google/protobuf/ParseExceptionsTest.java | 211 ---- .../com/google/protobuf/util/json_test.proto | 0 .../google/protobuf/Descriptor.pbobjc.h | 52 + .../google/protobuf/Descriptor.pbobjc.m | 149 +++ src/Makefile.am | 3 + .../protobuf/compiler/cpp/metadata_test.cc | 58 ++ .../compiler/java/java_extension_lite.cc | 0 .../compiler/java/java_extension_lite.h | 0 src/google/protobuf/descriptor.pb.cc | 969 +++++++++++++++++- src/google/protobuf/descriptor.pb.h | 409 +++++++- src/google/protobuf/descriptor.proto | 28 +- .../util/internal/testdata/maps.proto | 29 + 157 files changed, 2317 insertions(+), 825 deletions(-) rename java/{ => core}/src/main/java/com/google/protobuf/AbstractMessage.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/AbstractMessageLite.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/AbstractParser.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/AbstractProtobufList.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/BlockingRpcChannel.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/BlockingService.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/BooleanArrayList.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/ByteString.java (77%) rename java/{ => core}/src/main/java/com/google/protobuf/CodedInputStream.java (96%) rename java/{ => core}/src/main/java/com/google/protobuf/CodedOutputStream.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/Descriptors.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/DoubleArrayList.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/DynamicMessage.java (100%) create mode 100644 java/core/src/main/java/com/google/protobuf/ExperimentalApi.java rename java/{ => core}/src/main/java/com/google/protobuf/Extension.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/ExtensionLite.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/ExtensionRegistry.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/ExtensionRegistryLite.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/FieldSet.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/FloatArrayList.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/GeneratedMessage.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/GeneratedMessageLite.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/IntArrayList.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/Internal.java (91%) rename java/{ => core}/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/LazyField.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/LazyFieldLite.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/LazyStringArrayList.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/LazyStringList.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/LongArrayList.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/MapEntry.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/MapEntryLite.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/MapField.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/MapFieldLite.java (99%) rename java/{ => core}/src/main/java/com/google/protobuf/Message.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/MessageLite.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/MessageLiteToString.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/MessageOrBuilder.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/MessageReflection.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/MutabilityOracle.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/NioByteString.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/Parser.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/ProtobufArrayList.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/ProtocolMessageEnum.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/ProtocolStringList.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/RopeByteString.java (99%) rename java/{ => core}/src/main/java/com/google/protobuf/RpcCallback.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/RpcChannel.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/RpcController.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/RpcUtil.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/Service.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/ServiceException.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/SingleFieldBuilder.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/SmallSortedMap.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/TextFormat.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/TextFormatEscaper.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/UninitializedMessageException.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/UnknownFieldSet.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/UnknownFieldSetLite.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java (100%) rename java/{src/main/java/com/google/protobuf/UnsafeByteStrings.java => core/src/main/java/com/google/protobuf/UnsafeByteOperations.java} (79%) rename java/{ => core}/src/main/java/com/google/protobuf/Utf8.java (100%) rename java/{ => core}/src/main/java/com/google/protobuf/WireFormat.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/AbstractMessageTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/AnyTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/BooleanArrayListTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/BoundedByteStringTest.java (95%) rename java/{ => core}/src/test/java/com/google/protobuf/ByteStringTest.java (99%) rename java/{ => core}/src/test/java/com/google/protobuf/CheckUtf8Test.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/CodedInputStreamTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/CodedOutputStreamTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/DeprecatedFieldTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/DescriptorsTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/DoubleArrayListTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/DynamicMessageTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/FieldPresenceTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/FloatArrayListTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/GeneratedMessageTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/IntArrayListTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/IsValidUtf8Test.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/LazyFieldLiteTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/LazyFieldTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/LazyMessageLiteTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/LazyStringArrayListTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/LiteTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/LiteralByteStringTest.java (96%) rename java/{ => core}/src/test/java/com/google/protobuf/LongArrayListTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/MapForProto2LiteTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/MapForProto2Test.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/MapTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/MessageTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/NestedBuildersTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/NioByteStringTest.java (96%) create mode 100644 java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java rename java/{ => core}/src/test/java/com/google/protobuf/ParserTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/ProtobufArrayListTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/RopeByteStringTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/ServiceTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/SmallSortedMapTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/TestBadIdentifiers.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/TestUtil.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/TextFormatTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/UnknownEnumValueTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/UnknownFieldSetTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/WellKnownTypesTest.java (100%) rename java/{ => core}/src/test/java/com/google/protobuf/WireFormatTest.java (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/any_test.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/field_presence_test.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/lazy_fields_lite.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/lite_equals_and_hash.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/map_for_proto2_lite_test.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/map_for_proto2_test.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/map_initialization_order_test.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/map_test.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/multiple_files_test.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/nested_builders_test.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/nested_extension.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/nested_extension_lite.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/non_nested_extension.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/non_nested_extension_lite.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/outer_class_name_test.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/outer_class_name_test2.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/outer_class_name_test3.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/test_bad_identifiers.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/test_check_utf8.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/test_check_utf8_size.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/test_custom_options.proto (100%) rename java/{src/test/java => core/src/test/proto}/com/google/protobuf/test_extra_interfaces.proto (100%) delete mode 100644 java/src/main/java/com/google/protobuf/BoundedByteString.java delete mode 100644 java/src/main/java/com/google/protobuf/LiteralByteString.java delete mode 100644 java/src/test/java/com/google/protobuf/ParseExceptionsTest.java rename java/util/src/test/{java => proto}/com/google/protobuf/util/json_test.proto (100%) create mode 100644 src/google/protobuf/compiler/cpp/metadata_test.cc create mode 100644 src/google/protobuf/compiler/java/java_extension_lite.cc create mode 100644 src/google/protobuf/compiler/java/java_extension_lite.h diff --git a/Makefile.am b/Makefile.am index 2f810954..188346fe 100644 --- a/Makefile.am +++ b/Makefile.am @@ -193,7 +193,6 @@ java_EXTRA_DIST= java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java \ java/core/src/main/java/com/google/protobuf/BlockingService.java \ java/core/src/main/java/com/google/protobuf/BooleanArrayList.java \ - java/core/src/main/java/com/google/protobuf/BoundedByteString.java \ java/core/src/main/java/com/google/protobuf/ByteString.java \ java/core/src/main/java/com/google/protobuf/CodedInputStream.java \ java/core/src/main/java/com/google/protobuf/CodedOutputStream.java \ @@ -215,7 +214,6 @@ java_EXTRA_DIST= java/core/src/main/java/com/google/protobuf/LazyFieldLite.java \ java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java \ java/core/src/main/java/com/google/protobuf/LazyStringList.java \ - java/core/src/main/java/com/google/protobuf/LiteralByteString.java \ java/core/src/main/java/com/google/protobuf/LongArrayList.java \ java/core/src/main/java/com/google/protobuf/MapEntry.java \ java/core/src/main/java/com/google/protobuf/MapEntryLite.java \ @@ -249,7 +247,7 @@ java_EXTRA_DIST= java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java \ java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java \ java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java \ - java/core/src/main/java/com/google/protobuf/UnsafeByteStrings.java \ + java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java \ java/core/src/main/java/com/google/protobuf/Utf8.java \ java/core/src/main/java/com/google/protobuf/WireFormat.java \ java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java \ diff --git a/cmake/libprotoc.cmake b/cmake/libprotoc.cmake index e70e453e..8df8986a 100644 --- a/cmake/libprotoc.cmake +++ b/cmake/libprotoc.cmake @@ -37,6 +37,7 @@ set(libprotoc_files ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_field_lite.cc ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_enum_lite.cc ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension.cc + ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_extension_lite.cc ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_field.cc ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_file.cc ${protobuf_source_dir}/src/google/protobuf/compiler/java/java_generator.cc diff --git a/generate_descriptor_proto.sh b/generate_descriptor_proto.sh index cd906896..44006b2c 100755 --- a/generate_descriptor_proto.sh +++ b/generate_descriptor_proto.sh @@ -10,6 +10,8 @@ # to make when building protoc. This is particularly useful for passing # -j4 to run 4 jobs simultaneously. +set -e + if test ! -e src/google/protobuf/stubs/common.h; then cat >&2 << __EOF__ Could not find source code. Make sure you are running this script from the @@ -43,51 +45,48 @@ declare -a RUNTIME_PROTO_FILES=(\ CORE_PROTO_IS_CORRECT=0 PROCESS_ROUND=1 +TMP=$(mktemp -d) 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%.*} - cp ${BASE_NAME}.pb.h ${BASE_NAME}.pb.h.tmp - cp ${BASE_NAME}.pb.cc ${BASE_NAME}.pb.cc.tmp - done - cp google/protobuf/compiler/plugin.pb.h google/protobuf/compiler/plugin.pb.h.tmp - cp google/protobuf/compiler/plugin.pb.cc google/protobuf/compiler/plugin.pb.cc.tmp make $@ protoc && - ./protoc --cpp_out=dllexport_decl=LIBPROTOBUF_EXPORT:. ${RUNTIME_PROTO_FILES[@]} && \ - ./protoc --cpp_out=dllexport_decl=LIBPROTOC_EXPORT:. google/protobuf/compiler/plugin.proto + ./protoc --cpp_out=dllexport_decl=LIBPROTOBUF_EXPORT:$TMP ${RUNTIME_PROTO_FILES[@]} && \ + ./protoc --cpp_out=dllexport_decl=LIBPROTOC_EXPORT:$TMP google/protobuf/compiler/plugin.proto for PROTO_FILE in ${RUNTIME_PROTO_FILES[@]}; do BASE_NAME=${PROTO_FILE%.*} - diff ${BASE_NAME}.pb.h ${BASE_NAME}.pb.h.tmp > /dev/null + diff ${BASE_NAME}.pb.h $TMP/${BASE_NAME}.pb.h > /dev/null if test $? -ne 0; then CORE_PROTO_IS_CORRECT=0 fi - diff ${BASE_NAME}.pb.cc ${BASE_NAME}.pb.cc.tmp > /dev/null + diff ${BASE_NAME}.pb.cc $TMP/${BASE_NAME}.pb.cc > /dev/null if test $? -ne 0; then CORE_PROTO_IS_CORRECT=0 fi done - diff google/protobuf/compiler/plugin.pb.h google/protobuf/compiler/plugin.pb.h.tmp > /dev/null + diff google/protobuf/compiler/plugin.pb.h $TMP/google/protobuf/compiler/plugin.pb.h > /dev/null if test $? -ne 0; then CORE_PROTO_IS_CORRECT=0 fi - diff google/protobuf/compiler/plugin.pb.cc google/protobuf/compiler/plugin.pb.cc.tmp > /dev/null + diff google/protobuf/compiler/plugin.pb.cc $TMP/google/protobuf/compiler/plugin.pb.cc > /dev/null if test $? -ne 0; then CORE_PROTO_IS_CORRECT=0 fi - for PROTO_FILE in ${RUNTIME_PROTO_FILES[@]}; do - BASE_NAME=${PROTO_FILE%.*} - rm ${BASE_NAME}.pb.h.tmp - rm ${BASE_NAME}.pb.cc.tmp - done - rm google/protobuf/compiler/plugin.pb.h.tmp - rm google/protobuf/compiler/plugin.pb.cc.tmp + # Only override the output if the files are different to avoid re-compilation + # of the protoc. + if [ $CORE_PROTO_IS_CORRECT -ne 1 ]; then + for PROTO_FILE in ${RUNTIME_PROTO_FILES[@]}; do + BASE_NAME=${PROTO_FILE%.*} + mv $TMP/${BASE_NAME}.pb.h ${BASE_NAME}.pb.h + mv $TMP/${BASE_NAME}.pb.cc ${BASE_NAME}.pb.cc + done + mv $TMP/google/protobuf/compiler/plugin.pb.* google/protobuf/compiler/ + fi PROCESS_ROUND=$((PROCESS_ROUND + 1)) done diff --git a/java/src/main/java/com/google/protobuf/AbstractMessage.java b/java/core/src/main/java/com/google/protobuf/AbstractMessage.java similarity index 100% rename from java/src/main/java/com/google/protobuf/AbstractMessage.java rename to java/core/src/main/java/com/google/protobuf/AbstractMessage.java diff --git a/java/src/main/java/com/google/protobuf/AbstractMessageLite.java b/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java similarity index 100% rename from java/src/main/java/com/google/protobuf/AbstractMessageLite.java rename to java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java diff --git a/java/src/main/java/com/google/protobuf/AbstractParser.java b/java/core/src/main/java/com/google/protobuf/AbstractParser.java similarity index 100% rename from java/src/main/java/com/google/protobuf/AbstractParser.java rename to java/core/src/main/java/com/google/protobuf/AbstractParser.java diff --git a/java/src/main/java/com/google/protobuf/AbstractProtobufList.java b/java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java similarity index 100% rename from java/src/main/java/com/google/protobuf/AbstractProtobufList.java rename to java/core/src/main/java/com/google/protobuf/AbstractProtobufList.java diff --git a/java/src/main/java/com/google/protobuf/BlockingRpcChannel.java b/java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java similarity index 100% rename from java/src/main/java/com/google/protobuf/BlockingRpcChannel.java rename to java/core/src/main/java/com/google/protobuf/BlockingRpcChannel.java diff --git a/java/src/main/java/com/google/protobuf/BlockingService.java b/java/core/src/main/java/com/google/protobuf/BlockingService.java similarity index 100% rename from java/src/main/java/com/google/protobuf/BlockingService.java rename to java/core/src/main/java/com/google/protobuf/BlockingService.java diff --git a/java/src/main/java/com/google/protobuf/BooleanArrayList.java b/java/core/src/main/java/com/google/protobuf/BooleanArrayList.java similarity index 100% rename from java/src/main/java/com/google/protobuf/BooleanArrayList.java rename to java/core/src/main/java/com/google/protobuf/BooleanArrayList.java diff --git a/java/src/main/java/com/google/protobuf/ByteString.java b/java/core/src/main/java/com/google/protobuf/ByteString.java similarity index 77% rename from java/src/main/java/com/google/protobuf/ByteString.java rename to java/core/src/main/java/com/google/protobuf/ByteString.java index 68f20d51..305236f3 100644 --- a/java/src/main/java/com/google/protobuf/ByteString.java +++ b/java/core/src/main/java/com/google/protobuf/ByteString.java @@ -1,38 +1,13 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Copyright 2007 Google Inc. All rights reserved. package com.google.protobuf; +import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.io.InvalidObjectException; +import java.io.ObjectInputStream; import java.io.OutputStream; import java.io.Serializable; import java.io.UnsupportedEncodingException; @@ -41,6 +16,7 @@ import java.nio.charset.Charset; import java.nio.charset.UnsupportedCharsetException; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; @@ -81,7 +57,7 @@ public abstract class ByteString implements Iterable, Serializable { /** * Empty {@code ByteString}. */ - public static final ByteString EMPTY = new LiteralByteString(new byte[0]); + public static final ByteString EMPTY = new LiteralByteString(Internal.EMPTY_BYTE_ARRAY); /** * Cached hash value. Intentionally accessed via a data race, which @@ -258,6 +234,24 @@ public abstract class ByteString implements Iterable, Serializable { public static ByteString copyFrom(byte[] bytes) { return copyFrom(bytes, 0, bytes.length); } + + /** + * Wraps the given bytes into a {@code ByteString}. Intended for internal only + * usage to force a classload of ByteString before LiteralByteString. + */ + static ByteString wrap(byte[] bytes) { + // TODO(dweis): Return EMPTY when bytes are empty to reduce allocations? + return new LiteralByteString(bytes); + } + + /** + * Wraps the given bytes into a {@code ByteString}. Intended for internal only + * usage to force a classload of ByteString before BoundedByteString and + * LiteralByteString. + */ + static ByteString wrap(byte[] bytes, int offset, int length) { + return new BoundedByteString(bytes, offset, length); + } /** * Copies the next {@code size} bytes from a {@code java.nio.ByteBuffer} into @@ -1149,4 +1143,314 @@ public abstract class ByteString implements Iterable, Serializable { return String.format("", Integer.toHexString(System.identityHashCode(this)), size()); } + + /** + * This class implements a {@link com.google.protobuf.ByteString} backed by a + * single array of bytes, contiguous in memory. It supports substring by + * pointing to only a sub-range of the underlying byte array, meaning that a + * substring will reference the full byte-array of the string it's made from, + * exactly as with {@link String}. + * + * @author carlanton@google.com (Carl Haverl) + */ + // Keep this class private to avoid deadlocks in classloading across threads as ByteString's + // static initializer loads LiteralByteString and another thread loads LiteralByteString. + private static class LiteralByteString extends ByteString.LeafByteString { + private static final long serialVersionUID = 1L; + + protected final byte[] bytes; + + /** + * Creates a {@code LiteralByteString} backed by the given array, without + * copying. + * + * @param bytes array to wrap + */ + LiteralByteString(byte[] bytes) { + this.bytes = bytes; + } + + @Override + public byte byteAt(int index) { + // Unlike most methods in this class, this one is a direct implementation + // ignoring the potential offset because we need to do range-checking in the + // substring case anyway. + return bytes[index]; + } + + @Override + public int size() { + return bytes.length; + } + + // ================================================================= + // ByteString -> substring + + @Override + public final ByteString substring(int beginIndex, int endIndex) { + final int length = checkRange(beginIndex, endIndex, size()); + + if (length == 0) { + return ByteString.EMPTY; + } + + return new BoundedByteString(bytes, getOffsetIntoBytes() + beginIndex, length); + } + + // ================================================================= + // ByteString -> byte[] + + @Override + protected void copyToInternal( + byte[] target, int sourceOffset, int targetOffset, int numberToCopy) { + // Optimized form, not for subclasses, since we don't call + // getOffsetIntoBytes() or check the 'numberToCopy' parameter. + // TODO(nathanmittler): Is not calling getOffsetIntoBytes really saving that much? + System.arraycopy(bytes, sourceOffset, target, targetOffset, numberToCopy); + } + + @Override + public final void copyTo(ByteBuffer target) { + target.put(bytes, getOffsetIntoBytes(), size()); // Copies bytes + } + + @Override + public final ByteBuffer asReadOnlyByteBuffer() { + return ByteBuffer.wrap(bytes, getOffsetIntoBytes(), size()).asReadOnlyBuffer(); + } + + @Override + public final List asReadOnlyByteBufferList() { + return Collections.singletonList(asReadOnlyByteBuffer()); + } + + @Override + public final void writeTo(OutputStream outputStream) throws IOException { + outputStream.write(toByteArray()); + } + + @Override + final void writeToInternal(OutputStream outputStream, int sourceOffset, int numberToWrite) + throws IOException { + outputStream.write(bytes, getOffsetIntoBytes() + sourceOffset, numberToWrite); + } + + @Override + protected final String toStringInternal(Charset charset) { + return new String(bytes, getOffsetIntoBytes(), size(), charset); + } + + // ================================================================= + // UTF-8 decoding + + @Override + public final boolean isValidUtf8() { + int offset = getOffsetIntoBytes(); + return Utf8.isValidUtf8(bytes, offset, offset + size()); + } + + @Override + protected final int partialIsValidUtf8(int state, int offset, int length) { + int index = getOffsetIntoBytes() + offset; + return Utf8.partialIsValidUtf8(state, bytes, index, index + length); + } + + // ================================================================= + // equals() and hashCode() + + @Override + public final boolean equals(Object other) { + if (other == this) { + return true; + } + if (!(other instanceof ByteString)) { + return false; + } + + if (size() != ((ByteString) other).size()) { + return false; + } + if (size() == 0) { + return true; + } + + if (other instanceof LiteralByteString) { + LiteralByteString otherAsLiteral = (LiteralByteString) other; + // If we know the hash codes and they are not equal, we know the byte + // strings are not equal. + int thisHash = peekCachedHashCode(); + int thatHash = otherAsLiteral.peekCachedHashCode(); + if (thisHash != 0 && thatHash != 0 && thisHash != thatHash) { + return false; + } + + return equalsRange((LiteralByteString) other, 0, size()); + } else { + // RopeByteString and NioByteString. + return other.equals(this); + } + } + + /** + * Check equality of the substring of given length of this object starting at + * zero with another {@code LiteralByteString} substring starting at offset. + * + * @param other what to compare a substring in + * @param offset offset into other + * @param length number of bytes to compare + * @return true for equality of substrings, else false. + */ + @Override + final boolean equalsRange(ByteString other, int offset, int length) { + if (length > other.size()) { + throw new IllegalArgumentException("Length too large: " + length + size()); + } + if (offset + length > other.size()) { + throw new IllegalArgumentException( + "Ran off end of other: " + offset + ", " + length + ", " + other.size()); + } + + if (other instanceof LiteralByteString) { + LiteralByteString lbsOther = (LiteralByteString) other; + byte[] thisBytes = bytes; + byte[] otherBytes = lbsOther.bytes; + int thisLimit = getOffsetIntoBytes() + length; + for ( + int thisIndex = getOffsetIntoBytes(), + otherIndex = lbsOther.getOffsetIntoBytes() + offset; + (thisIndex < thisLimit); ++thisIndex, ++otherIndex) { + if (thisBytes[thisIndex] != otherBytes[otherIndex]) { + return false; + } + } + return true; + } + + return other.substring(offset, offset + length).equals(substring(0, length)); + } + + @Override + protected final int partialHash(int h, int offset, int length) { + return Internal.partialHash(h, bytes, getOffsetIntoBytes() + offset, length); + } + + // ================================================================= + // Input stream + + @Override + public final InputStream newInput() { + return new ByteArrayInputStream(bytes, getOffsetIntoBytes(), size()); // No copy + } + + @Override + public final CodedInputStream newCodedInput() { + // We trust CodedInputStream not to modify the bytes, or to give anyone + // else access to them. + return CodedInputStream.newInstance( + bytes, getOffsetIntoBytes(), size(), true /* bufferIsImmutable */); + } + + // ================================================================= + // Internal methods + + /** + * Offset into {@code bytes[]} to use, non-zero for substrings. + * + * @return always 0 for this class + */ + protected int getOffsetIntoBytes() { + return 0; + } + } + + /** + * This class is used to represent the substring of a {@link ByteString} over a + * single byte array. In terms of the public API of {@link ByteString}, you end + * up here by calling {@link ByteString#copyFrom(byte[])} followed by {@link + * ByteString#substring(int, int)}. + * + *

This class contains most of the overhead involved in creating a substring + * from a {@link LiteralByteString}. The overhead involves some range-checking + * and two extra fields. + * + * @author carlanton@google.com (Carl Haverl) + */ + // Keep this class private to avoid deadlocks in classloading across threads as ByteString's + // static initializer loads LiteralByteString and another thread loads BoundedByteString. + private static final class BoundedByteString extends LiteralByteString { + + private final int bytesOffset; + private final int bytesLength; + + /** + * Creates a {@code BoundedByteString} backed by the sub-range of given array, + * without copying. + * + * @param bytes array to wrap + * @param offset index to first byte to use in bytes + * @param length number of bytes to use from bytes + * @throws IllegalArgumentException if {@code offset < 0}, {@code length < 0}, + * or if {@code offset + length > + * bytes.length}. + */ + BoundedByteString(byte[] bytes, int offset, int length) { + super(bytes); + checkRange(offset, offset + length, bytes.length); + + this.bytesOffset = offset; + this.bytesLength = length; + } + + /** + * Gets the byte at the given index. + * Throws {@link ArrayIndexOutOfBoundsException} + * for backwards-compatibility reasons although it would more properly be + * {@link IndexOutOfBoundsException}. + * + * @param index index of byte + * @return the value + * @throws ArrayIndexOutOfBoundsException {@code index} is < 0 or >= size + */ + @Override + public byte byteAt(int index) { + // We must check the index ourselves as we cannot rely on Java array index + // checking for substrings. + checkIndex(index, size()); + return bytes[bytesOffset + index]; + } + + @Override + public int size() { + return bytesLength; + } + + @Override + protected int getOffsetIntoBytes() { + return bytesOffset; + } + + // ================================================================= + // ByteString -> byte[] + + @Override + protected void copyToInternal(byte[] target, int sourceOffset, int targetOffset, + int numberToCopy) { + System.arraycopy(bytes, getOffsetIntoBytes() + sourceOffset, target, + targetOffset, numberToCopy); + } + + // ================================================================= + // Serializable + + private static final long serialVersionUID = 1L; + + Object writeReplace() { + return ByteString.wrap(toByteArray()); + } + + private void readObject(@SuppressWarnings("unused") ObjectInputStream in) throws IOException { + throw new InvalidObjectException( + "BoundedByteStream instances are not to be serialized directly"); + } + } } diff --git a/java/src/main/java/com/google/protobuf/CodedInputStream.java b/java/core/src/main/java/com/google/protobuf/CodedInputStream.java similarity index 96% rename from java/src/main/java/com/google/protobuf/CodedInputStream.java rename to java/core/src/main/java/com/google/protobuf/CodedInputStream.java index adc91536..b3118ee0 100644 --- a/java/src/main/java/com/google/protobuf/CodedInputStream.java +++ b/java/core/src/main/java/com/google/protobuf/CodedInputStream.java @@ -70,7 +70,15 @@ public final class CodedInputStream { */ public static CodedInputStream newInstance(final byte[] buf, final int off, final int len) { - CodedInputStream result = new CodedInputStream(buf, off, len); + return newInstance(buf, off, len, false); + } + + /** + * Create a new CodedInputStream wrapping the given byte array slice. + */ + public static CodedInputStream newInstance(final byte[] buf, final int off, + final int len, boolean bufferIsImmutable) { + CodedInputStream result = new CodedInputStream(buf, off, len, bufferIsImmutable); try { // Some uses of CodedInputStream can be more efficient if they know // exactly how many bytes are available. By pushing the end point of the @@ -113,31 +121,6 @@ public final class CodedInputStream { } } - /** - * Create a new CodedInputStream wrapping a LiteralByteString. - */ - static CodedInputStream newInstance(LiteralByteString byteString) { - CodedInputStream result = new CodedInputStream(byteString); - try { - // Some uses of CodedInputStream can be more efficient if they know - // exactly how many bytes are available. By pushing the end point of the - // buffer as a limit, we allow them to get this information via - // getBytesUntilLimit(). Pushing a limit that we know is at the end of - // the stream can never hurt, since we can never past that point anyway. - result.pushLimit(byteString.size()); - } catch (InvalidProtocolBufferException ex) { - // The only reason pushLimit() might throw an exception here is if len - // is negative. Normally pushLimit()'s parameter comes directly off the - // wire, so it's important to catch exceptions in case of corrupt or - // malicious data. However, in this case, we expect that len is not a - // user-supplied value, so we can assume that it being negative indicates - // a programming error. Therefore, throwing an unchecked exception is - // appropriate. - throw new IllegalArgumentException(ex); - } - return result; - } - // ----------------------------------------------------------------- /** @@ -506,7 +489,7 @@ public final class CodedInputStream { // Fast path: We already have the bytes in a contiguous buffer, so // just copy directly from it. final ByteString result = bufferIsImmutable && enableAliasing - ? new BoundedByteString(buffer, bufferPos, size) + ? ByteString.wrap(buffer, bufferPos, size) : ByteString.copyFrom(buffer, bufferPos, size); bufferPos += size; return result; @@ -514,7 +497,7 @@ public final class CodedInputStream { return ByteString.EMPTY; } else { // Slow path: Build a byte array first then copy it. - return new LiteralByteString(readRawBytesSlowPath(size)); + return ByteString.wrap(readRawBytesSlowPath(size)); } } @@ -886,13 +869,13 @@ public final class CodedInputStream { private static final int DEFAULT_SIZE_LIMIT = 64 << 20; // 64MB private static final int BUFFER_SIZE = 4096; - private CodedInputStream(final byte[] buffer, final int off, final int len) { + private CodedInputStream(final byte[] buffer, final int off, final int len, boolean bufferIsImmutable) { this.buffer = buffer; bufferSize = off + len; bufferPos = off; totalBytesRetired = -off; input = null; - bufferIsImmutable = false; + this.bufferIsImmutable = bufferIsImmutable; } private CodedInputStream(final InputStream input) { @@ -904,15 +887,6 @@ public final class CodedInputStream { bufferIsImmutable = false; } - private CodedInputStream(final LiteralByteString byteString) { - buffer = byteString.bytes; - bufferPos = byteString.getOffsetIntoBytes(); - bufferSize = bufferPos + byteString.size(); - totalBytesRetired = -bufferPos; - input = null; - bufferIsImmutable = true; - } - public void enableAliasing(boolean enabled) { this.enableAliasing = enabled; } diff --git a/java/src/main/java/com/google/protobuf/CodedOutputStream.java b/java/core/src/main/java/com/google/protobuf/CodedOutputStream.java similarity index 100% rename from java/src/main/java/com/google/protobuf/CodedOutputStream.java rename to java/core/src/main/java/com/google/protobuf/CodedOutputStream.java diff --git a/java/src/main/java/com/google/protobuf/Descriptors.java b/java/core/src/main/java/com/google/protobuf/Descriptors.java similarity index 100% rename from java/src/main/java/com/google/protobuf/Descriptors.java rename to java/core/src/main/java/com/google/protobuf/Descriptors.java diff --git a/java/src/main/java/com/google/protobuf/DoubleArrayList.java b/java/core/src/main/java/com/google/protobuf/DoubleArrayList.java similarity index 100% rename from java/src/main/java/com/google/protobuf/DoubleArrayList.java rename to java/core/src/main/java/com/google/protobuf/DoubleArrayList.java diff --git a/java/src/main/java/com/google/protobuf/DynamicMessage.java b/java/core/src/main/java/com/google/protobuf/DynamicMessage.java similarity index 100% rename from java/src/main/java/com/google/protobuf/DynamicMessage.java rename to java/core/src/main/java/com/google/protobuf/DynamicMessage.java diff --git a/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java b/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java new file mode 100644 index 00000000..6f41fb81 --- /dev/null +++ b/java/core/src/main/java/com/google/protobuf/ExperimentalApi.java @@ -0,0 +1,36 @@ +package com.google.protobuf; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Indicates a public API that can change at any time, and has no guarantee of API stability and + * backward-compatibility. + * + *

Usage guidelines: + *

    + *
  1. This annotation is used only on public API. Internal interfaces should not use it.
  2. + *
  3. This annotation should only be added to new APIs. Adding it to an existing API is + * considered API-breaking.
  4. + *
  5. Removing this annotation from an API gives it stable status.
  6. + *
+ */ +@Retention(RetentionPolicy.SOURCE) +@Target({ + ElementType.ANNOTATION_TYPE, + ElementType.CONSTRUCTOR, + ElementType.FIELD, + ElementType.METHOD, + ElementType.PACKAGE, + ElementType.TYPE}) +@Documented +public @interface ExperimentalApi { + /** + * Context information such as links to discussion thread, tracking issue etc. + */ + String value() default ""; +} + diff --git a/java/src/main/java/com/google/protobuf/Extension.java b/java/core/src/main/java/com/google/protobuf/Extension.java similarity index 100% rename from java/src/main/java/com/google/protobuf/Extension.java rename to java/core/src/main/java/com/google/protobuf/Extension.java diff --git a/java/src/main/java/com/google/protobuf/ExtensionLite.java b/java/core/src/main/java/com/google/protobuf/ExtensionLite.java similarity index 100% rename from java/src/main/java/com/google/protobuf/ExtensionLite.java rename to java/core/src/main/java/com/google/protobuf/ExtensionLite.java diff --git a/java/src/main/java/com/google/protobuf/ExtensionRegistry.java b/java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java similarity index 100% rename from java/src/main/java/com/google/protobuf/ExtensionRegistry.java rename to java/core/src/main/java/com/google/protobuf/ExtensionRegistry.java diff --git a/java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java b/java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java similarity index 100% rename from java/src/main/java/com/google/protobuf/ExtensionRegistryLite.java rename to java/core/src/main/java/com/google/protobuf/ExtensionRegistryLite.java diff --git a/java/src/main/java/com/google/protobuf/FieldSet.java b/java/core/src/main/java/com/google/protobuf/FieldSet.java similarity index 100% rename from java/src/main/java/com/google/protobuf/FieldSet.java rename to java/core/src/main/java/com/google/protobuf/FieldSet.java diff --git a/java/src/main/java/com/google/protobuf/FloatArrayList.java b/java/core/src/main/java/com/google/protobuf/FloatArrayList.java similarity index 100% rename from java/src/main/java/com/google/protobuf/FloatArrayList.java rename to java/core/src/main/java/com/google/protobuf/FloatArrayList.java diff --git a/java/src/main/java/com/google/protobuf/GeneratedMessage.java b/java/core/src/main/java/com/google/protobuf/GeneratedMessage.java similarity index 100% rename from java/src/main/java/com/google/protobuf/GeneratedMessage.java rename to java/core/src/main/java/com/google/protobuf/GeneratedMessage.java diff --git a/java/src/main/java/com/google/protobuf/GeneratedMessageLite.java b/java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java similarity index 100% rename from java/src/main/java/com/google/protobuf/GeneratedMessageLite.java rename to java/core/src/main/java/com/google/protobuf/GeneratedMessageLite.java diff --git a/java/src/main/java/com/google/protobuf/IntArrayList.java b/java/core/src/main/java/com/google/protobuf/IntArrayList.java similarity index 100% rename from java/src/main/java/com/google/protobuf/IntArrayList.java rename to java/core/src/main/java/com/google/protobuf/IntArrayList.java diff --git a/java/src/main/java/com/google/protobuf/Internal.java b/java/core/src/main/java/com/google/protobuf/Internal.java similarity index 91% rename from java/src/main/java/com/google/protobuf/Internal.java rename to java/core/src/main/java/com/google/protobuf/Internal.java index 11901998..dca5f23b 100644 --- a/java/src/main/java/com/google/protobuf/Internal.java +++ b/java/core/src/main/java/com/google/protobuf/Internal.java @@ -1,32 +1,4 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// Copyright 2007 Google Inc. All rights reserved. package com.google.protobuf; @@ -283,9 +255,31 @@ public class Internal { // ByteString with the same content. This is to ensure that the generated // hashCode() method will return the same value as the pure reflection // based hashCode() method. - return LiteralByteString.hashCode(bytes); + return Internal.hashCode(bytes, 0, bytes.length); + } + + /** + * Helper method for implementing {@link LiteralByteString#hashCode()}. + */ + static int hashCode(byte[] bytes, int offset, int length) { + // The hash code for a byte array should be the same as the hash code for a + // ByteString with the same content. This is to ensure that the generated + // hashCode() method will return the same value as the pure reflection + // based hashCode() method. + int h = Internal.partialHash(length, bytes, offset, length); + return h == 0 ? 1 : h; } + /** + * Helper method for continuously hashing bytes. + */ + static int partialHash(int h, byte[] bytes, int offset, int length) { + for (int i = offset; i < offset + length; i++) { + h = h * 31 + bytes[i]; + } + return h; + } + /** * Helper method for implementing {@link Message#equals(Object)} for bytes * field. @@ -337,8 +331,7 @@ public class Internal { public static int hashCodeByteBuffer(ByteBuffer bytes) { if (bytes.hasArray()) { // Fast path. - int h = LiteralByteString.hashCode(bytes.capacity(), bytes.array(), - bytes.arrayOffset(), bytes.capacity()); + int h = partialHash(bytes.capacity(), bytes.array(), bytes.arrayOffset(), bytes.capacity()); return h == 0 ? 1 : h; } else { // Read the data into a temporary byte array before calculating the @@ -353,7 +346,7 @@ public class Internal { final int length = duplicated.remaining() <= bufferSize ? duplicated.remaining() : bufferSize; duplicated.get(buffer, 0, length); - h = LiteralByteString.hashCode(h, buffer, 0, length); + h = partialHash(h, buffer, 0, length); } return h == 0 ? 1 : h; } @@ -385,7 +378,6 @@ public class Internal { public static final CodedInputStream EMPTY_CODED_INPUT_STREAM = CodedInputStream.newInstance(EMPTY_BYTE_ARRAY); - /** * Provides an immutable view of {@code List} around a {@code List}. * diff --git a/java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java b/java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java similarity index 100% rename from java/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java rename to java/core/src/main/java/com/google/protobuf/InvalidProtocolBufferException.java diff --git a/java/src/main/java/com/google/protobuf/LazyField.java b/java/core/src/main/java/com/google/protobuf/LazyField.java similarity index 100% rename from java/src/main/java/com/google/protobuf/LazyField.java rename to java/core/src/main/java/com/google/protobuf/LazyField.java diff --git a/java/src/main/java/com/google/protobuf/LazyFieldLite.java b/java/core/src/main/java/com/google/protobuf/LazyFieldLite.java similarity index 100% rename from java/src/main/java/com/google/protobuf/LazyFieldLite.java rename to java/core/src/main/java/com/google/protobuf/LazyFieldLite.java diff --git a/java/src/main/java/com/google/protobuf/LazyStringArrayList.java b/java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java similarity index 100% rename from java/src/main/java/com/google/protobuf/LazyStringArrayList.java rename to java/core/src/main/java/com/google/protobuf/LazyStringArrayList.java diff --git a/java/src/main/java/com/google/protobuf/LazyStringList.java b/java/core/src/main/java/com/google/protobuf/LazyStringList.java similarity index 100% rename from java/src/main/java/com/google/protobuf/LazyStringList.java rename to java/core/src/main/java/com/google/protobuf/LazyStringList.java diff --git a/java/src/main/java/com/google/protobuf/LongArrayList.java b/java/core/src/main/java/com/google/protobuf/LongArrayList.java similarity index 100% rename from java/src/main/java/com/google/protobuf/LongArrayList.java rename to java/core/src/main/java/com/google/protobuf/LongArrayList.java diff --git a/java/src/main/java/com/google/protobuf/MapEntry.java b/java/core/src/main/java/com/google/protobuf/MapEntry.java similarity index 100% rename from java/src/main/java/com/google/protobuf/MapEntry.java rename to java/core/src/main/java/com/google/protobuf/MapEntry.java diff --git a/java/src/main/java/com/google/protobuf/MapEntryLite.java b/java/core/src/main/java/com/google/protobuf/MapEntryLite.java similarity index 100% rename from java/src/main/java/com/google/protobuf/MapEntryLite.java rename to java/core/src/main/java/com/google/protobuf/MapEntryLite.java diff --git a/java/src/main/java/com/google/protobuf/MapField.java b/java/core/src/main/java/com/google/protobuf/MapField.java similarity index 100% rename from java/src/main/java/com/google/protobuf/MapField.java rename to java/core/src/main/java/com/google/protobuf/MapField.java diff --git a/java/src/main/java/com/google/protobuf/MapFieldLite.java b/java/core/src/main/java/com/google/protobuf/MapFieldLite.java similarity index 99% rename from java/src/main/java/com/google/protobuf/MapFieldLite.java rename to java/core/src/main/java/com/google/protobuf/MapFieldLite.java index 16d3e6d2..960b6339 100644 --- a/java/src/main/java/com/google/protobuf/MapFieldLite.java +++ b/java/core/src/main/java/com/google/protobuf/MapFieldLite.java @@ -136,7 +136,7 @@ public final class MapFieldLite implements MutabilityOracle { private static int calculateHashCodeForObject(Object a) { if (a instanceof byte[]) { - return LiteralByteString.hashCode((byte[]) a); + return Internal.hashCode((byte[]) a); } // Enums should be stored as integers internally. if (a instanceof EnumLite) { diff --git a/java/src/main/java/com/google/protobuf/Message.java b/java/core/src/main/java/com/google/protobuf/Message.java similarity index 100% rename from java/src/main/java/com/google/protobuf/Message.java rename to java/core/src/main/java/com/google/protobuf/Message.java diff --git a/java/src/main/java/com/google/protobuf/MessageLite.java b/java/core/src/main/java/com/google/protobuf/MessageLite.java similarity index 100% rename from java/src/main/java/com/google/protobuf/MessageLite.java rename to java/core/src/main/java/com/google/protobuf/MessageLite.java diff --git a/java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java b/java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java similarity index 100% rename from java/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java rename to java/core/src/main/java/com/google/protobuf/MessageLiteOrBuilder.java diff --git a/java/src/main/java/com/google/protobuf/MessageLiteToString.java b/java/core/src/main/java/com/google/protobuf/MessageLiteToString.java similarity index 100% rename from java/src/main/java/com/google/protobuf/MessageLiteToString.java rename to java/core/src/main/java/com/google/protobuf/MessageLiteToString.java diff --git a/java/src/main/java/com/google/protobuf/MessageOrBuilder.java b/java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java similarity index 100% rename from java/src/main/java/com/google/protobuf/MessageOrBuilder.java rename to java/core/src/main/java/com/google/protobuf/MessageOrBuilder.java diff --git a/java/src/main/java/com/google/protobuf/MessageReflection.java b/java/core/src/main/java/com/google/protobuf/MessageReflection.java similarity index 100% rename from java/src/main/java/com/google/protobuf/MessageReflection.java rename to java/core/src/main/java/com/google/protobuf/MessageReflection.java diff --git a/java/src/main/java/com/google/protobuf/MutabilityOracle.java b/java/core/src/main/java/com/google/protobuf/MutabilityOracle.java similarity index 100% rename from java/src/main/java/com/google/protobuf/MutabilityOracle.java rename to java/core/src/main/java/com/google/protobuf/MutabilityOracle.java diff --git a/java/src/main/java/com/google/protobuf/NioByteString.java b/java/core/src/main/java/com/google/protobuf/NioByteString.java similarity index 100% rename from java/src/main/java/com/google/protobuf/NioByteString.java rename to java/core/src/main/java/com/google/protobuf/NioByteString.java diff --git a/java/src/main/java/com/google/protobuf/Parser.java b/java/core/src/main/java/com/google/protobuf/Parser.java similarity index 100% rename from java/src/main/java/com/google/protobuf/Parser.java rename to java/core/src/main/java/com/google/protobuf/Parser.java diff --git a/java/src/main/java/com/google/protobuf/ProtobufArrayList.java b/java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java similarity index 100% rename from java/src/main/java/com/google/protobuf/ProtobufArrayList.java rename to java/core/src/main/java/com/google/protobuf/ProtobufArrayList.java diff --git a/java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java b/java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java similarity index 100% rename from java/src/main/java/com/google/protobuf/ProtocolMessageEnum.java rename to java/core/src/main/java/com/google/protobuf/ProtocolMessageEnum.java diff --git a/java/src/main/java/com/google/protobuf/ProtocolStringList.java b/java/core/src/main/java/com/google/protobuf/ProtocolStringList.java similarity index 100% rename from java/src/main/java/com/google/protobuf/ProtocolStringList.java rename to java/core/src/main/java/com/google/protobuf/ProtocolStringList.java diff --git a/java/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java b/java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java similarity index 100% rename from java/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java rename to java/core/src/main/java/com/google/protobuf/RepeatedFieldBuilder.java diff --git a/java/src/main/java/com/google/protobuf/RopeByteString.java b/java/core/src/main/java/com/google/protobuf/RopeByteString.java similarity index 99% rename from java/src/main/java/com/google/protobuf/RopeByteString.java rename to java/core/src/main/java/com/google/protobuf/RopeByteString.java index 6e8eb724..469c90c2 100644 --- a/java/src/main/java/com/google/protobuf/RopeByteString.java +++ b/java/core/src/main/java/com/google/protobuf/RopeByteString.java @@ -213,14 +213,14 @@ final class RopeByteString extends ByteString { * @param right string on the right * @return string formed by copying data bytes */ - private static LiteralByteString concatenateBytes(ByteString left, + private static ByteString concatenateBytes(ByteString left, ByteString right) { int leftSize = left.size(); int rightSize = right.size(); byte[] bytes = new byte[leftSize + rightSize]; left.copyTo(bytes, 0, 0, leftSize); right.copyTo(bytes, 0, leftSize, rightSize); - return new LiteralByteString(bytes); // Constructor wraps bytes + return ByteString.wrap(bytes); // Constructor wraps bytes } /** @@ -735,7 +735,7 @@ final class RopeByteString extends ByteString { private static final long serialVersionUID = 1L; Object writeReplace() { - return new LiteralByteString(toByteArray()); + return ByteString.wrap(toByteArray()); } private void readObject(@SuppressWarnings("unused") ObjectInputStream in) throws IOException { diff --git a/java/src/main/java/com/google/protobuf/RpcCallback.java b/java/core/src/main/java/com/google/protobuf/RpcCallback.java similarity index 100% rename from java/src/main/java/com/google/protobuf/RpcCallback.java rename to java/core/src/main/java/com/google/protobuf/RpcCallback.java diff --git a/java/src/main/java/com/google/protobuf/RpcChannel.java b/java/core/src/main/java/com/google/protobuf/RpcChannel.java similarity index 100% rename from java/src/main/java/com/google/protobuf/RpcChannel.java rename to java/core/src/main/java/com/google/protobuf/RpcChannel.java diff --git a/java/src/main/java/com/google/protobuf/RpcController.java b/java/core/src/main/java/com/google/protobuf/RpcController.java similarity index 100% rename from java/src/main/java/com/google/protobuf/RpcController.java rename to java/core/src/main/java/com/google/protobuf/RpcController.java diff --git a/java/src/main/java/com/google/protobuf/RpcUtil.java b/java/core/src/main/java/com/google/protobuf/RpcUtil.java similarity index 100% rename from java/src/main/java/com/google/protobuf/RpcUtil.java rename to java/core/src/main/java/com/google/protobuf/RpcUtil.java diff --git a/java/src/main/java/com/google/protobuf/Service.java b/java/core/src/main/java/com/google/protobuf/Service.java similarity index 100% rename from java/src/main/java/com/google/protobuf/Service.java rename to java/core/src/main/java/com/google/protobuf/Service.java diff --git a/java/src/main/java/com/google/protobuf/ServiceException.java b/java/core/src/main/java/com/google/protobuf/ServiceException.java similarity index 100% rename from java/src/main/java/com/google/protobuf/ServiceException.java rename to java/core/src/main/java/com/google/protobuf/ServiceException.java diff --git a/java/src/main/java/com/google/protobuf/SingleFieldBuilder.java b/java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java similarity index 100% rename from java/src/main/java/com/google/protobuf/SingleFieldBuilder.java rename to java/core/src/main/java/com/google/protobuf/SingleFieldBuilder.java diff --git a/java/src/main/java/com/google/protobuf/SmallSortedMap.java b/java/core/src/main/java/com/google/protobuf/SmallSortedMap.java similarity index 100% rename from java/src/main/java/com/google/protobuf/SmallSortedMap.java rename to java/core/src/main/java/com/google/protobuf/SmallSortedMap.java diff --git a/java/src/main/java/com/google/protobuf/TextFormat.java b/java/core/src/main/java/com/google/protobuf/TextFormat.java similarity index 100% rename from java/src/main/java/com/google/protobuf/TextFormat.java rename to java/core/src/main/java/com/google/protobuf/TextFormat.java diff --git a/java/src/main/java/com/google/protobuf/TextFormatEscaper.java b/java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java similarity index 100% rename from java/src/main/java/com/google/protobuf/TextFormatEscaper.java rename to java/core/src/main/java/com/google/protobuf/TextFormatEscaper.java diff --git a/java/src/main/java/com/google/protobuf/UninitializedMessageException.java b/java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java similarity index 100% rename from java/src/main/java/com/google/protobuf/UninitializedMessageException.java rename to java/core/src/main/java/com/google/protobuf/UninitializedMessageException.java diff --git a/java/src/main/java/com/google/protobuf/UnknownFieldSet.java b/java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java similarity index 100% rename from java/src/main/java/com/google/protobuf/UnknownFieldSet.java rename to java/core/src/main/java/com/google/protobuf/UnknownFieldSet.java diff --git a/java/src/main/java/com/google/protobuf/UnknownFieldSetLite.java b/java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java similarity index 100% rename from java/src/main/java/com/google/protobuf/UnknownFieldSetLite.java rename to java/core/src/main/java/com/google/protobuf/UnknownFieldSetLite.java diff --git a/java/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java b/java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java similarity index 100% rename from java/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java rename to java/core/src/main/java/com/google/protobuf/UnmodifiableLazyStringList.java diff --git a/java/src/main/java/com/google/protobuf/UnsafeByteStrings.java b/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java similarity index 79% rename from java/src/main/java/com/google/protobuf/UnsafeByteStrings.java rename to java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java index c1997515..8806395c 100644 --- a/java/src/main/java/com/google/protobuf/UnsafeByteStrings.java +++ b/java/core/src/main/java/com/google/protobuf/UnsafeByteOperations.java @@ -33,15 +33,18 @@ package com.google.protobuf; import java.nio.ByteBuffer; /** - * Provides unsafe factory methods for {@link ByteString} instances. + * Provides a number of unsafe byte operations to be used by advanced applications with high + * performance requirements. These methods are referred to as "unsafe" due to the fact that they + * potentially expose the backing buffer of a {@link ByteString} to the application. * *

DISCLAIMER: The methods in this class should only be called if it is * guaranteed that the the buffer backing the {@link ByteString} will never change! Mutation of a * {@link ByteString} can lead to unexpected and undesirable consequences in your application, * and will likely be difficult to debug. Proceed with caution! */ -public final class UnsafeByteStrings { - private UnsafeByteStrings() {} +@ExperimentalApi +public final class UnsafeByteOperations { + private UnsafeByteOperations() {} /** * An unsafe operation that returns a {@link ByteString} that is backed by the provided buffer. @@ -50,6 +53,11 @@ public final class UnsafeByteStrings { * @return a {@link ByteString} backed by the provided buffer. */ public static ByteString unsafeWrap(ByteBuffer buffer) { - return new NioByteString(buffer); + if (buffer.hasArray()) { + final int offset = buffer.arrayOffset(); + return ByteString.wrap(buffer.array(), offset + buffer.position(), buffer.remaining()); + } else { + return new NioByteString(buffer); + } } } diff --git a/java/src/main/java/com/google/protobuf/Utf8.java b/java/core/src/main/java/com/google/protobuf/Utf8.java similarity index 100% rename from java/src/main/java/com/google/protobuf/Utf8.java rename to java/core/src/main/java/com/google/protobuf/Utf8.java diff --git a/java/src/main/java/com/google/protobuf/WireFormat.java b/java/core/src/main/java/com/google/protobuf/WireFormat.java similarity index 100% rename from java/src/main/java/com/google/protobuf/WireFormat.java rename to java/core/src/main/java/com/google/protobuf/WireFormat.java diff --git a/java/src/test/java/com/google/protobuf/AbstractMessageTest.java b/java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/AbstractMessageTest.java rename to java/core/src/test/java/com/google/protobuf/AbstractMessageTest.java diff --git a/java/src/test/java/com/google/protobuf/AnyTest.java b/java/core/src/test/java/com/google/protobuf/AnyTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/AnyTest.java rename to java/core/src/test/java/com/google/protobuf/AnyTest.java diff --git a/java/src/test/java/com/google/protobuf/BooleanArrayListTest.java b/java/core/src/test/java/com/google/protobuf/BooleanArrayListTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/BooleanArrayListTest.java rename to java/core/src/test/java/com/google/protobuf/BooleanArrayListTest.java diff --git a/java/src/test/java/com/google/protobuf/BoundedByteStringTest.java b/java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java similarity index 95% rename from java/src/test/java/com/google/protobuf/BoundedByteStringTest.java rename to java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java index 2dfae2e6..7a8a0a5e 100644 --- a/java/src/test/java/com/google/protobuf/BoundedByteStringTest.java +++ b/java/core/src/test/java/com/google/protobuf/BoundedByteStringTest.java @@ -62,7 +62,7 @@ public class BoundedByteStringTest extends LiteralByteStringTest { @Override public void testToString() throws UnsupportedEncodingException { String testString = "I love unicode \u1234\u5678 characters"; - LiteralByteString unicode = new LiteralByteString(testString.getBytes(Internal.UTF_8)); + ByteString unicode = ByteString.wrap(testString.getBytes(Internal.UTF_8)); ByteString chopped = unicode.substring(2, unicode.size() - 6); assertEquals(classUnderTest + ".substring() must have the expected type", classUnderTest, getActualClassName(chopped)); @@ -75,7 +75,7 @@ public class BoundedByteStringTest extends LiteralByteStringTest { @Override public void testCharsetToString() { String testString = "I love unicode \u1234\u5678 characters"; - LiteralByteString unicode = new LiteralByteString(testString.getBytes(Internal.UTF_8)); + ByteString unicode = ByteString.wrap(testString.getBytes(Internal.UTF_8)); ByteString chopped = unicode.substring(2, unicode.size() - 6); assertEquals(classUnderTest + ".substring() must have the expected type", classUnderTest, getActualClassName(chopped)); diff --git a/java/src/test/java/com/google/protobuf/ByteStringTest.java b/java/core/src/test/java/com/google/protobuf/ByteStringTest.java similarity index 99% rename from java/src/test/java/com/google/protobuf/ByteStringTest.java rename to java/core/src/test/java/com/google/protobuf/ByteStringTest.java index 36f64251..5267c160 100644 --- a/java/src/test/java/com/google/protobuf/ByteStringTest.java +++ b/java/core/src/test/java/com/google/protobuf/ByteStringTest.java @@ -655,11 +655,11 @@ public class ByteStringTest extends TestCase { // trees of empty leaves, to make a string that will fail this test. for (int i = 1; i < duo.size(); ++i) { assertTrue("Substrings of size() < 2 must not be RopeByteStrings", - duo.substring(i - 1, i) instanceof LiteralByteString); + duo.substring(i - 1, i) instanceof ByteString.LeafByteString); } for (int i = 1; i < quintet.size(); ++i) { assertTrue("Substrings of size() < 2 must not be RopeByteStrings", - quintet.substring(i - 1, i) instanceof LiteralByteString); + quintet.substring(i - 1, i) instanceof ByteString.LeafByteString); } } @@ -724,7 +724,7 @@ public class ByteStringTest extends TestCase { } data1[1] = (byte) 11; // Test LiteralByteString.writeTo(OutputStream,int,int) - LiteralByteString left = new LiteralByteString(data1); + ByteString left = ByteString.wrap(data1); byte[] result = substringUsingWriteTo(left, 1, 1); assertEquals(1, result.length); assertEquals((byte) 11, result[0]); @@ -733,7 +733,7 @@ public class ByteStringTest extends TestCase { for (int i = 0; i < data1.length; i++) { data2[i] = (byte) 2; } - LiteralByteString right = new LiteralByteString(data2); + ByteString right = ByteString.wrap(data2); // Concatenate two ByteStrings to create a RopeByteString. ByteString root = left.concat(right); // Make sure we are actually testing a RopeByteString with a simple tree diff --git a/java/src/test/java/com/google/protobuf/CheckUtf8Test.java b/java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java similarity index 100% rename from java/src/test/java/com/google/protobuf/CheckUtf8Test.java rename to java/core/src/test/java/com/google/protobuf/CheckUtf8Test.java diff --git a/java/src/test/java/com/google/protobuf/CodedInputStreamTest.java b/java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/CodedInputStreamTest.java rename to java/core/src/test/java/com/google/protobuf/CodedInputStreamTest.java diff --git a/java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java b/java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/CodedOutputStreamTest.java rename to java/core/src/test/java/com/google/protobuf/CodedOutputStreamTest.java diff --git a/java/src/test/java/com/google/protobuf/DeprecatedFieldTest.java b/java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/DeprecatedFieldTest.java rename to java/core/src/test/java/com/google/protobuf/DeprecatedFieldTest.java diff --git a/java/src/test/java/com/google/protobuf/DescriptorsTest.java b/java/core/src/test/java/com/google/protobuf/DescriptorsTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/DescriptorsTest.java rename to java/core/src/test/java/com/google/protobuf/DescriptorsTest.java diff --git a/java/src/test/java/com/google/protobuf/DoubleArrayListTest.java b/java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/DoubleArrayListTest.java rename to java/core/src/test/java/com/google/protobuf/DoubleArrayListTest.java diff --git a/java/src/test/java/com/google/protobuf/DynamicMessageTest.java b/java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/DynamicMessageTest.java rename to java/core/src/test/java/com/google/protobuf/DynamicMessageTest.java diff --git a/java/src/test/java/com/google/protobuf/FieldPresenceTest.java b/java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/FieldPresenceTest.java rename to java/core/src/test/java/com/google/protobuf/FieldPresenceTest.java diff --git a/java/src/test/java/com/google/protobuf/FloatArrayListTest.java b/java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/FloatArrayListTest.java rename to java/core/src/test/java/com/google/protobuf/FloatArrayListTest.java diff --git a/java/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java b/java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java similarity index 100% rename from java/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java rename to java/core/src/test/java/com/google/protobuf/ForceFieldBuildersPreRun.java diff --git a/java/src/test/java/com/google/protobuf/GeneratedMessageTest.java b/java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/GeneratedMessageTest.java rename to java/core/src/test/java/com/google/protobuf/GeneratedMessageTest.java diff --git a/java/src/test/java/com/google/protobuf/IntArrayListTest.java b/java/core/src/test/java/com/google/protobuf/IntArrayListTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/IntArrayListTest.java rename to java/core/src/test/java/com/google/protobuf/IntArrayListTest.java diff --git a/java/src/test/java/com/google/protobuf/IsValidUtf8Test.java b/java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java similarity index 100% rename from java/src/test/java/com/google/protobuf/IsValidUtf8Test.java rename to java/core/src/test/java/com/google/protobuf/IsValidUtf8Test.java diff --git a/java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java b/java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java similarity index 100% rename from java/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java rename to java/core/src/test/java/com/google/protobuf/IsValidUtf8TestUtil.java diff --git a/java/src/test/java/com/google/protobuf/LazyFieldLiteTest.java b/java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/LazyFieldLiteTest.java rename to java/core/src/test/java/com/google/protobuf/LazyFieldLiteTest.java diff --git a/java/src/test/java/com/google/protobuf/LazyFieldTest.java b/java/core/src/test/java/com/google/protobuf/LazyFieldTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/LazyFieldTest.java rename to java/core/src/test/java/com/google/protobuf/LazyFieldTest.java diff --git a/java/src/test/java/com/google/protobuf/LazyMessageLiteTest.java b/java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/LazyMessageLiteTest.java rename to java/core/src/test/java/com/google/protobuf/LazyMessageLiteTest.java diff --git a/java/src/test/java/com/google/protobuf/LazyStringArrayListTest.java b/java/core/src/test/java/com/google/protobuf/LazyStringArrayListTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/LazyStringArrayListTest.java rename to java/core/src/test/java/com/google/protobuf/LazyStringArrayListTest.java diff --git a/java/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java b/java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java rename to java/core/src/test/java/com/google/protobuf/LazyStringEndToEndTest.java diff --git a/java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java b/java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java rename to java/core/src/test/java/com/google/protobuf/LiteEqualsAndHashTest.java diff --git a/java/src/test/java/com/google/protobuf/LiteTest.java b/java/core/src/test/java/com/google/protobuf/LiteTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/LiteTest.java rename to java/core/src/test/java/com/google/protobuf/LiteTest.java diff --git a/java/src/test/java/com/google/protobuf/LiteralByteStringTest.java b/java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java similarity index 96% rename from java/src/test/java/com/google/protobuf/LiteralByteStringTest.java rename to java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java index c8495633..68b55ceb 100644 --- a/java/src/test/java/com/google/protobuf/LiteralByteStringTest.java +++ b/java/core/src/test/java/com/google/protobuf/LiteralByteStringTest.java @@ -75,9 +75,7 @@ public class LiteralByteStringTest extends TestCase { } protected String getActualClassName(Object object) { - String actualClassName = object.getClass().getName(); - actualClassName = actualClassName.substring(actualClassName.lastIndexOf('.') + 1); - return actualClassName; + return object.getClass().getSimpleName(); } public void testByteAt() { @@ -350,14 +348,14 @@ public class LiteralByteStringTest extends TestCase { public void testToString() throws UnsupportedEncodingException { String testString = "I love unicode \u1234\u5678 characters"; - LiteralByteString unicode = new LiteralByteString(testString.getBytes(Internal.UTF_8)); + ByteString unicode = ByteString.wrap(testString.getBytes(Internal.UTF_8)); String roundTripString = unicode.toString(UTF_8); assertEquals(classUnderTest + " unicode must match", testString, roundTripString); } public void testCharsetToString() { String testString = "I love unicode \u1234\u5678 characters"; - LiteralByteString unicode = new LiteralByteString(testString.getBytes(Internal.UTF_8)); + ByteString unicode = ByteString.wrap(testString.getBytes(Internal.UTF_8)); String roundTripString = unicode.toString(Internal.UTF_8); assertEquals(classUnderTest + " unicode must match", testString, roundTripString); } @@ -365,7 +363,7 @@ public class LiteralByteStringTest extends TestCase { public void testToString_returnsCanonicalEmptyString() { assertSame(classUnderTest + " must be the same string references", ByteString.EMPTY.toString(Internal.UTF_8), - new LiteralByteString(new byte[]{}).toString(Internal.UTF_8)); + ByteString.wrap(new byte[]{}).toString(Internal.UTF_8)); } public void testToString_raisesException() { @@ -377,7 +375,7 @@ public class LiteralByteStringTest extends TestCase { } try { - new LiteralByteString(referenceBytes).toString("invalid"); + ByteString.wrap(referenceBytes).toString("invalid"); fail("Should have thrown an exception."); } catch (UnsupportedEncodingException expected) { // This is success @@ -390,15 +388,15 @@ public class LiteralByteStringTest extends TestCase { assertFalse(classUnderTest + " must not equal the empty string", stringUnderTest.equals(ByteString.EMPTY)); assertEquals(classUnderTest + " empty strings must be equal", - new LiteralByteString(new byte[]{}), stringUnderTest.substring(55, 55)); + ByteString.wrap(new byte[]{}), stringUnderTest.substring(55, 55)); assertEquals(classUnderTest + " must equal another string with the same value", - stringUnderTest, new LiteralByteString(referenceBytes)); + stringUnderTest, ByteString.wrap(referenceBytes)); byte[] mungedBytes = new byte[referenceBytes.length]; System.arraycopy(referenceBytes, 0, mungedBytes, 0, referenceBytes.length); mungedBytes[mungedBytes.length - 5] = (byte) (mungedBytes[mungedBytes.length - 5] ^ 0xFF); assertFalse(classUnderTest + " must not equal every string with the same length", - stringUnderTest.equals(new LiteralByteString(mungedBytes))); + stringUnderTest.equals(ByteString.wrap(mungedBytes))); } public void testHashCode() { diff --git a/java/src/test/java/com/google/protobuf/LongArrayListTest.java b/java/core/src/test/java/com/google/protobuf/LongArrayListTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/LongArrayListTest.java rename to java/core/src/test/java/com/google/protobuf/LongArrayListTest.java diff --git a/java/src/test/java/com/google/protobuf/MapForProto2LiteTest.java b/java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/MapForProto2LiteTest.java rename to java/core/src/test/java/com/google/protobuf/MapForProto2LiteTest.java diff --git a/java/src/test/java/com/google/protobuf/MapForProto2Test.java b/java/core/src/test/java/com/google/protobuf/MapForProto2Test.java similarity index 100% rename from java/src/test/java/com/google/protobuf/MapForProto2Test.java rename to java/core/src/test/java/com/google/protobuf/MapForProto2Test.java diff --git a/java/src/test/java/com/google/protobuf/MapTest.java b/java/core/src/test/java/com/google/protobuf/MapTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/MapTest.java rename to java/core/src/test/java/com/google/protobuf/MapTest.java diff --git a/java/src/test/java/com/google/protobuf/MessageTest.java b/java/core/src/test/java/com/google/protobuf/MessageTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/MessageTest.java rename to java/core/src/test/java/com/google/protobuf/MessageTest.java diff --git a/java/src/test/java/com/google/protobuf/NestedBuildersTest.java b/java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/NestedBuildersTest.java rename to java/core/src/test/java/com/google/protobuf/NestedBuildersTest.java diff --git a/java/src/test/java/com/google/protobuf/NioByteStringTest.java b/java/core/src/test/java/com/google/protobuf/NioByteStringTest.java similarity index 96% rename from java/src/test/java/com/google/protobuf/NioByteStringTest.java rename to java/core/src/test/java/com/google/protobuf/NioByteStringTest.java index 0679937f..e40a3662 100644 --- a/java/src/test/java/com/google/protobuf/NioByteStringTest.java +++ b/java/core/src/test/java/com/google/protobuf/NioByteStringTest.java @@ -52,13 +52,12 @@ import java.util.NoSuchElementException; * Tests for {@link NioByteString}. */ public class NioByteStringTest extends TestCase { - private static final ByteString EMPTY = UnsafeByteStrings.unsafeWrap( - ByteBuffer.wrap(new byte[0])); + private static final ByteString EMPTY = new NioByteString(ByteBuffer.wrap(new byte[0])); private static final String CLASSNAME = NioByteString.class.getSimpleName(); private static final byte[] BYTES = ByteStringTest.getTestBytes(1234, 11337766L); - private static final int EXPECTED_HASH = new LiteralByteString(BYTES).hashCode(); + private static final int EXPECTED_HASH = ByteString.wrap(BYTES).hashCode(); private static final ByteBuffer BUFFER = ByteBuffer.wrap(BYTES.clone()); - private static final ByteString TEST_STRING = UnsafeByteStrings.unsafeWrap(BUFFER); + private static final ByteString TEST_STRING = new NioByteString(BUFFER); public void testExpectedType() { String actualClassName = getActualClassName(TEST_STRING); @@ -362,7 +361,7 @@ public class NioByteStringTest extends TestCase { public void testToString_returnsCanonicalEmptyString() { assertSame(CLASSNAME + " must be the same string references", EMPTY.toString(UTF_8), - UnsafeByteStrings.unsafeWrap(ByteBuffer.wrap(new byte[0])).toString(UTF_8)); + new NioByteString(ByteBuffer.wrap(new byte[0])).toString(UTF_8)); } public void testToString_raisesException() { @@ -389,11 +388,11 @@ public class NioByteStringTest extends TestCase { assertEquals(CLASSNAME + " empty strings must be equal", EMPTY, TEST_STRING.substring(55, 55)); assertEquals(CLASSNAME + " must equal another string with the same value", - TEST_STRING, UnsafeByteStrings.unsafeWrap(BUFFER)); + TEST_STRING, new NioByteString(BUFFER)); byte[] mungedBytes = mungedBytes(); assertFalse(CLASSNAME + " must not equal every string with the same length", - TEST_STRING.equals(UnsafeByteStrings.unsafeWrap(ByteBuffer.wrap(mungedBytes)))); + TEST_STRING.equals(new NioByteString(ByteBuffer.wrap(mungedBytes)))); } public void testEqualsLiteralByteString() { @@ -451,7 +450,7 @@ public class NioByteStringTest extends TestCase { } public void testPeekCachedHashCode() { - ByteString newString = UnsafeByteStrings.unsafeWrap(BUFFER); + ByteString newString = new NioByteString(BUFFER); assertEquals(CLASSNAME + ".peekCachedHashCode() should return zero at first", 0, newString.peekCachedHashCode()); newString.hashCode(); @@ -541,6 +540,6 @@ public class NioByteStringTest extends TestCase { } private static ByteString forString(String str) { - return UnsafeByteStrings.unsafeWrap(ByteBuffer.wrap(str.getBytes(UTF_8))); + return new NioByteString(ByteBuffer.wrap(str.getBytes(UTF_8))); } } diff --git a/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java b/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java new file mode 100644 index 00000000..03593413 --- /dev/null +++ b/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java @@ -0,0 +1,212 @@ +package com.google.protobuf; + +import com.google.protobuf.DescriptorProtos.DescriptorProto; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FilterInputStream; +import java.io.IOException; +import java.io.InputStream; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +/** + * Tests the exceptions thrown when parsing from a stream. The methods on the {@link Parser} + * interface are specified to only throw {@link InvalidProtocolBufferException}. But we really want + * to distinguish between invalid protos vs. actual I/O errors (like failures reading from a + * socket, etc.). So, when we're not using the parser directly, an {@link IOException} should be + * thrown where appropriate, instead of always an {@link InvalidProtocolBufferException}. + * + * @author jh@squareup.com (Joshua Humphries) + */ +public class ParseExceptionsTest { + +// disable for now for update the maven local repo. +// private interface ParseTester { +// DescriptorProto parse(InputStream in) throws IOException; +// } +// +// private byte serializedProto[]; +// +// private void setup() { +// serializedProto = DescriptorProto.getDescriptor().toProto().toByteArray(); +// } +// +// private void setupDelimited() { +// ByteArrayOutputStream bos = new ByteArrayOutputStream(); +// try { +// DescriptorProto.getDescriptor().toProto().writeDelimitedTo(bos); +// } catch (IOException e) { +// fail("Exception not expected: " + e); +// } +// serializedProto = bos.toByteArray(); +// } +// +// @Test public void message_parseFrom_InputStream() { +// setup(); +// verifyExceptions(new ParseTester() { +// public DescriptorProto parse(InputStream in) throws IOException { +// return DescriptorProto.parseFrom(in); +// } +// }); +// } +// +// @Test public void message_parseFrom_InputStreamAndExtensionRegistry() { +// setup(); +// verifyExceptions(new ParseTester() { +// public DescriptorProto parse(InputStream in) throws IOException { +// return DescriptorProto.parseFrom(in, ExtensionRegistry.newInstance()); +// } +// }); +// } +// +// @Test public void message_parseFrom_CodedInputStream() { +// setup(); +// verifyExceptions(new ParseTester() { +// public DescriptorProto parse(InputStream in) throws IOException { +// return DescriptorProto.parseFrom(CodedInputStream.newInstance(in)); +// } +// }); +// } +// +// @Test public void message_parseFrom_CodedInputStreamAndExtensionRegistry() { +// setup(); +// verifyExceptions(new ParseTester() { +// public DescriptorProto parse(InputStream in) throws IOException { +// return DescriptorProto.parseFrom(CodedInputStream.newInstance(in), +// ExtensionRegistry.newInstance()); +// } +// }); +// } +// +// @Test public void message_parseDelimitedFrom_InputStream() { +// setupDelimited(); +// verifyExceptions(new ParseTester() { +// public DescriptorProto parse(InputStream in) throws IOException { +// return DescriptorProto.parseDelimitedFrom(in); +// } +// }); +// } +// +// @Test public void message_parseDelimitedFrom_InputStreamAndExtensionRegistry() { +// setupDelimited(); +// verifyExceptions(new ParseTester() { +// public DescriptorProto parse(InputStream in) throws IOException { +// return DescriptorProto.parseDelimitedFrom(in, ExtensionRegistry.newInstance()); +// } +// }); +// } +// +// @Test public void messageBuilder_mergeFrom_InputStream() { +// setup(); +// verifyExceptions(new ParseTester() { +// public DescriptorProto parse(InputStream in) throws IOException { +// return DescriptorProto.newBuilder().mergeFrom(in).build(); +// } +// }); +// } +// +// @Test public void messageBuilder_mergeFrom_InputStreamAndExtensionRegistry() { +// setup(); +// verifyExceptions(new ParseTester() { +// public DescriptorProto parse(InputStream in) throws IOException { +// return DescriptorProto.newBuilder().mergeFrom(in, ExtensionRegistry.newInstance()).build(); +// } +// }); +// } +// +// @Test public void messageBuilder_mergeFrom_CodedInputStream() { +// setup(); +// verifyExceptions(new ParseTester() { +// public DescriptorProto parse(InputStream in) throws IOException { +// return DescriptorProto.newBuilder().mergeFrom(CodedInputStream.newInstance(in)).build(); +// } +// }); +// } +// +// @Test public void messageBuilder_mergeFrom_CodedInputStreamAndExtensionRegistry() { +// setup(); +// verifyExceptions(new ParseTester() { +// public DescriptorProto parse(InputStream in) throws IOException { +// return DescriptorProto.newBuilder() +// .mergeFrom(CodedInputStream.newInstance(in), ExtensionRegistry.newInstance()).build(); +// } +// }); +// } +// +// @Test public void messageBuilder_mergeDelimitedFrom_InputStream() { +// setupDelimited(); +// verifyExceptions(new ParseTester() { +// public DescriptorProto parse(InputStream in) throws IOException { +// DescriptorProto.Builder builder = DescriptorProto.newBuilder(); +// builder.mergeDelimitedFrom(in); +// return builder.build(); +// } +// }); +// } +// +// @Test public void messageBuilder_mergeDelimitedFrom_InputStreamAndExtensionRegistry() { +// setupDelimited(); +// verifyExceptions(new ParseTester() { +// public DescriptorProto parse(InputStream in) throws IOException { +// DescriptorProto.Builder builder = DescriptorProto.newBuilder(); +// builder.mergeDelimitedFrom(in, ExtensionRegistry.newInstance()); +// return builder.build(); +// } +// }); +// } +// +// private void verifyExceptions(ParseTester parseTester) { +// // No exception +// try { +// assertEquals(DescriptorProto.getDescriptor().toProto(), +// parseTester.parse(new ByteArrayInputStream(serializedProto))); +// } catch (IOException e) { +// fail("No exception expected: " + e); +// } +// +// // IOException +// try { +// // using a "broken" stream that will throw part-way through reading the message +// parseTester.parse(broken(new ByteArrayInputStream(serializedProto))); +// fail("IOException expected but not thrown"); +// } catch (IOException e) { +// assertFalse(e instanceof InvalidProtocolBufferException); +// } +// +// // InvalidProtocolBufferException +// try { +// // make the serialized proto invalid +// for (int i = 0; i < 50; i++) { +// serializedProto[i] = -1; +// } +// parseTester.parse(new ByteArrayInputStream(serializedProto)); +// fail("InvalidProtocolBufferException expected but not thrown"); +// } catch (IOException e) { +// assertTrue(e instanceof InvalidProtocolBufferException); +// } +// } +// +// private InputStream broken(InputStream i) { +// return new FilterInputStream(i) { +// int count = 0; +// +// @Override public int read() throws IOException { +// if (count++ >= 50) { +// throw new IOException("I'm broken!"); +// } +// return super.read(); +// } +// +// @Override public int read(byte b[], int off, int len) throws IOException { +// if ((count += len) >= 50) { +// throw new IOException("I'm broken!"); +// } +// return super.read(b, off, len); +// } +// }; +// } +} diff --git a/java/src/test/java/com/google/protobuf/ParserTest.java b/java/core/src/test/java/com/google/protobuf/ParserTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/ParserTest.java rename to java/core/src/test/java/com/google/protobuf/ParserTest.java diff --git a/java/src/test/java/com/google/protobuf/ProtobufArrayListTest.java b/java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/ProtobufArrayListTest.java rename to java/core/src/test/java/com/google/protobuf/ProtobufArrayListTest.java diff --git a/java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java b/java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java rename to java/core/src/test/java/com/google/protobuf/RepeatedFieldBuilderTest.java diff --git a/java/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java b/java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java rename to java/core/src/test/java/com/google/protobuf/RopeByteStringSubstringTest.java diff --git a/java/src/test/java/com/google/protobuf/RopeByteStringTest.java b/java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/RopeByteStringTest.java rename to java/core/src/test/java/com/google/protobuf/RopeByteStringTest.java diff --git a/java/src/test/java/com/google/protobuf/ServiceTest.java b/java/core/src/test/java/com/google/protobuf/ServiceTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/ServiceTest.java rename to java/core/src/test/java/com/google/protobuf/ServiceTest.java diff --git a/java/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java b/java/core/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java rename to java/core/src/test/java/com/google/protobuf/SingleFieldBuilderTest.java diff --git a/java/src/test/java/com/google/protobuf/SmallSortedMapTest.java b/java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/SmallSortedMapTest.java rename to java/core/src/test/java/com/google/protobuf/SmallSortedMapTest.java diff --git a/java/src/test/java/com/google/protobuf/TestBadIdentifiers.java b/java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java similarity index 100% rename from java/src/test/java/com/google/protobuf/TestBadIdentifiers.java rename to java/core/src/test/java/com/google/protobuf/TestBadIdentifiers.java diff --git a/java/src/test/java/com/google/protobuf/TestUtil.java b/java/core/src/test/java/com/google/protobuf/TestUtil.java similarity index 100% rename from java/src/test/java/com/google/protobuf/TestUtil.java rename to java/core/src/test/java/com/google/protobuf/TestUtil.java diff --git a/java/src/test/java/com/google/protobuf/TextFormatTest.java b/java/core/src/test/java/com/google/protobuf/TextFormatTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/TextFormatTest.java rename to java/core/src/test/java/com/google/protobuf/TextFormatTest.java diff --git a/java/src/test/java/com/google/protobuf/UnknownEnumValueTest.java b/java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/UnknownEnumValueTest.java rename to java/core/src/test/java/com/google/protobuf/UnknownEnumValueTest.java diff --git a/java/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java b/java/core/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java rename to java/core/src/test/java/com/google/protobuf/UnknownFieldSetLiteTest.java diff --git a/java/src/test/java/com/google/protobuf/UnknownFieldSetTest.java b/java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/UnknownFieldSetTest.java rename to java/core/src/test/java/com/google/protobuf/UnknownFieldSetTest.java diff --git a/java/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java b/java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java rename to java/core/src/test/java/com/google/protobuf/UnmodifiableLazyStringListTest.java diff --git a/java/src/test/java/com/google/protobuf/WellKnownTypesTest.java b/java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/WellKnownTypesTest.java rename to java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java diff --git a/java/src/test/java/com/google/protobuf/WireFormatTest.java b/java/core/src/test/java/com/google/protobuf/WireFormatTest.java similarity index 100% rename from java/src/test/java/com/google/protobuf/WireFormatTest.java rename to java/core/src/test/java/com/google/protobuf/WireFormatTest.java diff --git a/java/src/test/java/com/google/protobuf/any_test.proto b/java/core/src/test/proto/com/google/protobuf/any_test.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/any_test.proto rename to java/core/src/test/proto/com/google/protobuf/any_test.proto diff --git a/java/src/test/java/com/google/protobuf/field_presence_test.proto b/java/core/src/test/proto/com/google/protobuf/field_presence_test.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/field_presence_test.proto rename to java/core/src/test/proto/com/google/protobuf/field_presence_test.proto diff --git a/java/src/test/java/com/google/protobuf/lazy_fields_lite.proto b/java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/lazy_fields_lite.proto rename to java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto diff --git a/java/src/test/java/com/google/protobuf/lite_equals_and_hash.proto b/java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/lite_equals_and_hash.proto rename to java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto diff --git a/java/src/test/java/com/google/protobuf/map_for_proto2_lite_test.proto b/java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/map_for_proto2_lite_test.proto rename to java/core/src/test/proto/com/google/protobuf/map_for_proto2_lite_test.proto diff --git a/java/src/test/java/com/google/protobuf/map_for_proto2_test.proto b/java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/map_for_proto2_test.proto rename to java/core/src/test/proto/com/google/protobuf/map_for_proto2_test.proto diff --git a/java/src/test/java/com/google/protobuf/map_initialization_order_test.proto b/java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/map_initialization_order_test.proto rename to java/core/src/test/proto/com/google/protobuf/map_initialization_order_test.proto diff --git a/java/src/test/java/com/google/protobuf/map_test.proto b/java/core/src/test/proto/com/google/protobuf/map_test.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/map_test.proto rename to java/core/src/test/proto/com/google/protobuf/map_test.proto diff --git a/java/src/test/java/com/google/protobuf/multiple_files_test.proto b/java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/multiple_files_test.proto rename to java/core/src/test/proto/com/google/protobuf/multiple_files_test.proto diff --git a/java/src/test/java/com/google/protobuf/nested_builders_test.proto b/java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/nested_builders_test.proto rename to java/core/src/test/proto/com/google/protobuf/nested_builders_test.proto diff --git a/java/src/test/java/com/google/protobuf/nested_extension.proto b/java/core/src/test/proto/com/google/protobuf/nested_extension.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/nested_extension.proto rename to java/core/src/test/proto/com/google/protobuf/nested_extension.proto diff --git a/java/src/test/java/com/google/protobuf/nested_extension_lite.proto b/java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/nested_extension_lite.proto rename to java/core/src/test/proto/com/google/protobuf/nested_extension_lite.proto diff --git a/java/src/test/java/com/google/protobuf/non_nested_extension.proto b/java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/non_nested_extension.proto rename to java/core/src/test/proto/com/google/protobuf/non_nested_extension.proto diff --git a/java/src/test/java/com/google/protobuf/non_nested_extension_lite.proto b/java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/non_nested_extension_lite.proto rename to java/core/src/test/proto/com/google/protobuf/non_nested_extension_lite.proto diff --git a/java/src/test/java/com/google/protobuf/outer_class_name_test.proto b/java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/outer_class_name_test.proto rename to java/core/src/test/proto/com/google/protobuf/outer_class_name_test.proto diff --git a/java/src/test/java/com/google/protobuf/outer_class_name_test2.proto b/java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/outer_class_name_test2.proto rename to java/core/src/test/proto/com/google/protobuf/outer_class_name_test2.proto diff --git a/java/src/test/java/com/google/protobuf/outer_class_name_test3.proto b/java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/outer_class_name_test3.proto rename to java/core/src/test/proto/com/google/protobuf/outer_class_name_test3.proto diff --git a/java/src/test/java/com/google/protobuf/test_bad_identifiers.proto b/java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/test_bad_identifiers.proto rename to java/core/src/test/proto/com/google/protobuf/test_bad_identifiers.proto diff --git a/java/src/test/java/com/google/protobuf/test_check_utf8.proto b/java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/test_check_utf8.proto rename to java/core/src/test/proto/com/google/protobuf/test_check_utf8.proto diff --git a/java/src/test/java/com/google/protobuf/test_check_utf8_size.proto b/java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/test_check_utf8_size.proto rename to java/core/src/test/proto/com/google/protobuf/test_check_utf8_size.proto diff --git a/java/src/test/java/com/google/protobuf/test_custom_options.proto b/java/core/src/test/proto/com/google/protobuf/test_custom_options.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/test_custom_options.proto rename to java/core/src/test/proto/com/google/protobuf/test_custom_options.proto diff --git a/java/src/test/java/com/google/protobuf/test_extra_interfaces.proto b/java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto similarity index 100% rename from java/src/test/java/com/google/protobuf/test_extra_interfaces.proto rename to java/core/src/test/proto/com/google/protobuf/test_extra_interfaces.proto diff --git a/java/lite/pom.xml b/java/lite/pom.xml index 29d8c8c4..70c7d047 100644 --- a/java/lite/pom.xml +++ b/java/lite/pom.xml @@ -84,7 +84,6 @@ **/AbstractMessageLite.java **/AbstractParser.java **/AbstractProtobufList.java - **/BoundedByteString.java **/BooleanArrayList.java **/ByteString.java **/CodedInputStream.java @@ -101,7 +100,6 @@ **/LazyFieldLite.java **/LazyStringArrayList.java **/LazyStringList.java - **/LiteralByteString.java **/LongArrayList.java **/MapEntryLite.java **/MapFieldLite.java @@ -119,7 +117,7 @@ **/UninitializedMessageException.java **/UnknownFieldSetLite.java **/UnmodifiableLazyStringList.java - **/UnsafeByteStrings.java + **/UnsafeByteOperations.java **/Utf8.java **/WireFormat.java diff --git a/java/src/main/java/com/google/protobuf/BoundedByteString.java b/java/src/main/java/com/google/protobuf/BoundedByteString.java deleted file mode 100644 index 934c9030..00000000 --- a/java/src/main/java/com/google/protobuf/BoundedByteString.java +++ /dev/null @@ -1,124 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package com.google.protobuf; - -import java.io.IOException; -import java.io.InvalidObjectException; -import java.io.ObjectInputStream; - -/** - * This class is used to represent the substring of a {@link ByteString} over a - * single byte array. In terms of the public API of {@link ByteString}, you end - * up here by calling {@link ByteString#copyFrom(byte[])} followed by {@link - * ByteString#substring(int, int)}. - * - *

This class contains most of the overhead involved in creating a substring - * from a {@link LiteralByteString}. The overhead involves some range-checking - * and two extra fields. - * - * @author carlanton@google.com (Carl Haverl) - */ -final class BoundedByteString extends LiteralByteString { - - private final int bytesOffset; - private final int bytesLength; - - /** - * Creates a {@code BoundedByteString} backed by the sub-range of given array, - * without copying. - * - * @param bytes array to wrap - * @param offset index to first byte to use in bytes - * @param length number of bytes to use from bytes - * @throws IllegalArgumentException if {@code offset < 0}, {@code length < 0}, - * or if {@code offset + length > - * bytes.length}. - */ - BoundedByteString(byte[] bytes, int offset, int length) { - super(bytes); - checkRange(offset, offset + length, bytes.length); - - this.bytesOffset = offset; - this.bytesLength = length; - } - - /** - * Gets the byte at the given index. - * Throws {@link ArrayIndexOutOfBoundsException} - * for backwards-compatibility reasons although it would more properly be - * {@link IndexOutOfBoundsException}. - * - * @param index index of byte - * @return the value - * @throws ArrayIndexOutOfBoundsException {@code index} is < 0 or >= size - */ - @Override - public byte byteAt(int index) { - // We must check the index ourselves as we cannot rely on Java array index - // checking for substrings. - checkIndex(index, size()); - return bytes[bytesOffset + index]; - } - - @Override - public int size() { - return bytesLength; - } - - @Override - protected int getOffsetIntoBytes() { - return bytesOffset; - } - - // ================================================================= - // ByteString -> byte[] - - @Override - protected void copyToInternal(byte[] target, int sourceOffset, int targetOffset, - int numberToCopy) { - System.arraycopy(bytes, getOffsetIntoBytes() + sourceOffset, target, - targetOffset, numberToCopy); - } - - // ================================================================= - // Serializable - - private static final long serialVersionUID = 1L; - - Object writeReplace() { - return new LiteralByteString(toByteArray()); - } - - private void readObject(@SuppressWarnings("unused") ObjectInputStream in) throws IOException { - throw new InvalidObjectException( - "BoundedByteStream instances are not to be serialized directly"); - } -} diff --git a/java/src/main/java/com/google/protobuf/LiteralByteString.java b/java/src/main/java/com/google/protobuf/LiteralByteString.java deleted file mode 100644 index a18c2792..00000000 --- a/java/src/main/java/com/google/protobuf/LiteralByteString.java +++ /dev/null @@ -1,267 +0,0 @@ -// Protocol Buffers - Google's data interchange format -// Copyright 2008 Google Inc. All rights reserved. -// https://developers.google.com/protocol-buffers/ -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -package com.google.protobuf; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.ByteBuffer; -import java.nio.charset.Charset; -import java.util.Collections; -import java.util.List; - -/** - * This class implements a {@link com.google.protobuf.ByteString} backed by a - * single array of bytes, contiguous in memory. It supports substring by - * pointing to only a sub-range of the underlying byte array, meaning that a - * substring will reference the full byte-array of the string it's made from, - * exactly as with {@link String}. - * - * @author carlanton@google.com (Carl Haverl) - */ -class LiteralByteString extends ByteString.LeafByteString { - private static final long serialVersionUID = 1L; - - protected final byte[] bytes; - - /** - * Creates a {@code LiteralByteString} backed by the given array, without - * copying. - * - * @param bytes array to wrap - */ - LiteralByteString(byte[] bytes) { - this.bytes = bytes; - } - - @Override - public byte byteAt(int index) { - // Unlike most methods in this class, this one is a direct implementation - // ignoring the potential offset because we need to do range-checking in the - // substring case anyway. - return bytes[index]; - } - - @Override - public int size() { - return bytes.length; - } - - // ================================================================= - // ByteString -> substring - - @Override - public final ByteString substring(int beginIndex, int endIndex) { - final int length = checkRange(beginIndex, endIndex, size()); - - if (length == 0) { - return ByteString.EMPTY; - } - - return new BoundedByteString(bytes, getOffsetIntoBytes() + beginIndex, length); - } - - // ================================================================= - // ByteString -> byte[] - - @Override - protected void copyToInternal( - byte[] target, int sourceOffset, int targetOffset, int numberToCopy) { - // Optimized form, not for subclasses, since we don't call - // getOffsetIntoBytes() or check the 'numberToCopy' parameter. - // TODO(nathanmittler): Is not calling getOffsetIntoBytes really saving that much? - System.arraycopy(bytes, sourceOffset, target, targetOffset, numberToCopy); - } - - @Override - public final void copyTo(ByteBuffer target) { - target.put(bytes, getOffsetIntoBytes(), size()); // Copies bytes - } - - @Override - public final ByteBuffer asReadOnlyByteBuffer() { - return ByteBuffer.wrap(bytes, getOffsetIntoBytes(), size()).asReadOnlyBuffer(); - } - - @Override - public final List asReadOnlyByteBufferList() { - return Collections.singletonList(asReadOnlyByteBuffer()); - } - - @Override - public final void writeTo(OutputStream outputStream) throws IOException { - outputStream.write(toByteArray()); - } - - @Override - final void writeToInternal(OutputStream outputStream, int sourceOffset, int numberToWrite) - throws IOException { - outputStream.write(bytes, getOffsetIntoBytes() + sourceOffset, numberToWrite); - } - - @Override - protected final String toStringInternal(Charset charset) { - return new String(bytes, getOffsetIntoBytes(), size(), charset); - } - - // ================================================================= - // UTF-8 decoding - - @Override - public final boolean isValidUtf8() { - int offset = getOffsetIntoBytes(); - return Utf8.isValidUtf8(bytes, offset, offset + size()); - } - - @Override - protected final int partialIsValidUtf8(int state, int offset, int length) { - int index = getOffsetIntoBytes() + offset; - return Utf8.partialIsValidUtf8(state, bytes, index, index + length); - } - - // ================================================================= - // equals() and hashCode() - - @Override - public final boolean equals(Object other) { - if (other == this) { - return true; - } - if (!(other instanceof ByteString)) { - return false; - } - - if (size() != ((ByteString) other).size()) { - return false; - } - if (size() == 0) { - return true; - } - - if (other instanceof LiteralByteString) { - LiteralByteString otherAsLiteral = (LiteralByteString) other; - // If we know the hash codes and they are not equal, we know the byte - // strings are not equal. - int thisHash = peekCachedHashCode(); - int thatHash = otherAsLiteral.peekCachedHashCode(); - if (thisHash != 0 && thatHash != 0 && thisHash != thatHash) { - return false; - } - - return equalsRange((LiteralByteString) other, 0, size()); - } else { - // RopeByteString and NioByteString. - return other.equals(this); - } - } - - /** - * Check equality of the substring of given length of this object starting at - * zero with another {@code LiteralByteString} substring starting at offset. - * - * @param other what to compare a substring in - * @param offset offset into other - * @param length number of bytes to compare - * @return true for equality of substrings, else false. - */ - @Override - final boolean equalsRange(ByteString other, int offset, int length) { - if (length > other.size()) { - throw new IllegalArgumentException("Length too large: " + length + size()); - } - if (offset + length > other.size()) { - throw new IllegalArgumentException( - "Ran off end of other: " + offset + ", " + length + ", " + other.size()); - } - - if (other instanceof LiteralByteString) { - LiteralByteString lbsOther = (LiteralByteString) other; - byte[] thisBytes = bytes; - byte[] otherBytes = lbsOther.bytes; - int thisLimit = getOffsetIntoBytes() + length; - for ( - int thisIndex = getOffsetIntoBytes(), otherIndex = lbsOther.getOffsetIntoBytes() + offset; - (thisIndex < thisLimit); ++thisIndex, ++otherIndex) { - if (thisBytes[thisIndex] != otherBytes[otherIndex]) { - return false; - } - } - return true; - } - - return other.substring(offset, offset + length).equals(substring(0, length)); - } - - @Override - protected final int partialHash(int h, int offset, int length) { - return hashCode(h, bytes, getOffsetIntoBytes() + offset, length); - } - - static int hashCode(int h, byte[] bytes, int offset, int length) { - for (int i = offset; i < offset + length; i++) { - h = h * 31 + bytes[i]; - } - return h; - } - - static int hashCode(byte[] bytes) { - int h = hashCode(bytes.length, bytes, 0, bytes.length); - return h == 0 ? 1 : h; - } - - // ================================================================= - // Input stream - - @Override - public final InputStream newInput() { - return new ByteArrayInputStream(bytes, getOffsetIntoBytes(), size()); // No copy - } - - @Override - public final CodedInputStream newCodedInput() { - // We trust CodedInputStream not to modify the bytes, or to give anyone - // else access to them. - return CodedInputStream.newInstance(this); - } - - // ================================================================= - // Internal methods - - /** - * Offset into {@code bytes[]} to use, non-zero for substrings. - * - * @return always 0 for this class - */ - protected int getOffsetIntoBytes() { - return 0; - } -} diff --git a/java/src/test/java/com/google/protobuf/ParseExceptionsTest.java b/java/src/test/java/com/google/protobuf/ParseExceptionsTest.java deleted file mode 100644 index 37fa242d..00000000 --- a/java/src/test/java/com/google/protobuf/ParseExceptionsTest.java +++ /dev/null @@ -1,211 +0,0 @@ -package com.google.protobuf; - -import com.google.protobuf.DescriptorProtos.DescriptorProto; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FilterInputStream; -import java.io.IOException; -import java.io.InputStream; -import org.junit.Test; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - -/** - * Tests the exceptions thrown when parsing from a stream. The methods on the {@link Parser} - * interface are specified to only throw {@link InvalidProtocolBufferException}. But we really want - * to distinguish between invalid protos vs. actual I/O errors (like failures reading from a - * socket, etc.). So, when we're not using the parser directly, an {@link IOException} should be - * thrown where appropriate, instead of always an {@link InvalidProtocolBufferException}. - * - * @author jh@squareup.com (Joshua Humphries) - */ -public class ParseExceptionsTest { - - private interface ParseTester { - DescriptorProto parse(InputStream in) throws IOException; - } - - private byte serializedProto[]; - - private void setup() { - serializedProto = DescriptorProto.getDescriptor().toProto().toByteArray(); - } - - private void setupDelimited() { - ByteArrayOutputStream bos = new ByteArrayOutputStream(); - try { - DescriptorProto.getDescriptor().toProto().writeDelimitedTo(bos); - } catch (IOException e) { - fail("Exception not expected: " + e); - } - serializedProto = bos.toByteArray(); - } - - @Test public void message_parseFrom_InputStream() { - setup(); - verifyExceptions(new ParseTester() { - public DescriptorProto parse(InputStream in) throws IOException { - return DescriptorProto.parseFrom(in); - } - }); - } - - @Test public void message_parseFrom_InputStreamAndExtensionRegistry() { - setup(); - verifyExceptions(new ParseTester() { - public DescriptorProto parse(InputStream in) throws IOException { - return DescriptorProto.parseFrom(in, ExtensionRegistry.newInstance()); - } - }); - } - - @Test public void message_parseFrom_CodedInputStream() { - setup(); - verifyExceptions(new ParseTester() { - public DescriptorProto parse(InputStream in) throws IOException { - return DescriptorProto.parseFrom(CodedInputStream.newInstance(in)); - } - }); - } - - @Test public void message_parseFrom_CodedInputStreamAndExtensionRegistry() { - setup(); - verifyExceptions(new ParseTester() { - public DescriptorProto parse(InputStream in) throws IOException { - return DescriptorProto.parseFrom(CodedInputStream.newInstance(in), - ExtensionRegistry.newInstance()); - } - }); - } - - @Test public void message_parseDelimitedFrom_InputStream() { - setupDelimited(); - verifyExceptions(new ParseTester() { - public DescriptorProto parse(InputStream in) throws IOException { - return DescriptorProto.parseDelimitedFrom(in); - } - }); - } - - @Test public void message_parseDelimitedFrom_InputStreamAndExtensionRegistry() { - setupDelimited(); - verifyExceptions(new ParseTester() { - public DescriptorProto parse(InputStream in) throws IOException { - return DescriptorProto.parseDelimitedFrom(in, ExtensionRegistry.newInstance()); - } - }); - } - - @Test public void messageBuilder_mergeFrom_InputStream() { - setup(); - verifyExceptions(new ParseTester() { - public DescriptorProto parse(InputStream in) throws IOException { - return DescriptorProto.newBuilder().mergeFrom(in).build(); - } - }); - } - - @Test public void messageBuilder_mergeFrom_InputStreamAndExtensionRegistry() { - setup(); - verifyExceptions(new ParseTester() { - public DescriptorProto parse(InputStream in) throws IOException { - return DescriptorProto.newBuilder().mergeFrom(in, ExtensionRegistry.newInstance()).build(); - } - }); - } - - @Test public void messageBuilder_mergeFrom_CodedInputStream() { - setup(); - verifyExceptions(new ParseTester() { - public DescriptorProto parse(InputStream in) throws IOException { - return DescriptorProto.newBuilder().mergeFrom(CodedInputStream.newInstance(in)).build(); - } - }); - } - - @Test public void messageBuilder_mergeFrom_CodedInputStreamAndExtensionRegistry() { - setup(); - verifyExceptions(new ParseTester() { - public DescriptorProto parse(InputStream in) throws IOException { - return DescriptorProto.newBuilder() - .mergeFrom(CodedInputStream.newInstance(in), ExtensionRegistry.newInstance()).build(); - } - }); - } - - @Test public void messageBuilder_mergeDelimitedFrom_InputStream() { - setupDelimited(); - verifyExceptions(new ParseTester() { - public DescriptorProto parse(InputStream in) throws IOException { - DescriptorProto.Builder builder = DescriptorProto.newBuilder(); - builder.mergeDelimitedFrom(in); - return builder.build(); - } - }); - } - - @Test public void messageBuilder_mergeDelimitedFrom_InputStreamAndExtensionRegistry() { - setupDelimited(); - verifyExceptions(new ParseTester() { - public DescriptorProto parse(InputStream in) throws IOException { - DescriptorProto.Builder builder = DescriptorProto.newBuilder(); - builder.mergeDelimitedFrom(in, ExtensionRegistry.newInstance()); - return builder.build(); - } - }); - } - - private void verifyExceptions(ParseTester parseTester) { - // No exception - try { - assertEquals(DescriptorProto.getDescriptor().toProto(), - parseTester.parse(new ByteArrayInputStream(serializedProto))); - } catch (IOException e) { - fail("No exception expected: " + e); - } - - // IOException - try { - // using a "broken" stream that will throw part-way through reading the message - parseTester.parse(broken(new ByteArrayInputStream(serializedProto))); - fail("IOException expected but not thrown"); - } catch (IOException e) { - assertFalse(e instanceof InvalidProtocolBufferException); - } - - // InvalidProtocolBufferException - try { - // make the serialized proto invalid - for (int i = 0; i < 50; i++) { - serializedProto[i] = -1; - } - parseTester.parse(new ByteArrayInputStream(serializedProto)); - fail("InvalidProtocolBufferException expected but not thrown"); - } catch (IOException e) { - assertTrue(e instanceof InvalidProtocolBufferException); - } - } - - private InputStream broken(InputStream i) { - return new FilterInputStream(i) { - int count = 0; - - @Override public int read() throws IOException { - if (count++ >= 50) { - throw new IOException("I'm broken!"); - } - return super.read(); - } - - @Override public int read(byte b[], int off, int len) throws IOException { - if ((count += len) >= 50) { - throw new IOException("I'm broken!"); - } - return super.read(b, off, len); - } - }; - } -} diff --git a/java/util/src/test/java/com/google/protobuf/util/json_test.proto b/java/util/src/test/proto/com/google/protobuf/util/json_test.proto similarity index 100% rename from java/util/src/test/java/com/google/protobuf/util/json_test.proto rename to java/util/src/test/proto/com/google/protobuf/util/json_test.proto diff --git a/objectivec/google/protobuf/Descriptor.pbobjc.h b/objectivec/google/protobuf/Descriptor.pbobjc.h index f04616c3..9c43cfd2 100644 --- a/objectivec/google/protobuf/Descriptor.pbobjc.h +++ b/objectivec/google/protobuf/Descriptor.pbobjc.h @@ -1153,6 +1153,58 @@ typedef GPB_ENUM(GPBSourceCodeInfo_Location_FieldNumber) { @end +#pragma mark - GPBGeneratedCodeInfo + +typedef GPB_ENUM(GPBGeneratedCodeInfo_FieldNumber) { + GPBGeneratedCodeInfo_FieldNumber_AnnotationArray = 1, +}; + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +@interface GPBGeneratedCodeInfo : GPBMessage + +// An Annotation connects some span of text in generated code to an element +// of its generating .proto file. +// |annotationArray| contains |GPBGeneratedCodeInfo_Annotation| +@property(nonatomic, readwrite, strong, null_resettable) NSMutableArray *annotationArray; +@property(nonatomic, readonly) NSUInteger annotationArray_Count; + +@end + +#pragma mark - GPBGeneratedCodeInfo_Annotation + +typedef GPB_ENUM(GPBGeneratedCodeInfo_Annotation_FieldNumber) { + GPBGeneratedCodeInfo_Annotation_FieldNumber_PathArray = 1, + GPBGeneratedCodeInfo_Annotation_FieldNumber_SourceFile = 2, + GPBGeneratedCodeInfo_Annotation_FieldNumber_Begin = 3, + GPBGeneratedCodeInfo_Annotation_FieldNumber_End = 4, +}; + +@interface GPBGeneratedCodeInfo_Annotation : GPBMessage + +// Identifies the element in the original source .proto file. This field +// is formatted the same as SourceCodeInfo.Location.path. +@property(nonatomic, readwrite, strong, null_resettable) GPBInt32Array *pathArray; +@property(nonatomic, readonly) NSUInteger pathArray_Count; + +// Identifies the filesystem path to the original source .proto. +@property(nonatomic, readwrite) BOOL hasSourceFile; +@property(nonatomic, readwrite, copy, null_resettable) NSString *sourceFile; + +// Identifies the starting offset in bytes in the generated code +// that relates to the identified object. +@property(nonatomic, readwrite) BOOL hasBegin; +@property(nonatomic, readwrite) int32_t begin; + +// Identifies the ending offset in bytes in the generated code that +// relates to the identified offset. The end offset should be one past +// the last relevant byte (so the length of the text = end - begin). +@property(nonatomic, readwrite) BOOL hasEnd; +@property(nonatomic, readwrite) int32_t end; + +@end + NS_ASSUME_NONNULL_END CF_EXTERN_C_END diff --git a/objectivec/google/protobuf/Descriptor.pbobjc.m b/objectivec/google/protobuf/Descriptor.pbobjc.m index e3e44c48..40309893 100644 --- a/objectivec/google/protobuf/Descriptor.pbobjc.m +++ b/objectivec/google/protobuf/Descriptor.pbobjc.m @@ -1434,7 +1434,11 @@ typedef struct GPBFileOptions__storage_ { .offset = offsetof(GPBFileOptions__storage_, javananoUseDeprecatedPackage), .defaultValue.valueBool = NO, .dataTypeSpecific.className = NULL, + #if GPBOBJC_INCLUDE_FIELD_OPTIONS + .fieldOptions = "\000\000\000\002\030\001", + #else .fieldOptions = NULL, + #endif // GPBOBJC_INCLUDE_FIELD_OPTIONS }, { .name = "uninterpretedOptionArray", @@ -2441,5 +2445,150 @@ typedef struct GPBSourceCodeInfo_Location__storage_ { @end +#pragma mark - GPBGeneratedCodeInfo + +@implementation GPBGeneratedCodeInfo + +@dynamic annotationArray, annotationArray_Count; + +typedef struct GPBGeneratedCodeInfo__storage_ { + uint32_t _has_storage_[1]; + NSMutableArray *annotationArray; +} GPBGeneratedCodeInfo__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "annotationArray", + .number = GPBGeneratedCodeInfo_FieldNumber_AnnotationArray, + .hasIndex = GPBNoHasBit, + .flags = GPBFieldRepeated, + .dataType = GPBDataTypeMessage, + .offset = offsetof(GPBGeneratedCodeInfo__storage_, annotationArray), + .defaultValue.valueMessage = nil, + .dataTypeSpecific.className = GPBStringifySymbol(GPBGeneratedCodeInfo_Annotation), + .fieldOptions = NULL, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GPBGeneratedCodeInfo class] + rootClass:[GPBDescriptorRoot class] + file:GPBDescriptorRoot_FileDescriptor() + fields:fields + fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) + oneofs:NULL + oneofCount:0 + enums:NULL + enumCount:0 + ranges:NULL + rangeCount:0 + storageSize:sizeof(GPBGeneratedCodeInfo__storage_) + wireFormat:NO]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + +#pragma mark - GPBGeneratedCodeInfo_Annotation + +@implementation GPBGeneratedCodeInfo_Annotation + +@dynamic pathArray, pathArray_Count; +@dynamic hasSourceFile, sourceFile; +@dynamic hasBegin, begin; +@dynamic hasEnd, end; + +typedef struct GPBGeneratedCodeInfo_Annotation__storage_ { + uint32_t _has_storage_[1]; + int32_t begin; + int32_t end; + GPBInt32Array *pathArray; + NSString *sourceFile; +} GPBGeneratedCodeInfo_Annotation__storage_; + +// This method is threadsafe because it is initially called +// in +initialize for each subclass. ++ (GPBDescriptor *)descriptor { + static GPBDescriptor *descriptor = nil; + if (!descriptor) { + static GPBMessageFieldDescription fields[] = { + { + .name = "pathArray", + .number = GPBGeneratedCodeInfo_Annotation_FieldNumber_PathArray, + .hasIndex = GPBNoHasBit, + .flags = GPBFieldRepeated | GPBFieldPacked, + .dataType = GPBDataTypeInt32, + .offset = offsetof(GPBGeneratedCodeInfo_Annotation__storage_, pathArray), + .defaultValue.valueMessage = nil, + .dataTypeSpecific.className = NULL, + #if GPBOBJC_INCLUDE_FIELD_OPTIONS + .fieldOptions = "\000\000\000\002\020\001", + #else + .fieldOptions = NULL, + #endif // GPBOBJC_INCLUDE_FIELD_OPTIONS + }, + { + .name = "sourceFile", + .number = GPBGeneratedCodeInfo_Annotation_FieldNumber_SourceFile, + .hasIndex = 1, + .flags = GPBFieldOptional, + .dataType = GPBDataTypeString, + .offset = offsetof(GPBGeneratedCodeInfo_Annotation__storage_, sourceFile), + .defaultValue.valueString = nil, + .dataTypeSpecific.className = NULL, + .fieldOptions = NULL, + }, + { + .name = "begin", + .number = GPBGeneratedCodeInfo_Annotation_FieldNumber_Begin, + .hasIndex = 2, + .flags = GPBFieldOptional, + .dataType = GPBDataTypeInt32, + .offset = offsetof(GPBGeneratedCodeInfo_Annotation__storage_, begin), + .defaultValue.valueInt32 = 0, + .dataTypeSpecific.className = NULL, + .fieldOptions = NULL, + }, + { + .name = "end", + .number = GPBGeneratedCodeInfo_Annotation_FieldNumber_End, + .hasIndex = 3, + .flags = GPBFieldOptional, + .dataType = GPBDataTypeInt32, + .offset = offsetof(GPBGeneratedCodeInfo_Annotation__storage_, end), + .defaultValue.valueInt32 = 0, + .dataTypeSpecific.className = NULL, + .fieldOptions = NULL, + }, + }; + GPBDescriptor *localDescriptor = + [GPBDescriptor allocDescriptorForClass:[GPBGeneratedCodeInfo_Annotation class] + rootClass:[GPBDescriptorRoot class] + file:GPBDescriptorRoot_FileDescriptor() + fields:fields + fieldCount:sizeof(fields) / sizeof(GPBMessageFieldDescription) + oneofs:NULL + oneofCount:0 + enums:NULL + enumCount:0 + ranges:NULL + rangeCount:0 + storageSize:sizeof(GPBGeneratedCodeInfo_Annotation__storage_) + wireFormat:NO]; + NSAssert(descriptor == nil, @"Startup recursed!"); + descriptor = localDescriptor; + } + return descriptor; +} + +@end + // @@protoc_insertion_point(global_scope) diff --git a/src/Makefile.am b/src/Makefile.am index 462eb3e1..073673a5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -342,6 +342,8 @@ libprotoc_la_SOURCES = \ google/protobuf/compiler/java/java_enum_lite.h \ google/protobuf/compiler/java/java_extension.cc \ google/protobuf/compiler/java/java_extension.h \ + google/protobuf/compiler/java/java_extension_lite.cc \ + google/protobuf/compiler/java/java_extension_lite.h \ google/protobuf/compiler/java/java_field.cc \ google/protobuf/compiler/java/java_field.h \ google/protobuf/compiler/java/java_file.cc \ @@ -727,6 +729,7 @@ protobuf_test_SOURCES = \ google/protobuf/compiler/cpp/cpp_unittest.h \ google/protobuf/compiler/cpp/cpp_unittest.cc \ google/protobuf/compiler/cpp/cpp_plugin_unittest.cc \ + google/protobuf/compiler/cpp/metadata_test.cc \ google/protobuf/compiler/java/java_plugin_unittest.cc \ google/protobuf/compiler/java/java_doc_comment_unittest.cc \ google/protobuf/compiler/objectivec/objectivec_helpers_unittest.cc \ diff --git a/src/google/protobuf/compiler/cpp/metadata_test.cc b/src/google/protobuf/compiler/cpp/metadata_test.cc new file mode 100644 index 00000000..422eb73b --- /dev/null +++ b/src/google/protobuf/compiler/cpp/metadata_test.cc @@ -0,0 +1,58 @@ +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +#include +#ifndef _SHARED_PTR_H +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +namespace google { +namespace protobuf { +namespace compiler { +namespace cpp { +namespace { + +} // namespace +} // namespace cpp +} // namespace compiler +} // namespace protobuf +} // namespace google diff --git a/src/google/protobuf/compiler/java/java_extension_lite.cc b/src/google/protobuf/compiler/java/java_extension_lite.cc new file mode 100644 index 00000000..e69de29b diff --git a/src/google/protobuf/compiler/java/java_extension_lite.h b/src/google/protobuf/compiler/java/java_extension_lite.h new file mode 100644 index 00000000..e69de29b diff --git a/src/google/protobuf/descriptor.pb.cc b/src/google/protobuf/descriptor.pb.cc index eda6280f..ff0cfcf8 100644 --- a/src/google/protobuf/descriptor.pb.cc +++ b/src/google/protobuf/descriptor.pb.cc @@ -93,6 +93,12 @@ const ::google::protobuf::internal::GeneratedMessageReflection* const ::google::protobuf::Descriptor* SourceCodeInfo_Location_descriptor_ = NULL; const ::google::protobuf::internal::GeneratedMessageReflection* SourceCodeInfo_Location_reflection_ = NULL; +const ::google::protobuf::Descriptor* GeneratedCodeInfo_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + GeneratedCodeInfo_reflection_ = NULL; +const ::google::protobuf::Descriptor* GeneratedCodeInfo_Annotation_descriptor_ = NULL; +const ::google::protobuf::internal::GeneratedMessageReflection* + GeneratedCodeInfo_Annotation_reflection_ = NULL; } // namespace @@ -521,6 +527,39 @@ void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto() { sizeof(SourceCodeInfo_Location), GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SourceCodeInfo_Location, _internal_metadata_), -1); + GeneratedCodeInfo_descriptor_ = file->message_type(18); + static const int GeneratedCodeInfo_offsets_[1] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, annotation_), + }; + GeneratedCodeInfo_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + GeneratedCodeInfo_descriptor_, + GeneratedCodeInfo::default_instance_, + GeneratedCodeInfo_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, _has_bits_[0]), + -1, + -1, + sizeof(GeneratedCodeInfo), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo, _internal_metadata_), + -1); + GeneratedCodeInfo_Annotation_descriptor_ = GeneratedCodeInfo_descriptor_->nested_type(0); + static const int GeneratedCodeInfo_Annotation_offsets_[4] = { + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, path_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, source_file_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, begin_), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, end_), + }; + GeneratedCodeInfo_Annotation_reflection_ = + ::google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection( + GeneratedCodeInfo_Annotation_descriptor_, + GeneratedCodeInfo_Annotation::default_instance_, + GeneratedCodeInfo_Annotation_offsets_, + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _has_bits_[0]), + -1, + -1, + sizeof(GeneratedCodeInfo_Annotation), + GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(GeneratedCodeInfo_Annotation, _internal_metadata_), + -1); } namespace { @@ -577,6 +616,10 @@ void protobuf_RegisterTypes(const ::std::string&) { SourceCodeInfo_descriptor_, &SourceCodeInfo::default_instance()); ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( SourceCodeInfo_Location_descriptor_, &SourceCodeInfo_Location::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + GeneratedCodeInfo_descriptor_, &GeneratedCodeInfo::default_instance()); + ::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage( + GeneratedCodeInfo_Annotation_descriptor_, &GeneratedCodeInfo_Annotation::default_instance()); } } // namespace @@ -626,6 +669,10 @@ void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto() { delete SourceCodeInfo_reflection_; delete SourceCodeInfo_Location::default_instance_; delete SourceCodeInfo_Location_reflection_; + delete GeneratedCodeInfo::default_instance_; + delete GeneratedCodeInfo_reflection_; + delete GeneratedCodeInfo_Annotation::default_instance_; + delete GeneratedCodeInfo_Annotation_reflection_; } void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { @@ -699,7 +746,7 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { "_type\030\003 \001(\t\022/\n\007options\030\004 \001(\0132\036.google.pr" "otobuf.MethodOptions\022\037\n\020client_streaming" "\030\005 \001(\010:\005false\022\037\n\020server_streaming\030\006 \001(\010:" - "\005false\"\252\005\n\013FileOptions\022\024\n\014java_package\030\001" + "\005false\"\256\005\n\013FileOptions\022\024\n\014java_package\030\001" " \001(\t\022\034\n\024java_outer_classname\030\010 \001(\t\022\"\n\023ja" "va_multiple_files\030\n \001(\010:\005false\022,\n\035java_g" "enerate_equals_and_hash\030\024 \001(\010:\005false\022%\n\026" @@ -711,56 +758,60 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { "e\022\"\n\023py_generic_services\030\022 \001(\010:\005false\022\031\n" "\ndeprecated\030\027 \001(\010:\005false\022\037\n\020cc_enable_ar" "enas\030\037 \001(\010:\005false\022\031\n\021objc_class_prefix\030$" - " \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022\'\n\037javana" - "no_use_deprecated_package\030& \001(\010\022C\n\024unint" - "erpreted_option\030\347\007 \003(\0132$.google.protobuf" - ".UninterpretedOption\":\n\014OptimizeMode\022\t\n\005" - "SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTIME\020\003" - "*\t\010\350\007\020\200\200\200\200\002\"\346\001\n\016MessageOptions\022&\n\027messag" - "e_set_wire_format\030\001 \001(\010:\005false\022.\n\037no_sta" - "ndard_descriptor_accessor\030\002 \001(\010:\005false\022\031" - "\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_entry\030\007" - " \001(\010\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.go" - "ogle.protobuf.UninterpretedOption*\t\010\350\007\020\200" - "\200\200\200\002\"\230\003\n\014FieldOptions\022:\n\005ctype\030\001 \001(\0162#.g" - "oogle.protobuf.FieldOptions.CType:\006STRIN" - "G\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype\030\006 \001(\0162$.goog" - "le.protobuf.FieldOptions.JSType:\tJS_NORM" - "AL\022\023\n\004lazy\030\005 \001(\010:\005false\022\031\n\ndeprecated\030\003 " - "\001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005false\022C\n\024unint" - "erpreted_option\030\347\007 \003(\0132$.google.protobuf" - ".UninterpretedOption\"/\n\005CType\022\n\n\006STRING\020" - "\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE\020\002\"5\n\006JSType\022" - "\r\n\tJS_NORMAL\020\000\022\r\n\tJS_STRING\020\001\022\r\n\tJS_NUMB" - "ER\020\002*\t\010\350\007\020\200\200\200\200\002\"\215\001\n\013EnumOptions\022\023\n\013allow" - "_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005false\022" - "C\n\024uninterpreted_option\030\347\007 \003(\0132$.google." - "protobuf.UninterpretedOption*\t\010\350\007\020\200\200\200\200\002\"" - "}\n\020EnumValueOptions\022\031\n\ndeprecated\030\001 \001(\010:" - "\005false\022C\n\024uninterpreted_option\030\347\007 \003(\0132$." - "google.protobuf.UninterpretedOption*\t\010\350\007" - "\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecated\030!" - " \001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003" - "(\0132$.google.protobuf.UninterpretedOption" - "*\t\010\350\007\020\200\200\200\200\002\"z\n\rMethodOptions\022\031\n\ndeprecat" + " \001(\t\022\030\n\020csharp_namespace\030% \001(\t\022+\n\037javana" + "no_use_deprecated_package\030& \001(\010B\002\030\001\022C\n\024u" + "ninterpreted_option\030\347\007 \003(\0132$.google.prot" + "obuf.UninterpretedOption\":\n\014OptimizeMode" + "\022\t\n\005SPEED\020\001\022\r\n\tCODE_SIZE\020\002\022\020\n\014LITE_RUNTI" + "ME\020\003*\t\010\350\007\020\200\200\200\200\002\"\346\001\n\016MessageOptions\022&\n\027me" + "ssage_set_wire_format\030\001 \001(\010:\005false\022.\n\037no" + "_standard_descriptor_accessor\030\002 \001(\010:\005fal" + "se\022\031\n\ndeprecated\030\003 \001(\010:\005false\022\021\n\tmap_ent" + "ry\030\007 \001(\010\022C\n\024uninterpreted_option\030\347\007 \003(\0132" + "$.google.protobuf.UninterpretedOption*\t\010" + "\350\007\020\200\200\200\200\002\"\230\003\n\014FieldOptions\022:\n\005ctype\030\001 \001(\016" + "2#.google.protobuf.FieldOptions.CType:\006S" + "TRING\022\016\n\006packed\030\002 \001(\010\022\?\n\006jstype\030\006 \001(\0162$." + "google.protobuf.FieldOptions.JSType:\tJS_" + "NORMAL\022\023\n\004lazy\030\005 \001(\010:\005false\022\031\n\ndeprecate" + "d\030\003 \001(\010:\005false\022\023\n\004weak\030\n \001(\010:\005false\022C\n\024u" + "ninterpreted_option\030\347\007 \003(\0132$.google.prot" + "obuf.UninterpretedOption\"/\n\005CType\022\n\n\006STR" + "ING\020\000\022\010\n\004CORD\020\001\022\020\n\014STRING_PIECE\020\002\"5\n\006JST" + "ype\022\r\n\tJS_NORMAL\020\000\022\r\n\tJS_STRING\020\001\022\r\n\tJS_" + "NUMBER\020\002*\t\010\350\007\020\200\200\200\200\002\"\215\001\n\013EnumOptions\022\023\n\013a" + "llow_alias\030\002 \001(\010\022\031\n\ndeprecated\030\003 \001(\010:\005fa" + "lse\022C\n\024uninterpreted_option\030\347\007 \003(\0132$.goo" + "gle.protobuf.UninterpretedOption*\t\010\350\007\020\200\200" + "\200\200\002\"}\n\020EnumValueOptions\022\031\n\ndeprecated\030\001 " + "\001(\010:\005false\022C\n\024uninterpreted_option\030\347\007 \003(" + "\0132$.google.protobuf.UninterpretedOption*" + "\t\010\350\007\020\200\200\200\200\002\"{\n\016ServiceOptions\022\031\n\ndeprecat" "ed\030! \001(\010:\005false\022C\n\024uninterpreted_option\030" "\347\007 \003(\0132$.google.protobuf.UninterpretedOp" - "tion*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023UninterpretedOption\022" - ";\n\004name\030\002 \003(\0132-.google.protobuf.Uninterp" - "retedOption.NamePart\022\030\n\020identifier_value" - "\030\003 \001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032\n\022ne" - "gative_int_value\030\005 \001(\003\022\024\n\014double_value\030\006" - " \001(\001\022\024\n\014string_value\030\007 \001(\014\022\027\n\017aggregate_" - "value\030\010 \001(\t\0323\n\010NamePart\022\021\n\tname_part\030\001 \002" - "(\t\022\024\n\014is_extension\030\002 \002(\010\"\325\001\n\016SourceCodeI" - "nfo\022:\n\010location\030\001 \003(\0132(.google.protobuf." - "SourceCodeInfo.Location\032\206\001\n\010Location\022\020\n\004" - "path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020lead" - "ing_comments\030\003 \001(\t\022\031\n\021trailing_comments\030" - "\004 \001(\t\022!\n\031leading_detached_comments\030\006 \003(\t" - "BX\n\023com.google.protobufB\020DescriptorProto" - "sH\001Z\ndescriptor\242\002\003GPB\252\002\032Google.Protobuf." - "Reflection", 5010); + "tion*\t\010\350\007\020\200\200\200\200\002\"z\n\rMethodOptions\022\031\n\ndepr" + "ecated\030! \001(\010:\005false\022C\n\024uninterpreted_opt" + "ion\030\347\007 \003(\0132$.google.protobuf.Uninterpret" + "edOption*\t\010\350\007\020\200\200\200\200\002\"\236\002\n\023UninterpretedOpt" + "ion\022;\n\004name\030\002 \003(\0132-.google.protobuf.Unin" + "terpretedOption.NamePart\022\030\n\020identifier_v" + "alue\030\003 \001(\t\022\032\n\022positive_int_value\030\004 \001(\004\022\032" + "\n\022negative_int_value\030\005 \001(\003\022\024\n\014double_val" + "ue\030\006 \001(\001\022\024\n\014string_value\030\007 \001(\014\022\027\n\017aggreg" + "ate_value\030\010 \001(\t\0323\n\010NamePart\022\021\n\tname_part" + "\030\001 \002(\t\022\024\n\014is_extension\030\002 \002(\010\"\325\001\n\016SourceC" + "odeInfo\022:\n\010location\030\001 \003(\0132(.google.proto" + "buf.SourceCodeInfo.Location\032\206\001\n\010Location" + "\022\020\n\004path\030\001 \003(\005B\002\020\001\022\020\n\004span\030\002 \003(\005B\002\020\001\022\030\n\020" + "leading_comments\030\003 \001(\t\022\031\n\021trailing_comme" + "nts\030\004 \001(\t\022!\n\031leading_detached_comments\030\006" + " \003(\t\"\247\001\n\021GeneratedCodeInfo\022A\n\nannotation" + "\030\001 \003(\0132-.google.protobuf.GeneratedCodeIn" + "fo.Annotation\032O\n\nAnnotation\022\020\n\004path\030\001 \003(" + "\005B\002\020\001\022\023\n\013source_file\030\002 \001(\t\022\r\n\005begin\030\003 \001(" + "\005\022\013\n\003end\030\004 \001(\005BX\n\023com.google.protobufB\020D" + "escriptorProtosH\001Z\ndescriptor\242\002\003GPB\252\002\032Go" + "ogle.Protobuf.Reflection", 5184); ::google::protobuf::MessageFactory::InternalRegisterGeneratedFile( "google/protobuf/descriptor.proto", &protobuf_RegisterTypes); FileDescriptorSet::default_instance_ = new FileDescriptorSet(); @@ -785,6 +836,8 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { UninterpretedOption_NamePart::default_instance_ = new UninterpretedOption_NamePart(); SourceCodeInfo::default_instance_ = new SourceCodeInfo(); SourceCodeInfo_Location::default_instance_ = new SourceCodeInfo_Location(); + GeneratedCodeInfo::default_instance_ = new GeneratedCodeInfo(); + GeneratedCodeInfo_Annotation::default_instance_ = new GeneratedCodeInfo_Annotation(); FileDescriptorSet::default_instance_->InitAsDefaultInstance(); FileDescriptorProto::default_instance_->InitAsDefaultInstance(); DescriptorProto::default_instance_->InitAsDefaultInstance(); @@ -807,6 +860,8 @@ void protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto() { UninterpretedOption_NamePart::default_instance_->InitAsDefaultInstance(); SourceCodeInfo::default_instance_->InitAsDefaultInstance(); SourceCodeInfo_Location::default_instance_->InitAsDefaultInstance(); + GeneratedCodeInfo::default_instance_->InitAsDefaultInstance(); + GeneratedCodeInfo_Annotation::default_instance_->InitAsDefaultInstance(); ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto); } @@ -8074,7 +8129,7 @@ bool FileOptions::MergePartialFromCodedStream( break; } - // optional bool javanano_use_deprecated_package = 38; + // optional bool javanano_use_deprecated_package = 38 [deprecated = true]; case 38: { if (tag == 304) { parse_javanano_use_deprecated_package: @@ -8232,7 +8287,7 @@ void FileOptions::SerializeWithCachedSizes( 37, this->csharp_namespace(), output); } - // optional bool javanano_use_deprecated_package = 38; + // optional bool javanano_use_deprecated_package = 38 [deprecated = true]; if (has_javanano_use_deprecated_package()) { ::google::protobuf::internal::WireFormatLite::WriteBool(38, this->javanano_use_deprecated_package(), output); } @@ -8358,7 +8413,7 @@ void FileOptions::SerializeWithCachedSizes( 37, this->csharp_namespace(), target); } - // optional bool javanano_use_deprecated_package = 38; + // optional bool javanano_use_deprecated_package = 38 [deprecated = true]; if (has_javanano_use_deprecated_package()) { target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(38, this->javanano_use_deprecated_package(), target); } @@ -8469,7 +8524,7 @@ int FileOptions::ByteSize() const { this->csharp_namespace()); } - // optional bool javanano_use_deprecated_package = 38; + // optional bool javanano_use_deprecated_package = 38 [deprecated = true]; if (has_javanano_use_deprecated_package()) { total_size += 2 + 1; } @@ -9110,7 +9165,7 @@ void FileOptions::clear_csharp_namespace() { // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace) } -// optional bool javanano_use_deprecated_package = 38; +// optional bool javanano_use_deprecated_package = 38 [deprecated = true]; bool FileOptions::has_javanano_use_deprecated_package() const { return (_has_bits_[0] & 0x00004000u) != 0; } @@ -14057,6 +14112,812 @@ SourceCodeInfo::location() const { #endif // PROTOBUF_INLINE_NOT_IN_HEADERS +// =================================================================== + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int GeneratedCodeInfo_Annotation::kPathFieldNumber; +const int GeneratedCodeInfo_Annotation::kSourceFileFieldNumber; +const int GeneratedCodeInfo_Annotation::kBeginFieldNumber; +const int GeneratedCodeInfo_Annotation::kEndFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.GeneratedCodeInfo.Annotation) +} + +void GeneratedCodeInfo_Annotation::InitAsDefaultInstance() { +} + +GeneratedCodeInfo_Annotation::GeneratedCodeInfo_Annotation(const GeneratedCodeInfo_Annotation& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo.Annotation) +} + +void GeneratedCodeInfo_Annotation::SharedCtor() { + ::google::protobuf::internal::GetEmptyString(); + _cached_size_ = 0; + source_file_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + begin_ = 0; + end_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +GeneratedCodeInfo_Annotation::~GeneratedCodeInfo_Annotation() { + // @@protoc_insertion_point(destructor:google.protobuf.GeneratedCodeInfo.Annotation) + SharedDtor(); +} + +void GeneratedCodeInfo_Annotation::SharedDtor() { + source_file_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + if (this != default_instance_) { + } +} + +void GeneratedCodeInfo_Annotation::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* GeneratedCodeInfo_Annotation::descriptor() { + protobuf_AssignDescriptorsOnce(); + return GeneratedCodeInfo_Annotation_descriptor_; +} + +const GeneratedCodeInfo_Annotation& GeneratedCodeInfo_Annotation::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; +} + +GeneratedCodeInfo_Annotation* GeneratedCodeInfo_Annotation::default_instance_ = NULL; + +GeneratedCodeInfo_Annotation* GeneratedCodeInfo_Annotation::New(::google::protobuf::Arena* arena) const { + GeneratedCodeInfo_Annotation* n = new GeneratedCodeInfo_Annotation; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void GeneratedCodeInfo_Annotation::Clear() { +#define ZR_HELPER_(f) reinterpret_cast(\ + &reinterpret_cast(16)->f) + +#define ZR_(first, last) do {\ + ::memset(&first, 0,\ + ZR_HELPER_(last) - ZR_HELPER_(first) + sizeof(last));\ +} while (0) + + if (_has_bits_[0 / 32] & 14u) { + ZR_(begin_, end_); + if (has_source_file()) { + source_file_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + } + } + +#undef ZR_HELPER_ +#undef ZR_ + + path_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + if (_internal_metadata_.have_unknown_fields()) { + mutable_unknown_fields()->Clear(); + } +} + +bool GeneratedCodeInfo_Annotation::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.GeneratedCodeInfo.Annotation) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated int32 path = 1 [packed = true]; + case 1: { + if (tag == 10) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, this->mutable_path()))); + } else if (tag == 8) { + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitiveNoInline< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + 1, 10, input, this->mutable_path()))); + } else { + goto handle_unusual; + } + if (input->ExpectTag(18)) goto parse_source_file; + break; + } + + // optional string source_file = 2; + case 2: { + if (tag == 18) { + parse_source_file: + DO_(::google::protobuf::internal::WireFormatLite::ReadString( + input, this->mutable_source_file())); + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->source_file().data(), this->source_file().length(), + ::google::protobuf::internal::WireFormat::PARSE, + "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); + } else { + goto handle_unusual; + } + if (input->ExpectTag(24)) goto parse_begin; + break; + } + + // optional int32 begin = 3; + case 3: { + if (tag == 24) { + parse_begin: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &begin_))); + set_has_begin(); + } else { + goto handle_unusual; + } + if (input->ExpectTag(32)) goto parse_end; + break; + } + + // optional int32 end = 4; + case 4: { + if (tag == 32) { + parse_end: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &end_))); + set_has_end(); + } else { + goto handle_unusual; + } + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.GeneratedCodeInfo.Annotation) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.GeneratedCodeInfo.Annotation) + return false; +#undef DO_ +} + +void GeneratedCodeInfo_Annotation::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.GeneratedCodeInfo.Annotation) + // repeated int32 path = 1 [packed = true]; + if (this->path_size() > 0) { + ::google::protobuf::internal::WireFormatLite::WriteTag(1, ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, output); + output->WriteVarint32(_path_cached_byte_size_); + } + for (int i = 0; i < this->path_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteInt32NoTag( + this->path(i), output); + } + + // optional string source_file = 2; + if (has_source_file()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->source_file().data(), this->source_file().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); + ::google::protobuf::internal::WireFormatLite::WriteStringMaybeAliased( + 2, this->source_file(), output); + } + + // optional int32 begin = 3; + if (has_begin()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->begin(), output); + } + + // optional int32 end = 4; + if (has_end()) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(4, this->end(), output); + } + + if (_internal_metadata_.have_unknown_fields()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } + // @@protoc_insertion_point(serialize_end:google.protobuf.GeneratedCodeInfo.Annotation) +} + +::google::protobuf::uint8* GeneratedCodeInfo_Annotation::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo.Annotation) + // repeated int32 path = 1 [packed = true]; + if (this->path_size() > 0) { + target = ::google::protobuf::internal::WireFormatLite::WriteTagToArray( + 1, + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED, + target); + target = ::google::protobuf::io::CodedOutputStream::WriteVarint32ToArray( + _path_cached_byte_size_, target); + } + for (int i = 0; i < this->path_size(); i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteInt32NoTagToArray(this->path(i), target); + } + + // optional string source_file = 2; + if (has_source_file()) { + ::google::protobuf::internal::WireFormat::VerifyUTF8StringNamedField( + this->source_file().data(), this->source_file().length(), + ::google::protobuf::internal::WireFormat::SERIALIZE, + "google.protobuf.GeneratedCodeInfo.Annotation.source_file"); + target = + ::google::protobuf::internal::WireFormatLite::WriteStringToArray( + 2, this->source_file(), target); + } + + // optional int32 begin = 3; + if (has_begin()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(3, this->begin(), target); + } + + // optional int32 end = 4; + if (has_end()) { + target = ::google::protobuf::internal::WireFormatLite::WriteInt32ToArray(4, this->end(), target); + } + + if (_internal_metadata_.have_unknown_fields()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.GeneratedCodeInfo.Annotation) + return target; +} + +int GeneratedCodeInfo_Annotation::ByteSize() const { + int total_size = 0; + + if (_has_bits_[1 / 32] & 14u) { + // optional string source_file = 2; + if (has_source_file()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::StringSize( + this->source_file()); + } + + // optional int32 begin = 3; + if (has_begin()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->begin()); + } + + // optional int32 end = 4; + if (has_end()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->end()); + } + + } + // repeated int32 path = 1 [packed = true]; + { + int data_size = 0; + for (int i = 0; i < this->path_size(); i++) { + data_size += ::google::protobuf::internal::WireFormatLite:: + Int32Size(this->path(i)); + } + if (data_size > 0) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size(data_size); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _path_cached_byte_size_ = data_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + total_size += data_size; + } + + if (_internal_metadata_.have_unknown_fields()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void GeneratedCodeInfo_Annotation::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const GeneratedCodeInfo_Annotation* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void GeneratedCodeInfo_Annotation::MergeFrom(const GeneratedCodeInfo_Annotation& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + path_.MergeFrom(from.path_); + if (from._has_bits_[1 / 32] & (0xffu << (1 % 32))) { + if (from.has_source_file()) { + set_has_source_file(); + source_file_.AssignWithDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), from.source_file_); + } + if (from.has_begin()) { + set_begin(from.begin()); + } + if (from.has_end()) { + set_end(from.end()); + } + } + if (from._internal_metadata_.have_unknown_fields()) { + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); + } +} + +void GeneratedCodeInfo_Annotation::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void GeneratedCodeInfo_Annotation::CopyFrom(const GeneratedCodeInfo_Annotation& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GeneratedCodeInfo_Annotation::IsInitialized() const { + + return true; +} + +void GeneratedCodeInfo_Annotation::Swap(GeneratedCodeInfo_Annotation* other) { + if (other == this) return; + InternalSwap(other); +} +void GeneratedCodeInfo_Annotation::InternalSwap(GeneratedCodeInfo_Annotation* other) { + path_.UnsafeArenaSwap(&other->path_); + source_file_.Swap(&other->source_file_); + std::swap(begin_, other->begin_); + std::swap(end_, other->end_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata GeneratedCodeInfo_Annotation::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = GeneratedCodeInfo_Annotation_descriptor_; + metadata.reflection = GeneratedCodeInfo_Annotation_reflection_; + return metadata; +} + + +// ------------------------------------------------------------------- + +#if !defined(_MSC_VER) || _MSC_VER >= 1900 +const int GeneratedCodeInfo::kAnnotationFieldNumber; +#endif // !defined(_MSC_VER) || _MSC_VER >= 1900 + +GeneratedCodeInfo::GeneratedCodeInfo() + : ::google::protobuf::Message(), _internal_metadata_(NULL) { + SharedCtor(); + // @@protoc_insertion_point(constructor:google.protobuf.GeneratedCodeInfo) +} + +void GeneratedCodeInfo::InitAsDefaultInstance() { +} + +GeneratedCodeInfo::GeneratedCodeInfo(const GeneratedCodeInfo& from) + : ::google::protobuf::Message(), + _internal_metadata_(NULL) { + SharedCtor(); + MergeFrom(from); + // @@protoc_insertion_point(copy_constructor:google.protobuf.GeneratedCodeInfo) +} + +void GeneratedCodeInfo::SharedCtor() { + _cached_size_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +GeneratedCodeInfo::~GeneratedCodeInfo() { + // @@protoc_insertion_point(destructor:google.protobuf.GeneratedCodeInfo) + SharedDtor(); +} + +void GeneratedCodeInfo::SharedDtor() { + if (this != default_instance_) { + } +} + +void GeneratedCodeInfo::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const ::google::protobuf::Descriptor* GeneratedCodeInfo::descriptor() { + protobuf_AssignDescriptorsOnce(); + return GeneratedCodeInfo_descriptor_; +} + +const GeneratedCodeInfo& GeneratedCodeInfo::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + return *default_instance_; +} + +GeneratedCodeInfo* GeneratedCodeInfo::default_instance_ = NULL; + +GeneratedCodeInfo* GeneratedCodeInfo::New(::google::protobuf::Arena* arena) const { + GeneratedCodeInfo* n = new GeneratedCodeInfo; + if (arena != NULL) { + arena->Own(n); + } + return n; +} + +void GeneratedCodeInfo::Clear() { + annotation_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); + if (_internal_metadata_.have_unknown_fields()) { + mutable_unknown_fields()->Clear(); + } +} + +bool GeneratedCodeInfo::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure + ::google::protobuf::uint32 tag; + // @@protoc_insertion_point(parse_start:google.protobuf.GeneratedCodeInfo) + for (;;) { + ::std::pair< ::google::protobuf::uint32, bool> p = input->ReadTagWithCutoff(127); + tag = p.first; + if (!p.second) goto handle_unusual; + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + case 1: { + if (tag == 10) { + DO_(input->IncrementRecursionDepth()); + parse_loop_annotation: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtualNoRecursionDepth( + input, add_annotation())); + } else { + goto handle_unusual; + } + if (input->ExpectTag(10)) goto parse_loop_annotation; + input->UnsafeDecrementRecursionDepth(); + if (input->ExpectAtEnd()) goto success; + break; + } + + default: { + handle_unusual: + if (tag == 0 || + ::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + goto success; + } + DO_(::google::protobuf::internal::WireFormat::SkipField( + input, tag, mutable_unknown_fields())); + break; + } + } + } +success: + // @@protoc_insertion_point(parse_success:google.protobuf.GeneratedCodeInfo) + return true; +failure: + // @@protoc_insertion_point(parse_failure:google.protobuf.GeneratedCodeInfo) + return false; +#undef DO_ +} + +void GeneratedCodeInfo::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // @@protoc_insertion_point(serialize_start:google.protobuf.GeneratedCodeInfo) + // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + for (unsigned int i = 0, n = this->annotation_size(); i < n; i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray( + 1, this->annotation(i), output); + } + + if (_internal_metadata_.have_unknown_fields()) { + ::google::protobuf::internal::WireFormat::SerializeUnknownFields( + unknown_fields(), output); + } + // @@protoc_insertion_point(serialize_end:google.protobuf.GeneratedCodeInfo) +} + +::google::protobuf::uint8* GeneratedCodeInfo::SerializeWithCachedSizesToArray( + ::google::protobuf::uint8* target) const { + // @@protoc_insertion_point(serialize_to_array_start:google.protobuf.GeneratedCodeInfo) + // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + for (unsigned int i = 0, n = this->annotation_size(); i < n; i++) { + target = ::google::protobuf::internal::WireFormatLite:: + WriteMessageNoVirtualToArray( + 1, this->annotation(i), target); + } + + if (_internal_metadata_.have_unknown_fields()) { + target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray( + unknown_fields(), target); + } + // @@protoc_insertion_point(serialize_to_array_end:google.protobuf.GeneratedCodeInfo) + return target; +} + +int GeneratedCodeInfo::ByteSize() const { + int total_size = 0; + + // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + total_size += 1 * this->annotation_size(); + for (int i = 0; i < this->annotation_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->annotation(i)); + } + + if (_internal_metadata_.have_unknown_fields()) { + total_size += + ::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize( + unknown_fields()); + } + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void GeneratedCodeInfo::MergeFrom(const ::google::protobuf::Message& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + const GeneratedCodeInfo* source = + ::google::protobuf::internal::DynamicCastToGenerated( + &from); + if (source == NULL) { + ::google::protobuf::internal::ReflectionOps::Merge(from, this); + } else { + MergeFrom(*source); + } +} + +void GeneratedCodeInfo::MergeFrom(const GeneratedCodeInfo& from) { + if (GOOGLE_PREDICT_FALSE(&from == this)) MergeFromFail(__LINE__); + annotation_.MergeFrom(from.annotation_); + if (from._internal_metadata_.have_unknown_fields()) { + mutable_unknown_fields()->MergeFrom(from.unknown_fields()); + } +} + +void GeneratedCodeInfo::CopyFrom(const ::google::protobuf::Message& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +void GeneratedCodeInfo::CopyFrom(const GeneratedCodeInfo& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GeneratedCodeInfo::IsInitialized() const { + + return true; +} + +void GeneratedCodeInfo::Swap(GeneratedCodeInfo* other) { + if (other == this) return; + InternalSwap(other); +} +void GeneratedCodeInfo::InternalSwap(GeneratedCodeInfo* other) { + annotation_.UnsafeArenaSwap(&other->annotation_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + _internal_metadata_.Swap(&other->_internal_metadata_); + std::swap(_cached_size_, other->_cached_size_); +} + +::google::protobuf::Metadata GeneratedCodeInfo::GetMetadata() const { + protobuf_AssignDescriptorsOnce(); + ::google::protobuf::Metadata metadata; + metadata.descriptor = GeneratedCodeInfo_descriptor_; + metadata.reflection = GeneratedCodeInfo_reflection_; + return metadata; +} + +#if PROTOBUF_INLINE_NOT_IN_HEADERS +// GeneratedCodeInfo_Annotation + +// repeated int32 path = 1 [packed = true]; +int GeneratedCodeInfo_Annotation::path_size() const { + return path_.size(); +} +void GeneratedCodeInfo_Annotation::clear_path() { + path_.Clear(); +} + ::google::protobuf::int32 GeneratedCodeInfo_Annotation::path(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.path) + return path_.Get(index); +} + void GeneratedCodeInfo_Annotation::set_path(int index, ::google::protobuf::int32 value) { + path_.Set(index, value); + // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.path) +} + void GeneratedCodeInfo_Annotation::add_path(::google::protobuf::int32 value) { + path_.Add(value); + // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.Annotation.path) +} + const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& +GeneratedCodeInfo_Annotation::path() const { + // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.Annotation.path) + return path_; +} + ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* +GeneratedCodeInfo_Annotation::mutable_path() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.Annotation.path) + return &path_; +} + +// optional string source_file = 2; +bool GeneratedCodeInfo_Annotation::has_source_file() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +void GeneratedCodeInfo_Annotation::set_has_source_file() { + _has_bits_[0] |= 0x00000002u; +} +void GeneratedCodeInfo_Annotation::clear_has_source_file() { + _has_bits_[0] &= ~0x00000002u; +} +void GeneratedCodeInfo_Annotation::clear_source_file() { + source_file_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_source_file(); +} + const ::std::string& GeneratedCodeInfo_Annotation::source_file() const { + // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.source_file) + return source_file_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void GeneratedCodeInfo_Annotation::set_source_file(const ::std::string& value) { + set_has_source_file(); + source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file) +} + void GeneratedCodeInfo_Annotation::set_source_file(const char* value) { + set_has_source_file(); + source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.GeneratedCodeInfo.Annotation.source_file) +} + void GeneratedCodeInfo_Annotation::set_source_file(const char* value, size_t size) { + set_has_source_file(); + source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.GeneratedCodeInfo.Annotation.source_file) +} + ::std::string* GeneratedCodeInfo_Annotation::mutable_source_file() { + set_has_source_file(); + // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.Annotation.source_file) + return source_file_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + ::std::string* GeneratedCodeInfo_Annotation::release_source_file() { + clear_has_source_file(); + return source_file_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} + void GeneratedCodeInfo_Annotation::set_allocated_source_file(::std::string* source_file) { + if (source_file != NULL) { + set_has_source_file(); + } else { + clear_has_source_file(); + } + source_file_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), source_file); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file) +} + +// optional int32 begin = 3; +bool GeneratedCodeInfo_Annotation::has_begin() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +void GeneratedCodeInfo_Annotation::set_has_begin() { + _has_bits_[0] |= 0x00000004u; +} +void GeneratedCodeInfo_Annotation::clear_has_begin() { + _has_bits_[0] &= ~0x00000004u; +} +void GeneratedCodeInfo_Annotation::clear_begin() { + begin_ = 0; + clear_has_begin(); +} + ::google::protobuf::int32 GeneratedCodeInfo_Annotation::begin() const { + // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.begin) + return begin_; +} + void GeneratedCodeInfo_Annotation::set_begin(::google::protobuf::int32 value) { + set_has_begin(); + begin_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.begin) +} + +// optional int32 end = 4; +bool GeneratedCodeInfo_Annotation::has_end() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +void GeneratedCodeInfo_Annotation::set_has_end() { + _has_bits_[0] |= 0x00000008u; +} +void GeneratedCodeInfo_Annotation::clear_has_end() { + _has_bits_[0] &= ~0x00000008u; +} +void GeneratedCodeInfo_Annotation::clear_end() { + end_ = 0; + clear_has_end(); +} + ::google::protobuf::int32 GeneratedCodeInfo_Annotation::end() const { + // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.end) + return end_; +} + void GeneratedCodeInfo_Annotation::set_end(::google::protobuf::int32 value) { + set_has_end(); + end_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.end) +} + +// ------------------------------------------------------------------- + +// GeneratedCodeInfo + +// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; +int GeneratedCodeInfo::annotation_size() const { + return annotation_.size(); +} +void GeneratedCodeInfo::clear_annotation() { + annotation_.Clear(); +} +const ::google::protobuf::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::annotation(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.annotation) + return annotation_.Get(index); +} +::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::mutable_annotation(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.annotation) + return annotation_.Mutable(index); +} +::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() { + // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation) + return annotation_.Add(); +} +::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >* +GeneratedCodeInfo::mutable_annotation() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.annotation) + return &annotation_; +} +const ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >& +GeneratedCodeInfo::annotation() const { + // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.annotation) + return annotation_; +} + +#endif // PROTOBUF_INLINE_NOT_IN_HEADERS + // @@protoc_insertion_point(namespace_scope) } // namespace protobuf diff --git a/src/google/protobuf/descriptor.pb.h b/src/google/protobuf/descriptor.pb.h index 60255162..3fe07bf5 100644 --- a/src/google/protobuf/descriptor.pb.h +++ b/src/google/protobuf/descriptor.pb.h @@ -50,6 +50,8 @@ class FieldOptions; class FileDescriptorProto; class FileDescriptorSet; class FileOptions; +class GeneratedCodeInfo; +class GeneratedCodeInfo_Annotation; class MessageOptions; class MethodDescriptorProto; class MethodOptions; @@ -2015,12 +2017,12 @@ class LIBPROTOBUF_EXPORT FileOptions : public ::google::protobuf::Message { ::std::string* release_csharp_namespace(); void set_allocated_csharp_namespace(::std::string* csharp_namespace); - // optional bool javanano_use_deprecated_package = 38; - bool has_javanano_use_deprecated_package() const; - void clear_javanano_use_deprecated_package(); + // optional bool javanano_use_deprecated_package = 38 [deprecated = true]; + bool has_javanano_use_deprecated_package() const PROTOBUF_DEPRECATED; + void clear_javanano_use_deprecated_package() PROTOBUF_DEPRECATED; static const int kJavananoUseDeprecatedPackageFieldNumber = 38; - bool javanano_use_deprecated_package() const; - void set_javanano_use_deprecated_package(bool value); + bool javanano_use_deprecated_package() const PROTOBUF_DEPRECATED; + void set_javanano_use_deprecated_package(bool value) PROTOBUF_DEPRECATED; // repeated .google.protobuf.UninterpretedOption uninterpreted_option = 999; int uninterpreted_option_size() const; @@ -3390,6 +3392,228 @@ class LIBPROTOBUF_EXPORT SourceCodeInfo : public ::google::protobuf::Message { void InitAsDefaultInstance(); static SourceCodeInfo* default_instance_; }; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT GeneratedCodeInfo_Annotation : public ::google::protobuf::Message { + public: + GeneratedCodeInfo_Annotation(); + virtual ~GeneratedCodeInfo_Annotation(); + + GeneratedCodeInfo_Annotation(const GeneratedCodeInfo_Annotation& from); + + inline GeneratedCodeInfo_Annotation& operator=(const GeneratedCodeInfo_Annotation& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const GeneratedCodeInfo_Annotation& default_instance(); + + void Swap(GeneratedCodeInfo_Annotation* other); + + // implements Message ---------------------------------------------- + + inline GeneratedCodeInfo_Annotation* New() const { return New(NULL); } + + GeneratedCodeInfo_Annotation* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const GeneratedCodeInfo_Annotation& from); + void MergeFrom(const GeneratedCodeInfo_Annotation& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(GeneratedCodeInfo_Annotation* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // repeated int32 path = 1 [packed = true]; + int path_size() const; + void clear_path(); + static const int kPathFieldNumber = 1; + ::google::protobuf::int32 path(int index) const; + void set_path(int index, ::google::protobuf::int32 value); + void add_path(::google::protobuf::int32 value); + const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& + path() const; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* + mutable_path(); + + // optional string source_file = 2; + bool has_source_file() const; + void clear_source_file(); + static const int kSourceFileFieldNumber = 2; + const ::std::string& source_file() const; + void set_source_file(const ::std::string& value); + void set_source_file(const char* value); + void set_source_file(const char* value, size_t size); + ::std::string* mutable_source_file(); + ::std::string* release_source_file(); + void set_allocated_source_file(::std::string* source_file); + + // optional int32 begin = 3; + bool has_begin() const; + void clear_begin(); + static const int kBeginFieldNumber = 3; + ::google::protobuf::int32 begin() const; + void set_begin(::google::protobuf::int32 value); + + // optional int32 end = 4; + bool has_end() const; + void clear_end(); + static const int kEndFieldNumber = 4; + ::google::protobuf::int32 end() const; + void set_end(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:google.protobuf.GeneratedCodeInfo.Annotation) + private: + inline void set_has_source_file(); + inline void clear_has_source_file(); + inline void set_has_begin(); + inline void clear_has_begin(); + inline void set_has_end(); + inline void clear_has_end(); + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 > path_; + mutable int _path_cached_byte_size_; + ::google::protobuf::internal::ArenaStringPtr source_file_; + ::google::protobuf::int32 begin_; + ::google::protobuf::int32 end_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static GeneratedCodeInfo_Annotation* default_instance_; +}; +// ------------------------------------------------------------------- + +class LIBPROTOBUF_EXPORT GeneratedCodeInfo : public ::google::protobuf::Message { + public: + GeneratedCodeInfo(); + virtual ~GeneratedCodeInfo(); + + GeneratedCodeInfo(const GeneratedCodeInfo& from); + + inline GeneratedCodeInfo& operator=(const GeneratedCodeInfo& from) { + CopyFrom(from); + return *this; + } + + inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const { + return _internal_metadata_.unknown_fields(); + } + + inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() { + return _internal_metadata_.mutable_unknown_fields(); + } + + static const ::google::protobuf::Descriptor* descriptor(); + static const GeneratedCodeInfo& default_instance(); + + void Swap(GeneratedCodeInfo* other); + + // implements Message ---------------------------------------------- + + inline GeneratedCodeInfo* New() const { return New(NULL); } + + GeneratedCodeInfo* New(::google::protobuf::Arena* arena) const; + void CopyFrom(const ::google::protobuf::Message& from); + void MergeFrom(const ::google::protobuf::Message& from); + void CopyFrom(const GeneratedCodeInfo& from); + void MergeFrom(const GeneratedCodeInfo& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + void InternalSwap(GeneratedCodeInfo* other); + private: + inline ::google::protobuf::Arena* GetArenaNoVirtual() const { + return _internal_metadata_.arena(); + } + inline void* MaybeArenaPtr() const { + return _internal_metadata_.raw_arena_ptr(); + } + public: + + ::google::protobuf::Metadata GetMetadata() const; + + // nested types ---------------------------------------------------- + + typedef GeneratedCodeInfo_Annotation Annotation; + + // accessors ------------------------------------------------------- + + // repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; + int annotation_size() const; + void clear_annotation(); + static const int kAnnotationFieldNumber = 1; + const ::google::protobuf::GeneratedCodeInfo_Annotation& annotation(int index) const; + ::google::protobuf::GeneratedCodeInfo_Annotation* mutable_annotation(int index); + ::google::protobuf::GeneratedCodeInfo_Annotation* add_annotation(); + ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >* + mutable_annotation(); + const ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >& + annotation() const; + + // @@protoc_insertion_point(class_scope:google.protobuf.GeneratedCodeInfo) + private: + + ::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_; + ::google::protobuf::uint32 _has_bits_[1]; + mutable int _cached_size_; + ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation > annotation_; + friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_AssignDesc_google_2fprotobuf_2fdescriptor_2eproto(); + friend void protobuf_ShutdownFile_google_2fprotobuf_2fdescriptor_2eproto(); + + void InitAsDefaultInstance(); + static GeneratedCodeInfo* default_instance_; +}; // =================================================================== @@ -5970,7 +6194,7 @@ inline void FileOptions::set_allocated_csharp_namespace(::std::string* csharp_na // @@protoc_insertion_point(field_set_allocated:google.protobuf.FileOptions.csharp_namespace) } -// optional bool javanano_use_deprecated_package = 38; +// optional bool javanano_use_deprecated_package = 38 [deprecated = true]; inline bool FileOptions::has_javanano_use_deprecated_package() const { return (_has_bits_[0] & 0x00004000u) != 0; } @@ -7194,6 +7418,175 @@ SourceCodeInfo::location() const { return location_; } +// ------------------------------------------------------------------- + +// GeneratedCodeInfo_Annotation + +// repeated int32 path = 1 [packed = true]; +inline int GeneratedCodeInfo_Annotation::path_size() const { + return path_.size(); +} +inline void GeneratedCodeInfo_Annotation::clear_path() { + path_.Clear(); +} +inline ::google::protobuf::int32 GeneratedCodeInfo_Annotation::path(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.path) + return path_.Get(index); +} +inline void GeneratedCodeInfo_Annotation::set_path(int index, ::google::protobuf::int32 value) { + path_.Set(index, value); + // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.path) +} +inline void GeneratedCodeInfo_Annotation::add_path(::google::protobuf::int32 value) { + path_.Add(value); + // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.Annotation.path) +} +inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& +GeneratedCodeInfo_Annotation::path() const { + // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.Annotation.path) + return path_; +} +inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* +GeneratedCodeInfo_Annotation::mutable_path() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.Annotation.path) + return &path_; +} + +// optional string source_file = 2; +inline bool GeneratedCodeInfo_Annotation::has_source_file() const { + return (_has_bits_[0] & 0x00000002u) != 0; +} +inline void GeneratedCodeInfo_Annotation::set_has_source_file() { + _has_bits_[0] |= 0x00000002u; +} +inline void GeneratedCodeInfo_Annotation::clear_has_source_file() { + _has_bits_[0] &= ~0x00000002u; +} +inline void GeneratedCodeInfo_Annotation::clear_source_file() { + source_file_.ClearToEmptyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); + clear_has_source_file(); +} +inline const ::std::string& GeneratedCodeInfo_Annotation::source_file() const { + // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.source_file) + return source_file_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void GeneratedCodeInfo_Annotation::set_source_file(const ::std::string& value) { + set_has_source_file(); + source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value); + // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.source_file) +} +inline void GeneratedCodeInfo_Annotation::set_source_file(const char* value) { + set_has_source_file(); + source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(value)); + // @@protoc_insertion_point(field_set_char:google.protobuf.GeneratedCodeInfo.Annotation.source_file) +} +inline void GeneratedCodeInfo_Annotation::set_source_file(const char* value, size_t size) { + set_has_source_file(); + source_file_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), + ::std::string(reinterpret_cast(value), size)); + // @@protoc_insertion_point(field_set_pointer:google.protobuf.GeneratedCodeInfo.Annotation.source_file) +} +inline ::std::string* GeneratedCodeInfo_Annotation::mutable_source_file() { + set_has_source_file(); + // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.Annotation.source_file) + return source_file_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline ::std::string* GeneratedCodeInfo_Annotation::release_source_file() { + clear_has_source_file(); + return source_file_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited()); +} +inline void GeneratedCodeInfo_Annotation::set_allocated_source_file(::std::string* source_file) { + if (source_file != NULL) { + set_has_source_file(); + } else { + clear_has_source_file(); + } + source_file_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), source_file); + // @@protoc_insertion_point(field_set_allocated:google.protobuf.GeneratedCodeInfo.Annotation.source_file) +} + +// optional int32 begin = 3; +inline bool GeneratedCodeInfo_Annotation::has_begin() const { + return (_has_bits_[0] & 0x00000004u) != 0; +} +inline void GeneratedCodeInfo_Annotation::set_has_begin() { + _has_bits_[0] |= 0x00000004u; +} +inline void GeneratedCodeInfo_Annotation::clear_has_begin() { + _has_bits_[0] &= ~0x00000004u; +} +inline void GeneratedCodeInfo_Annotation::clear_begin() { + begin_ = 0; + clear_has_begin(); +} +inline ::google::protobuf::int32 GeneratedCodeInfo_Annotation::begin() const { + // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.begin) + return begin_; +} +inline void GeneratedCodeInfo_Annotation::set_begin(::google::protobuf::int32 value) { + set_has_begin(); + begin_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.begin) +} + +// optional int32 end = 4; +inline bool GeneratedCodeInfo_Annotation::has_end() const { + return (_has_bits_[0] & 0x00000008u) != 0; +} +inline void GeneratedCodeInfo_Annotation::set_has_end() { + _has_bits_[0] |= 0x00000008u; +} +inline void GeneratedCodeInfo_Annotation::clear_has_end() { + _has_bits_[0] &= ~0x00000008u; +} +inline void GeneratedCodeInfo_Annotation::clear_end() { + end_ = 0; + clear_has_end(); +} +inline ::google::protobuf::int32 GeneratedCodeInfo_Annotation::end() const { + // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.Annotation.end) + return end_; +} +inline void GeneratedCodeInfo_Annotation::set_end(::google::protobuf::int32 value) { + set_has_end(); + end_ = value; + // @@protoc_insertion_point(field_set:google.protobuf.GeneratedCodeInfo.Annotation.end) +} + +// ------------------------------------------------------------------- + +// GeneratedCodeInfo + +// repeated .google.protobuf.GeneratedCodeInfo.Annotation annotation = 1; +inline int GeneratedCodeInfo::annotation_size() const { + return annotation_.size(); +} +inline void GeneratedCodeInfo::clear_annotation() { + annotation_.Clear(); +} +inline const ::google::protobuf::GeneratedCodeInfo_Annotation& GeneratedCodeInfo::annotation(int index) const { + // @@protoc_insertion_point(field_get:google.protobuf.GeneratedCodeInfo.annotation) + return annotation_.Get(index); +} +inline ::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::mutable_annotation(int index) { + // @@protoc_insertion_point(field_mutable:google.protobuf.GeneratedCodeInfo.annotation) + return annotation_.Mutable(index); +} +inline ::google::protobuf::GeneratedCodeInfo_Annotation* GeneratedCodeInfo::add_annotation() { + // @@protoc_insertion_point(field_add:google.protobuf.GeneratedCodeInfo.annotation) + return annotation_.Add(); +} +inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >* +GeneratedCodeInfo::mutable_annotation() { + // @@protoc_insertion_point(field_mutable_list:google.protobuf.GeneratedCodeInfo.annotation) + return &annotation_; +} +inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::GeneratedCodeInfo_Annotation >& +GeneratedCodeInfo::annotation() const { + // @@protoc_insertion_point(field_list:google.protobuf.GeneratedCodeInfo.annotation) + return annotation_; +} + #endif // !PROTOBUF_INLINE_NOT_IN_HEADERS // ------------------------------------------------------------------- @@ -7237,6 +7630,10 @@ SourceCodeInfo::location() const { // ------------------------------------------------------------------- +// ------------------------------------------------------------------- + +// ------------------------------------------------------------------- + // @@protoc_insertion_point(namespace_scope) diff --git a/src/google/protobuf/descriptor.proto b/src/google/protobuf/descriptor.proto index c59a6022..3e664d59 100644 --- a/src/google/protobuf/descriptor.proto +++ b/src/google/protobuf/descriptor.proto @@ -379,7 +379,7 @@ message FileOptions { // Whether the nano proto compiler should generate in the deprecated non-nano // suffixed package. - optional bool javanano_use_deprecated_package = 38; + optional bool javanano_use_deprecated_package = 38 [deprecated = true]; // The parser stores options it doesn't recognize here. See above. repeated UninterpretedOption uninterpreted_option = 999; @@ -777,3 +777,29 @@ message SourceCodeInfo { repeated string leading_detached_comments = 6; } } + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +message GeneratedCodeInfo { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + repeated Annotation annotation = 1; + message Annotation { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + repeated int32 path = 1 [packed=true]; + + // Identifies the filesystem path to the original source .proto. + optional string source_file = 2; + + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + optional int32 begin = 3; + + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + optional int32 end = 4; + } +} diff --git a/src/google/protobuf/util/internal/testdata/maps.proto b/src/google/protobuf/util/internal/testdata/maps.proto index 7fb42a26..6475ecdd 100644 --- a/src/google/protobuf/util/internal/testdata/maps.proto +++ b/src/google/protobuf/util/internal/testdata/maps.proto @@ -44,6 +44,35 @@ message MapOut { map map1 = 1; map map2 = 2; map map3 = 3; + map map4 = 5; + string bar = 4; +} + +// A message with exactly the same wire representation as MapOut, but using +// repeated message fields instead of map fields. We use this message to test +// the wire-format compatibility of the JSON transcoder (e.g., whether it +// handles missing keys correctly). +message MapOutWireFormat { + message Map1Entry { + string key = 1; + MapM value = 2; + } + repeated Map1Entry map1 = 1; + message Map2Entry { + string key = 1; + MapOut value = 2; + } + repeated Map2Entry map2 = 2; + message Map3Entry { + int32 key = 1; + string value = 2; + } + repeated Map3Entry map3 = 3; + message Map4Entry { + bool key = 1; + string value = 2; + } + repeated Map4Entry map4 = 5; string bar = 4; } From 1b8bab3a785c4771618948a34b0db39143287742 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Fri, 29 Jan 2016 14:01:01 -0800 Subject: [PATCH 3/4] Uncomment the test, which was commented out during integration --- .../google/protobuf/ParseExceptionsTest.java | 369 +++++++++--------- 1 file changed, 184 insertions(+), 185 deletions(-) diff --git a/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java b/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java index 03593413..37fa242d 100644 --- a/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java +++ b/java/core/src/test/java/com/google/protobuf/ParseExceptionsTest.java @@ -24,189 +24,188 @@ import static org.junit.Assert.fail; */ public class ParseExceptionsTest { -// disable for now for update the maven local repo. -// private interface ParseTester { -// DescriptorProto parse(InputStream in) throws IOException; -// } -// -// private byte serializedProto[]; -// -// private void setup() { -// serializedProto = DescriptorProto.getDescriptor().toProto().toByteArray(); -// } -// -// private void setupDelimited() { -// ByteArrayOutputStream bos = new ByteArrayOutputStream(); -// try { -// DescriptorProto.getDescriptor().toProto().writeDelimitedTo(bos); -// } catch (IOException e) { -// fail("Exception not expected: " + e); -// } -// serializedProto = bos.toByteArray(); -// } -// -// @Test public void message_parseFrom_InputStream() { -// setup(); -// verifyExceptions(new ParseTester() { -// public DescriptorProto parse(InputStream in) throws IOException { -// return DescriptorProto.parseFrom(in); -// } -// }); -// } -// -// @Test public void message_parseFrom_InputStreamAndExtensionRegistry() { -// setup(); -// verifyExceptions(new ParseTester() { -// public DescriptorProto parse(InputStream in) throws IOException { -// return DescriptorProto.parseFrom(in, ExtensionRegistry.newInstance()); -// } -// }); -// } -// -// @Test public void message_parseFrom_CodedInputStream() { -// setup(); -// verifyExceptions(new ParseTester() { -// public DescriptorProto parse(InputStream in) throws IOException { -// return DescriptorProto.parseFrom(CodedInputStream.newInstance(in)); -// } -// }); -// } -// -// @Test public void message_parseFrom_CodedInputStreamAndExtensionRegistry() { -// setup(); -// verifyExceptions(new ParseTester() { -// public DescriptorProto parse(InputStream in) throws IOException { -// return DescriptorProto.parseFrom(CodedInputStream.newInstance(in), -// ExtensionRegistry.newInstance()); -// } -// }); -// } -// -// @Test public void message_parseDelimitedFrom_InputStream() { -// setupDelimited(); -// verifyExceptions(new ParseTester() { -// public DescriptorProto parse(InputStream in) throws IOException { -// return DescriptorProto.parseDelimitedFrom(in); -// } -// }); -// } -// -// @Test public void message_parseDelimitedFrom_InputStreamAndExtensionRegistry() { -// setupDelimited(); -// verifyExceptions(new ParseTester() { -// public DescriptorProto parse(InputStream in) throws IOException { -// return DescriptorProto.parseDelimitedFrom(in, ExtensionRegistry.newInstance()); -// } -// }); -// } -// -// @Test public void messageBuilder_mergeFrom_InputStream() { -// setup(); -// verifyExceptions(new ParseTester() { -// public DescriptorProto parse(InputStream in) throws IOException { -// return DescriptorProto.newBuilder().mergeFrom(in).build(); -// } -// }); -// } -// -// @Test public void messageBuilder_mergeFrom_InputStreamAndExtensionRegistry() { -// setup(); -// verifyExceptions(new ParseTester() { -// public DescriptorProto parse(InputStream in) throws IOException { -// return DescriptorProto.newBuilder().mergeFrom(in, ExtensionRegistry.newInstance()).build(); -// } -// }); -// } -// -// @Test public void messageBuilder_mergeFrom_CodedInputStream() { -// setup(); -// verifyExceptions(new ParseTester() { -// public DescriptorProto parse(InputStream in) throws IOException { -// return DescriptorProto.newBuilder().mergeFrom(CodedInputStream.newInstance(in)).build(); -// } -// }); -// } -// -// @Test public void messageBuilder_mergeFrom_CodedInputStreamAndExtensionRegistry() { -// setup(); -// verifyExceptions(new ParseTester() { -// public DescriptorProto parse(InputStream in) throws IOException { -// return DescriptorProto.newBuilder() -// .mergeFrom(CodedInputStream.newInstance(in), ExtensionRegistry.newInstance()).build(); -// } -// }); -// } -// -// @Test public void messageBuilder_mergeDelimitedFrom_InputStream() { -// setupDelimited(); -// verifyExceptions(new ParseTester() { -// public DescriptorProto parse(InputStream in) throws IOException { -// DescriptorProto.Builder builder = DescriptorProto.newBuilder(); -// builder.mergeDelimitedFrom(in); -// return builder.build(); -// } -// }); -// } -// -// @Test public void messageBuilder_mergeDelimitedFrom_InputStreamAndExtensionRegistry() { -// setupDelimited(); -// verifyExceptions(new ParseTester() { -// public DescriptorProto parse(InputStream in) throws IOException { -// DescriptorProto.Builder builder = DescriptorProto.newBuilder(); -// builder.mergeDelimitedFrom(in, ExtensionRegistry.newInstance()); -// return builder.build(); -// } -// }); -// } -// -// private void verifyExceptions(ParseTester parseTester) { -// // No exception -// try { -// assertEquals(DescriptorProto.getDescriptor().toProto(), -// parseTester.parse(new ByteArrayInputStream(serializedProto))); -// } catch (IOException e) { -// fail("No exception expected: " + e); -// } -// -// // IOException -// try { -// // using a "broken" stream that will throw part-way through reading the message -// parseTester.parse(broken(new ByteArrayInputStream(serializedProto))); -// fail("IOException expected but not thrown"); -// } catch (IOException e) { -// assertFalse(e instanceof InvalidProtocolBufferException); -// } -// -// // InvalidProtocolBufferException -// try { -// // make the serialized proto invalid -// for (int i = 0; i < 50; i++) { -// serializedProto[i] = -1; -// } -// parseTester.parse(new ByteArrayInputStream(serializedProto)); -// fail("InvalidProtocolBufferException expected but not thrown"); -// } catch (IOException e) { -// assertTrue(e instanceof InvalidProtocolBufferException); -// } -// } -// -// private InputStream broken(InputStream i) { -// return new FilterInputStream(i) { -// int count = 0; -// -// @Override public int read() throws IOException { -// if (count++ >= 50) { -// throw new IOException("I'm broken!"); -// } -// return super.read(); -// } -// -// @Override public int read(byte b[], int off, int len) throws IOException { -// if ((count += len) >= 50) { -// throw new IOException("I'm broken!"); -// } -// return super.read(b, off, len); -// } -// }; -// } + private interface ParseTester { + DescriptorProto parse(InputStream in) throws IOException; + } + + private byte serializedProto[]; + + private void setup() { + serializedProto = DescriptorProto.getDescriptor().toProto().toByteArray(); + } + + private void setupDelimited() { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + try { + DescriptorProto.getDescriptor().toProto().writeDelimitedTo(bos); + } catch (IOException e) { + fail("Exception not expected: " + e); + } + serializedProto = bos.toByteArray(); + } + + @Test public void message_parseFrom_InputStream() { + setup(); + verifyExceptions(new ParseTester() { + public DescriptorProto parse(InputStream in) throws IOException { + return DescriptorProto.parseFrom(in); + } + }); + } + + @Test public void message_parseFrom_InputStreamAndExtensionRegistry() { + setup(); + verifyExceptions(new ParseTester() { + public DescriptorProto parse(InputStream in) throws IOException { + return DescriptorProto.parseFrom(in, ExtensionRegistry.newInstance()); + } + }); + } + + @Test public void message_parseFrom_CodedInputStream() { + setup(); + verifyExceptions(new ParseTester() { + public DescriptorProto parse(InputStream in) throws IOException { + return DescriptorProto.parseFrom(CodedInputStream.newInstance(in)); + } + }); + } + + @Test public void message_parseFrom_CodedInputStreamAndExtensionRegistry() { + setup(); + verifyExceptions(new ParseTester() { + public DescriptorProto parse(InputStream in) throws IOException { + return DescriptorProto.parseFrom(CodedInputStream.newInstance(in), + ExtensionRegistry.newInstance()); + } + }); + } + + @Test public void message_parseDelimitedFrom_InputStream() { + setupDelimited(); + verifyExceptions(new ParseTester() { + public DescriptorProto parse(InputStream in) throws IOException { + return DescriptorProto.parseDelimitedFrom(in); + } + }); + } + + @Test public void message_parseDelimitedFrom_InputStreamAndExtensionRegistry() { + setupDelimited(); + verifyExceptions(new ParseTester() { + public DescriptorProto parse(InputStream in) throws IOException { + return DescriptorProto.parseDelimitedFrom(in, ExtensionRegistry.newInstance()); + } + }); + } + + @Test public void messageBuilder_mergeFrom_InputStream() { + setup(); + verifyExceptions(new ParseTester() { + public DescriptorProto parse(InputStream in) throws IOException { + return DescriptorProto.newBuilder().mergeFrom(in).build(); + } + }); + } + + @Test public void messageBuilder_mergeFrom_InputStreamAndExtensionRegistry() { + setup(); + verifyExceptions(new ParseTester() { + public DescriptorProto parse(InputStream in) throws IOException { + return DescriptorProto.newBuilder().mergeFrom(in, ExtensionRegistry.newInstance()).build(); + } + }); + } + + @Test public void messageBuilder_mergeFrom_CodedInputStream() { + setup(); + verifyExceptions(new ParseTester() { + public DescriptorProto parse(InputStream in) throws IOException { + return DescriptorProto.newBuilder().mergeFrom(CodedInputStream.newInstance(in)).build(); + } + }); + } + + @Test public void messageBuilder_mergeFrom_CodedInputStreamAndExtensionRegistry() { + setup(); + verifyExceptions(new ParseTester() { + public DescriptorProto parse(InputStream in) throws IOException { + return DescriptorProto.newBuilder() + .mergeFrom(CodedInputStream.newInstance(in), ExtensionRegistry.newInstance()).build(); + } + }); + } + + @Test public void messageBuilder_mergeDelimitedFrom_InputStream() { + setupDelimited(); + verifyExceptions(new ParseTester() { + public DescriptorProto parse(InputStream in) throws IOException { + DescriptorProto.Builder builder = DescriptorProto.newBuilder(); + builder.mergeDelimitedFrom(in); + return builder.build(); + } + }); + } + + @Test public void messageBuilder_mergeDelimitedFrom_InputStreamAndExtensionRegistry() { + setupDelimited(); + verifyExceptions(new ParseTester() { + public DescriptorProto parse(InputStream in) throws IOException { + DescriptorProto.Builder builder = DescriptorProto.newBuilder(); + builder.mergeDelimitedFrom(in, ExtensionRegistry.newInstance()); + return builder.build(); + } + }); + } + + private void verifyExceptions(ParseTester parseTester) { + // No exception + try { + assertEquals(DescriptorProto.getDescriptor().toProto(), + parseTester.parse(new ByteArrayInputStream(serializedProto))); + } catch (IOException e) { + fail("No exception expected: " + e); + } + + // IOException + try { + // using a "broken" stream that will throw part-way through reading the message + parseTester.parse(broken(new ByteArrayInputStream(serializedProto))); + fail("IOException expected but not thrown"); + } catch (IOException e) { + assertFalse(e instanceof InvalidProtocolBufferException); + } + + // InvalidProtocolBufferException + try { + // make the serialized proto invalid + for (int i = 0; i < 50; i++) { + serializedProto[i] = -1; + } + parseTester.parse(new ByteArrayInputStream(serializedProto)); + fail("InvalidProtocolBufferException expected but not thrown"); + } catch (IOException e) { + assertTrue(e instanceof InvalidProtocolBufferException); + } + } + + private InputStream broken(InputStream i) { + return new FilterInputStream(i) { + int count = 0; + + @Override public int read() throws IOException { + if (count++ >= 50) { + throw new IOException("I'm broken!"); + } + return super.read(); + } + + @Override public int read(byte b[], int off, int len) throws IOException { + if ((count += len) >= 50) { + throw new IOException("I'm broken!"); + } + return super.read(b, off, len); + } + }; + } } From defa25b38b2ba884abcd9cb4a25c2c7fd51d0d01 Mon Sep 17 00:00:00 2001 From: Jisi Liu Date: Fri, 29 Jan 2016 14:04:15 -0800 Subject: [PATCH 4/4] Restore the license for Internal.java --- .../java/com/google/protobuf/Internal.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/java/core/src/main/java/com/google/protobuf/Internal.java b/java/core/src/main/java/com/google/protobuf/Internal.java index dca5f23b..e19b6dca 100644 --- a/java/core/src/main/java/com/google/protobuf/Internal.java +++ b/java/core/src/main/java/com/google/protobuf/Internal.java @@ -1,4 +1,32 @@ -// Copyright 2007 Google Inc. All rights reserved. +// Protocol Buffers - Google's data interchange format +// Copyright 2008 Google Inc. All rights reserved. +// https://developers.google.com/protocol-buffers/ +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package com.google.protobuf;