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
[proto3] Default value for message is null? #1973
Comments
According to protocolbuffers/protobuf#359, message field can be |
For what it's worth, this caught me off guard as well. I just use the hasX() messages now when I want to test if a message was set or not. It may be better to open this issue against the protobuf library as well as gRPC just creates a compiler plugin but isn't the core project for how Java protobuf works. |
@jhspaybar: I actually meant proto version 3, sorry for confusion. |
Requests and responses themselves will be non- |
@ejona86: thanks for the detailed explanation!
generates public TestBool getOuter() {
return outer_ == null ? TestBool.getDefaultInstance() : outer_;
} Is that intended? |
@biran0079, hmmm... I would have expected it to be |
I filed protocolbuffers/protobuf#1718, and it seems the documentation is wrong. So in proto3, |
From this doc, default value for message field is null, while from the generated code, it seems the
DEFAULT_INSTANCE
of the message is returned, which is not null.Is the doc wrong?
The text was updated successfully, but these errors were encountered: