Feel free to send a patch. It would be nice if we could also move the meat of all the parseFrom methods into AbstractMessageLite -- as protected static methods that take the message default instance as the first parameter -- so that the generated code can be as simple as possible. I'm worried that adding so many methods is probably leading to binary bloat.
On Wed, Aug 19, 2009 at 5:18 PM, Oliver Jowett <oliver.jow...@gmail.com>wrote: > Kenton Varda wrote: > > On Tue, Aug 18, 2009 at 6:55 PM, Oliver Jowett <oliver.jow...@gmail.com > > <mailto:oliver.jow...@gmail.com>> wrote: > > > > > > Hi > > > > Using 2.2.0, the compiler doesn't seem to be generating Java code for > > the parseFrom(byte[],int,int) and > > parseFrom(byte[],int,int,ExtensionRegistryLite) static methods. > > > > > > Did it ever generate those methods? I don't remember if it did, but I > > definitely don't remember removing them. > > I don't think so - I just tried to use them based on the documentation > saying "there's a parseFrom() variant for each mergeFrom()" and ran into > compile errors. I really did need to parse from a partial array there - > it was a section of a NIO buffer's backing array. > > > Arguably your code should look like: > > > > message = builder.mergeFrom(array, offset, length).buildPartial(); > > if (!message.isInitialized()) { > > throw new InvalidProtocolBufferException(...); > > } > > > > It's a little bit nicer than the try/catch... > > Unfortunately, this doesn't give you the nice list of missing fields > that parseFrom() generates. > > -O > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To post to this group, send email to protobuf@googlegroups.com To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/protobuf?hl=en -~----------~----~----~----~------~----~------~--~---