Hi everyone,
I’m looking for some clarification regarding the [lazy = true] field option and how it translates to generated Java code, as I've noticed some behavior reminiscent of older discussions (like issue #3601 - https://github.com/protocolbuffers/protobuf/issues/3601).
Currently, standard protoc syntactically accepts the [lazy = true] annotation on message fields without any warnings. However, the resulting files generated via --java_out completely ignore this directive—the generated code falls back to standard eager parsing and storage, and LazyField is nowhere to be found in the internal implementation.
In contrast, I found that using the separate Java Lite plugin does successfully generate the expected LazyField wrappers. I am able to get the lazy behavior working by passing these additional options to the compiler:
--plugin=protoc-gen-javalite=<path/to/protoc-gen-javalite> \
--javalite_out=<output_dir>
Could the maintainers clarify a few things regarding this?
Standard Java: Is the omission of LazyField in the standard Java generation intentional, or is [lazy = true] strictly treated as an unsupported hint for standard Java builds?
Java Lite: Are we actively supporting [lazy = true] via the javalite plugin, or is this considered legacy/experimental behavior that might be removed?
I want to ensure I'm optimizing deserialization using a supported path before committing to the Java Lite implementation.
Thanks for the insights!
- JP
--
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.
To view this discussion visit https://groups.google.com/d/msgid/protobuf/b536dbbf-b531-4aee-8f6b-6bbef6b585f4n%40googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/protobuf/ad62651e-1023-44cc-9288-0a78d7caa5c0n%40googlegroups.com.