Need help with compilation of protobuf with a large enum for java

365 views
Skip to first unread message

Minimol Thomas

unread,
Jul 11, 2017, 4:06:30 PM7/11/17
to Protocol Buffers
Compilation of java code generated using protobuf compiler fails giving the error, "code too large".
We have an enumeration with 6000 values. And the code generated for this enum is causing the problem.
I would not be able to make any changes to the enumeration as the protofile is owned/maintained by another team.
The java code generated using protobuf compiler 3 for same protofile compiles without any issues.
Do we have any option to continue using protobuf compiler version 2.6.1 and solve "code too large" problem.
Note: I am already using "option java_multiple_files = true;"
Please suggest

Thanks,
Minimol


Feng Xiao

unread,
Jul 11, 2017, 4:58:38 PM7/11/17
to Minimol Thomas, Protocol Buffers
I remember we implemented something in protobuf to reduce the code size for enums and that's probably why you don't get the error with newer version of protocol compiler. If you have to use protobuf 2.6.1, I think you will have to patch up protoc 2.6.1 yourself and adopt the same fix used in latest version of protoc.
 

Thanks,
Minimol


--
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 protobuf+unsubscribe@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Minimol Thomas

unread,
Jul 11, 2017, 8:05:33 PM7/11/17
to Protocol Buffers
Thank you Feng for replying. Are there any plans to back port these changes to 2.6.1 ? Could you please point me to a commit id ?


On Tuesday, July 11, 2017 at 1:58:38 PM UTC-7, Feng Xiao wrote:
On Tue, Jul 11, 2017 at 1:06 PM, Minimol Thomas <minimo...@gmail.com> wrote:
Compilation of java code generated using protobuf compiler fails giving the error, "code too large".
We have an enumeration with 6000 values. And the code generated for this enum is causing the problem.
I would not be able to make any changes to the enumeration as the protofile is owned/maintained by another team.
The java code generated using protobuf compiler 3 for same protofile compiles without any issues.
Do we have any option to continue using protobuf compiler version 2.6.1 and solve "code too large" problem.
Note: I am already using "option java_multiple_files = true;" 
 
Please suggest
I remember we implemented something in protobuf to reduce the code size for enums and that's probably why you don't get the error with newer version of protocol compiler. If you have to use protobuf 2.6.1, I think you will have to patch up protoc 2.6.1 yourself and adopt the same fix used in latest version of protoc.
 

Thanks,
Minimol


--
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 protobuf+u...@googlegroups.com.

Feng Xiao

unread,
Jul 11, 2017, 8:19:58 PM7/11/17
to Minimol Thomas, Protocol Buffers
On Tue, Jul 11, 2017 at 5:05 PM, Minimol Thomas <minimo...@gmail.com> wrote:
Thank you Feng for replying. Are there any plans to back port these changes to 2.6.1 ? Could you please point me to a commit id ?
There isn't any plan to port things back to 2.6.1 at the moment. The change was implemented inside Google and is part of this enormous integration commit:

I believe the change in java_enum.cc is what brings down the code size a little bit:


 
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages