-
Notifications
You must be signed in to change notification settings - Fork 15.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v3.19.1 Produces Java Code that does not compile #9339
Comments
I'm experiencing the same issue as well. It's crazy to think this still exists considering Apple Silicon is around for a while now. |
I have searched everywhere but could not find the solution. How it can be possible at the end of 2021? |
Can you provide a reproducer URL? This is odd. |
are you using protoc from 3.19.1 as well? It looks like you're using the right runtime but wondering if the generators are outdated? EDIT:
|
It's not clear to me how this has anything to do with Apple Silicon? Can you explain this connection for me? |
Asked the team internally, and it looks like you're using this: We don't maintain this, and is likely not up to date w/ the runtime you're pulling in. Please file an issue there or a PR to update the version of protoc it is using. Looks like they maintain protoc themselves for some reason here: |
@perezd Thank you for the quick response. I am using a maven plugin which can be configured to use a specific protoc version. The latest version for the plugin is 3.11.4. Here is the configuration in the pom :
Here is a part of the maven execution log :
|
It looks like you'll need to do one of two things:
|
Am I missing something? The protoc's and the runtime's versions are same. What I see is they are both 3.19.1 according to the log I provided above. |
Interesting, is the protoc jar from the maven plugin not based on this? that's what maven says based on the pom you provided. Are you able to try doing this outside of maven with a regular protoc binary? I'd like to isolate this a bit better. EDIT: I wonder if that log line is trustworthy/actually coming from protoc that is being invoked, or naively just a string concat based on a property in the pom file.. |
No, it is not base on that version. The protoc version can be configurable regardless of the version of the plugin in the pom like below (which I did and the log shows it is configured correctly)
However you are right, to better isolate the problem I will run the protoc outside of the maven build (basicly from terminal) |
you can set that, but I don't see that option in the jar they are using that contains the actual executable, that's my wonder...I don't know this codebase well and wonder if it's a validation failure, for example, here's a bug that says this tool doesn't support protoc 3.15.x: os72/protoc-jar-maven-plugin#107 This makes me think it's not actually running 3.19.1 as you wanted. EDIT: EDIT2: |
Unfortunately, running protoc outside of the maven produced the same result. You can see the protoc version that I am using at the end of the terminal log.
And the resulting java files still contains the non-compilable code segments :
and
There was no problem before while we were using 3.7.1 but I had to upgrade the protobuf version to >3.18.0 because of the fact that my local machine is based on apple silicon and the protobuf binary support for apple silicon comes with 3.18.0 |
Can you provide the full compilation stack traces for these errors? I can't really tell what's going wrong. EDIT: I don't believe Apple Silicon has anything to do with compiling java btw, it's a virtual machine. |
Also, I believe Further, that line hasn't changed for 3 years, so it's not a regression introduced in 3.19:
|
The root cause of the problem is not compiling .java files into .class files, the problem merely manifests itself at there. However the root cause resides in generating java files from .proto files.
|
Can you share a gist of the smallest generated file you have here? This is really bizarre. |
Here is the beginning of one of the generated files :
The class is not a subclass of GeneratedMessageV3. Here is the protofile
|
OK, I'm afraid without the full file it's hard to help you, let me explain: You've shown me to
Without more context, I can't really help you debug this. |
Yes you are right. Here (I just mask the name of the company)
|
Here's a different approach, can you make a very small reproducible failure case not based on your private protos? Meaning, create the smallest example of this failing for you locally that you can share? |
@perezd thanks for your help again. I will provide an example tomorrow. |
I figured it out, the problem neither was related with the protobuf nor was related with the plugin that I use to generate java files. It was related with the miss-configured transitive dependencies compound with the maven compiler plugin configuration. |
read all of that only to not find out what the solution was....can you post what the problem was @ridvantanik |
What version of protobuf and what language are you using?
Version: v3.19.1
Language: Java 1.8
What operating system (Linux, Windows, ...) and version?
macOS 12.1
What runtime / compiler are you using (e.g., python version or gcc version)
I'm using the compiler published as an artifact in a Maven repo.
What did you expect to see
The generated code should compile.
What did you see instead?
The generated classes that the plugin and protoc generate do not compile. The UnusedPrivateParameter class (without a package) is missing. Here's an snippet from some of the generated source:
Compile Error:
The text was updated successfully, but these errors were encountered: