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

Protobuf compiler in j2objc v2.1.1 generates code with references to enum values missing from jar #1000

Closed
safetydank opened this issue Aug 23, 2018 · 2 comments

Comments

@safetydank
Copy link

With input protobuf definition sample.proto:

syntax = "proto2";

package protobuf;

option optimize_for = LITE_RUNTIME;

message Handshake {
    required string version = 1;
    optional string android_app_version = 101;
    optional string ios_app_version = 102;
}

I run the protobuf compiler using $J2OBJC/j2objc_protoc --java_out=java --j2objc_out=objc sample.proto

The generated Java code includes references to enum values GET_MEMOIZED_IS_INITIALIZED and SET_MEMOIZED_IS_INITIALIZED for type com.google.protobuf.GeneratedMessageLite.MethodToInvoke that are missing in $J2OBJC/lib/protobuf_runtime.jar (verified missing using JD-GUI). This causes errors when using j2objc to translate Java source files with references to the generated protobuf Java code.

@tomball
Copy link
Collaborator

tomball commented Aug 27, 2018

The "optimize for LITE_RUNTIME" option no longer supports reflective methods in the Java protobuf runtime. That support is now available in a separate libprotobuf-lite.jar, but there isn't a j2objc equivalent to that runtime. I recommend you remove that option from your proto file.

@tomball tomball closed this as completed Aug 27, 2018
@safetydank
Copy link
Author

Thanks for looking into this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants