-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
Class deprecation support #2529
Conversation
… deprecate any fields that are currently using that type
Thanks for your pull request. The automated tests will run as soon as one of the admins verifies this change is ok for us to run on our infrastructure. |
1 similar comment
Thanks for your pull request. The automated tests will run as soon as one of the admins verifies this change is ok for us to run on our infrastructure. |
Can one of the admins verify this patch? |
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
CLAs look good, thanks! |
ok to test |
@@ -98,12 +98,21 @@ const std::vector<const FieldDescriptor*>& MessageGenerator::fields_by_number() | |||
return fields_by_number_; | |||
} | |||
|
|||
void MessageGenerator::AddDeprecatedFlag(io::Printer* printer) { | |||
if (descriptor_->options().deprecated()) | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small thing: our usual C++ style is to put the opening curly brace on the same line as the if (...)
.
@@ -126,6 +126,16 @@ void FieldGeneratorBase::AddDeprecatedFlag(io::Printer* printer) { | |||
{ | |||
printer->Print("[global::System.ObsoleteAttribute]\n"); | |||
} | |||
else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To cut down on the block nesting I would suggest rewriting it like this:
else if (descriptor_->type() == FieldDescriptor::TYPE_MESSAGE &&
descriptor_->message_type()->options().deprecated()) {
printer->Print("[global::System.ObsoleteAttribute]\n");
}
@wackoisgod I made a couple of small comments but it looks great otherwise, thanks for the pull request! |
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for the commit author(s). If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. |
CLAs look good, thanks! |
@acozzette updated based on your feedback |
Thanks, @wackoisgod! I'll wait for the Travis run to finish just to be safe and then merge this. I see Jenkins has an error but it looks like it's unrelated to this. |
Added the support for class level deprecation which will in turn also deprecate any fields that are currently using that type.
It was requested that support for deprecating a class in the c# code generation was added. In this implementation we deprecate the class as well as any fields that are also using that class.
I think this ensures that users don't continue to use the class in other places, maybe some food for thought that its another option to allow for class->field level deprecation.