Skip to content
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

java LITE_RUNTIME deperacation warning even though following the java lite runtime docs #6489

Closed
m0hamed opened this issue Aug 8, 2019 · 4 comments
Assignees

Comments

@m0hamed
Copy link
Contributor

m0hamed commented Aug 8, 2019

What version of protobuf and what language are you using?
Version: v3.9.0
Language: Java

What operating system (Linux, Windows, ...) and version?
Linux

What runtime / compiler are you using (e.g., python version or gcc version)
N/A

What did you do?
Steps to reproduce the behavior:

  1. Have a .proto with optimize_for = LITE_RUNTIME
  2. Compile into java using protoc --java_out=lite:${OUTPUT_DIR}
  3. Get warning about LITE_RUNTIME deprecation and using the javalite plugin

What did you expect to see
No warnings, there is no more separate codegen plugin and now java lite uses protoc directly with the "lite:" prefix to --java_out= (as far as I understand from the lite.md).

What did you see instead?
[libprotobuf WARNING ../../third_party/protobuf/src/google/protobuf/compiler/java/java_file.cc:242] The optimize_for = LITE_RUNTIME option is no longer supported by protobuf Java code generator and is ignored--protoc will always generate full runtime code for Java. To use Java Lite runtime, users should use the Java Lite plugin instead. See:
https://github.com/protocolbuffers/protobuf/blob/master/java/lite.md

Anything else we should know about your project / environment

@m0hamed m0hamed changed the title LITE_ java LITE_RUNTIME deperacation warning even though following the java lite runtime docs Aug 8, 2019
@acozzette
Copy link
Member

@m0hamed I think the warning is there because setting optimize_for = LITE_RUNTIME no longer has an effect on the Java code generation. Can you just remove that from your .proto file? (Or maybe you're keeping it since it still has an effect on C++?)

@m0hamed
Copy link
Contributor Author

m0hamed commented Aug 9, 2019

Exactly, I am keeping it because it is needed for C++

@acozzette
Copy link
Member

Ah, OK. The warning was meant to apply only to Java. However, you can do the same thing for C++ and pass --cpp_out=lite:..., so that would be a quick solution to get rid of the error.

@m0hamed
Copy link
Contributor Author

m0hamed commented Aug 12, 2019

I filed this because I was unsure if I somehow broke things and ended up using the full java runtime. From what you are saying that is not the case and the warning just happens regardless. I still feel you should not output unneeded warnings unless "optimize_for = LITE_RUNTIME" is being deprecated entirely (i.e. check if --java_out=lite: is used before outputting the warning). Either way feel free to close the issue.

@acozzette acozzette self-assigned this Aug 16, 2019
@elharo elharo closed this as completed Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants