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

Field Presence for Protocol Buffer C# #321

Merged
merged 13 commits into from
May 1, 2015
Merged

Field Presence for Protocol Buffer C# #321

merged 13 commits into from
May 1, 2015

Conversation

anandolee
Copy link
Contributor

Remove has methods for optional non-message fields in proto3

@anandolee
Copy link
Contributor Author

@jskeet
Both generated code and reflection are supported for Field Presence. Tests are added.
Please help to review. Thanks

@anandolee anandolee added the c# label Apr 29, 2015
BAZ = 2;
}
message NestedMessage {
optional int32 value = 1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this is proto3, I'd remove the "optional" everywhere. (It's at least non-idiomatic.)

@jskeet
Copy link
Contributor

jskeet commented Apr 30, 2015

Nits, mostly - and I can fix up the runtime code if you'd like me to.
I haven't checked the generated code, because I trust the tests :)

@jskeet
Copy link
Contributor

jskeet commented Apr 30, 2015

Btw, I'm happy to fix up these new tests in conjunction with pull request 324 - I don't mind which gets merged first.

@jskeet
Copy link
Contributor

jskeet commented Apr 30, 2015

Have merged PR #324 in - you could either fix the tests to use xUnit, or I can do so in a separate PR. (I don't think being broken very temporarily is a significant issue at this point.)

@anandolee
Copy link
Contributor Author

Thank you Jon Skeet. Have fixed most comments.
I am new to csharp, learned a lot from your comments. Thanks a lot!

@@ -42,6 +43,7 @@ internal class SinglePrimitiveAccessor<TMessage, TBuilder> : IFieldAccessor<TMes
where TBuilder : IBuilder<TMessage, TBuilder>
{
private readonly Type clrType;
private readonly FieldDescriptor field;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: we don't need this field any more (as we're just capturing the descriptor in the delegate where we need it).

}

[Fact]
public void TestSeralizeAndParse()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry - missed the typo here before: Seralize => Serialize.

@jskeet
Copy link
Contributor

jskeet commented May 1, 2015

Added a few more small notes - but I'd be happy to fix them up myself if that's easier. Is @jtattermusch reviewing the C++? (Basically LGTM on the C#.)

@jtattermusch
Copy link
Contributor

The C++ changes generally LGTM. Good to go after addressing Jon's and my comments.

anandolee added a commit that referenced this pull request May 1, 2015
Field Presence for Protocol Buffer C# Proto3
@anandolee anandolee merged commit 447de3a into protocolbuffers:csharp May 1, 2015
@anandolee
Copy link
Contributor Author

Have fixed comments and merged. Thanks for reviewing
@jskeet if there's still something need to fix, feel free to do it.

yordis pushed a commit to yordis/protobuf that referenced this pull request Dec 8, 2024
…uffers#325)

Closes protocolbuffers#321.

In "nested_maps/2", the fully qualified name was built without discarding the
nil entries of the list. This meant that map fields worked correctly for .proto
files that contained a package, but failed to do so in .proto files that did
not, since the map key had then an extra "." in front that made the lookup in
"get_field/4" fail.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants