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

Class deprecation support #2529

Merged
merged 3 commits into from
Jan 12, 2017
Merged

Class deprecation support #2529

merged 3 commits into from
Jan 12, 2017

Conversation

wackoisgod
Copy link
Contributor

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.

… deprecate any fields that are currently using that type
@grpc-kokoro
Copy link

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
@grpc-kokoro
Copy link

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.

@bazel-io
Copy link

Can one of the admins verify this patch?

@googlebot
Copy link

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!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@wackoisgod
Copy link
Contributor Author

I signed it!

@googlebot
Copy link

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.

@googlebot
Copy link

CLAs look good, thanks!

@acozzette
Copy link
Member

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())
{
Copy link
Member

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
Copy link
Member

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");
}

@acozzette
Copy link
Member

@wackoisgod I made a couple of small comments but it looks great otherwise, thanks for the pull request!

@googlebot
Copy link

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.

@googlebot
Copy link

CLAs look good, thanks!

@wackoisgod
Copy link
Contributor Author

@acozzette updated based on your feedback

@acozzette
Copy link
Member

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.

@acozzette acozzette merged commit e53dd99 into protocolbuffers:master Jan 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants