aboutsummaryrefslogtreecommitdiff
path: root/java/src/main
Commit message (Collapse)AuthorAgeFilesLines
* Fix roundtrip failure with groups when unknown fields are enabled.Nicholas Seckar2013-10-041-2/+7
| | | | | | | | | | | | | | | | When parsing a group, the group's end tag should not be stored within the message's unknownFieldData. Not only does this waste space, it is also output the next time the group is serialized, resulting in two end tags for that group. The resulting bytes are not always a valid protocol buffer and may fail to parse. This change ensures that group end tags do not result in an unknownFieldData entry, and that messages with groups can be roundtripped without corruption. Change-Id: I240f858a7217a7652b756598c34aacad5dcc3363 Conflicts: java/src/test/java/com/google/protobuf/NanoTest.java
* Make it possible to use MessageNano.mergeFrom without casting.Brian Duff2013-07-081-3/+3
| | | | | | | | | | You can now do: MyMessage foo = MessageNano.mergeFrom(new MyMessage(), bytes); without having to cast the message returned from mergeFrom. Change-Id: Ibb2ad327f75855d45352ad304c7f054f20dd29c9
* Nano support for extensions and unknown fields.Brian Duff2013-06-245-3/+402
| | | | | | | | | | | | | | | | | | | | You can use the processor option store_unknown_fields to switch this support on: aprotoc --javanano_out=store_unknown_fields=true:/tmp/out A separate option for extensions isn't required. Support for unknown fields must be turned on to allow storing and retrieving extensions, because they are just stored as unknown fields. If unknown fields are switched on, extension related code will be generated when a proto message includes an extension range, or an extension is encountered. By default, store_unknown_fields is false. No additional code is generated, and the generator will error out if protos contain extension ranges or extensions. Change-Id: I1e034c9e8f3305612953f72438189a7da6ed2167
* Add toString() method to MessageNano.Andrew Flynn2013-06-042-0/+187
| | | | | | | | | | | | - All of the real work for printing the proto is actually done in MessageNanoPrinter. - Uses reflection to find proto-defined fields and prints those. - Prints all fields, even defaults and nulls. - Also added a simple test to make sure it handles all proto types well. Tried not to make the test too brittle (but hey it's testing a toString() so how flexible can it be) Change-Id: I3e360ef8b0561041e010c1f3445ec45ecdcd2559
* Nano protobufs.Ulas Kirazci2013-04-016-0/+2006
Like micro protobufs except: - No setter/getter/hazzer functions. - Has state is not available. Outputs all fields != their default. - CodedInputStream can only take byte[] (not InputStream). - Repeated fields are in arrays, not ArrayList or Vector. - Unset messages/groups are null, not "defaultInstance()". - Required fields are always serialized. To use: - Link libprotobuf-java-2.3.0-nano runtime. - Use LOCAL_PROTOC_OPTIMIZE_TYPE := nano Change-Id: I7429015b3c5f7f38b7be01eb2d4927f7a9999c80