diff options
author | Jisi Liu <jisi.liu@gmail.com> | 2017-12-13 14:09:50 -0800 |
---|---|---|
committer | Jisi Liu <jisi.liu@gmail.com> | 2017-12-13 14:09:50 -0800 |
commit | 22e1cfd84ac2e7a6e0ee1101d75673c13a801c03 (patch) | |
tree | e84659634b5a3952a89436d9fd7d1df525dfa9a2 /src | |
parent | 5ce724bcebebb56914da6efc40b85c4c801e6fe1 (diff) | |
download | protobuf-22e1cfd84ac2e7a6e0ee1101d75673c13a801c03.tar.gz protobuf-22e1cfd84ac2e7a6e0ee1101d75673c13a801c03.tar.bz2 protobuf-22e1cfd84ac2e7a6e0ee1101d75673c13a801c03.zip |
Add deprecation annotation for oneof case.
Diffstat (limited to 'src')
-rw-r--r-- | src/google/protobuf/compiler/java/java_message.cc | 9 | ||||
-rw-r--r-- | src/google/protobuf/unittest.proto | 3 |
2 files changed, 7 insertions, 5 deletions
diff --git a/src/google/protobuf/compiler/java/java_message.cc b/src/google/protobuf/compiler/java/java_message.cc index f2ff2800..eca7cf9a 100644 --- a/src/google/protobuf/compiler/java/java_message.cc +++ b/src/google/protobuf/compiler/java/java_message.cc @@ -437,11 +437,10 @@ void ImmutableMessageGenerator::Generate(io::Printer* printer) { for (int j = 0; j < descriptor_->oneof_decl(i)->field_count(); j++) { const FieldDescriptor* field = descriptor_->oneof_decl(i)->field(j); printer->Print( - "$field_name$($field_number$),\n", - "field_name", - ToUpper(field->name()), - "field_number", - SimpleItoa(field->number())); + "$deprecation$$field_name$($field_number$),\n", + "deprecation", field->options().deprecated() ? "@java.lang.Deprecated " : "", + "field_name", ToUpper(field->name()), + "field_number", SimpleItoa(field->number())); } printer->Print( "$cap_oneof_name$_NOT_SET(0);\n", diff --git a/src/google/protobuf/unittest.proto b/src/google/protobuf/unittest.proto index 45a0edad..2a288daa 100644 --- a/src/google/protobuf/unittest.proto +++ b/src/google/protobuf/unittest.proto @@ -189,6 +189,9 @@ message NestedTestAllTypes { message TestDeprecatedFields { optional int32 deprecated_int32 = 1 [deprecated=true]; + oneof oneof_fields { + int32 deprecated_int32_in_oneof = 2 [deprecated=true]; + } } message TestDeprecatedMessage { |