Large Proto File Failing Java Compilation with Variable Assignment Error
What version of protobuf and what language are you using? Version: v3.14.0 Language: Java (issue occurs only when building for Java; Golang build works fine)
What operating system (Linux, Windows, ...) and version? Operating System: Linux
What runtime / compiler are you using (e.g., python version or gcc version) Compiler: Apache Maven, Maven Compiler Plugin 3.11.0
Build Environment:
- The build is executed within a Docker container.
- The build and compilation process is run on GitHub Actions CI/CD pipeline.
- Docker image is based on a Linux environment, using the official Maven Docker image for consistency across builds.
What did you do? Steps to reproduce the behavior:
- Attempted to build a large
.protofile using the Java compiler. - The
.protofile includes 527 messages, 36 enums, 136 RPCs, and 1 service, totaling 700 entities. - The error occurs at the final object of the file, which is not modified.
What did you expect to see
We expected the .proto file to compile successfully without errors as it does for Golang.
What did you see instead? Received the following compilation errors when building for Java:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.11.0
(default-compile) on project foo-bar-proxy: Compilation failure: [ERROR] /app/target/generated-sources/protobuf/java/com/example/api/Foo.java:[526219,5] cannot assign a value to final variable internal_static_ff_Foo_descriptor [ERROR] /app/target/generated-sources/protobuf/java/com/example/api/Foo.java:[526221,5] cannot assign a value to final variable internal_static_ff_Foo_fieldAccessorTable
Anything else we should know about your project / environment
-
The issue is specific to Java builds; the same
.protofile compiles without issue for Golang. -
The
.protofile details are as follows:File Name Number of Lines File Size (Bytes) Number of Messages Number of Enums Number of RPCs Number of Services Total Entities foo.proto 3993 124560 527 36 136 1 700
Our main question is whether there is a known limit or issue with large .proto files in Java, and if so, what the recommended approach is to address this problem. Any guidance or recommendations would be greatly appreciated.
Hi Fatih,
Java version 3.14.0 is out of support: https://protobuf.dev/support/version-support/#java
Could you try upgrading to 3.25.x and see if you still encounter this issue?
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please add a comment.
This issue is labeled inactive because the last activity was over 90 days ago. This issue will be closed and archived after 14 additional days without activity.
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please reopen it.
This issue was closed and archived because there has been no new activity in the 14 days since the inactive label was added.