Hi Denis, thanks for reporting this. It seems to be a known bug: https://github.com/google/protobuf/issues/826 It comes down to the fact that in Java we represent tag numbers as ints (which are 32-bit signed values), and the protoc compiler is generating a tag number that will fit in an unsigned 32-bit integer but not in a signed Java int. Let me try and see if I can tweak things to fix this.
On Fri, Sep 23, 2016 at 12:47 PM, Denis Vlah <[email protected]> wrote: > Hello everyone, > > I have generated the java classes from .proto file using the protoc.exe > tool (latest version) > > Proto syntax version is 2. > > Original .proto file was generated from C# classes decorated with > protobuf-net attributes. > > The java snippet with error: > > public static final class Object extends > com.google.protobuf.GeneratedMessageV3 implements > // @@protoc_insertion_point(message_implements:Forcive. > Dto.Objects.Object) > ObjectOrBuilder { > // Use Object.newBuilder() to construct. > private Object(com.google.protobuf.GeneratedMessageV3.Builder<?> > builder) { > super(builder); > } > private Object() { > } > > @java.lang.Override > public final com.google.protobuf.UnknownFieldSet > getUnknownFields() { > return this.unknownFields; > } > private Object( > com.google.protobuf.CodedInputStream input, > com.google.protobuf.ExtensionRegistryLite extensionRegistry) > throws com.google.protobuf.InvalidProtocolBufferException { > this(); > int mutable_bitField0_ = 0; > int mutable_bitField1_ = 0; > int mutable_bitField2_ = 0; > int mutable_bitField3_ = 0; > com.google.protobuf.UnknownFieldSet.Builder unknownFields = > com.google.protobuf.UnknownFieldSet.newBuilder(); > try { > boolean done = false; > while (!done) { > int tag = input.readTag(); > switch (tag) { > *case 2147793578 <2147793578>*: { > Forcive.Dto.Objects.AllMessages.RepositoryDto.Builder > subBuilder = null; > if (((bitField1_ & 0x00004000) == 0x00004000)) { > subBuilder = repositoryDto_.toBuilder(); > } > repositoryDto_ = input.readMessage(Forcive.Dto. > Objects.AllMessages.RepositoryDto.PARSER, extensionRegistry); > if (subBuilder != null) { > subBuilder.mergeFrom(repositoryDto_); > repositoryDto_ = subBuilder.buildPartial(); > } > bitField1_ |= 0x00004000; > break; > } > > .... > } > > The compiler error : > Error:(78400, 18) java: integer number too large: 2147793578 > > For the same .proto file were generated c++ classes that are successfully > complied. > > Have anyone ideas how to fix this problem? > > Thanks, > Denis Vlah > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
