aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Jisi Liu <jisi.liu@gmail.com>2017-10-25 14:43:07 -0700
committerGravatar Jisi Liu <jisi.liu@gmail.com>2017-10-25 14:43:07 -0700
commitcdc0d9536a5c68510fde1e4c7d37fff18ecd0d6b (patch)
tree1edd0bd0c5876d5fd9ddb52f342835e564792dc2
parentee8a0911cbaca2a1849a847bbdc523120d003a31 (diff)
parentcefa9d73e3ce62b080fda0b306bbeb67a6fc2efa (diff)
Merge remote-tracking branch 'origin/3.4.x' into master
-rw-r--r--Makefile.am1
-rw-r--r--java/core/generate-test-sources-build.xml1
-rw-r--r--src/google/protobuf/compiler/java/java_file.cc7
3 files changed, 7 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index aaf9e7d4..cd1cfc3e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -333,6 +333,7 @@ java_EXTRA_DIST=
java/core/src/test/java/com/google/protobuf/WellKnownTypesTest.java \
java/core/src/test/java/com/google/protobuf/WireFormatTest.java \
java/core/src/test/proto/com/google/protobuf/any_test.proto \
+ java/core/src/test/proto/com/google/protobuf/deprecated_file.proto \
java/core/src/test/proto/com/google/protobuf/field_presence_test.proto \
java/core/src/test/proto/com/google/protobuf/lazy_fields_lite.proto \
java/core/src/test/proto/com/google/protobuf/lite_equals_and_hash.proto \
diff --git a/java/core/generate-test-sources-build.xml b/java/core/generate-test-sources-build.xml
index 68951747..abcdf5dd 100644
--- a/java/core/generate-test-sources-build.xml
+++ b/java/core/generate-test-sources-build.xml
@@ -19,6 +19,7 @@
<arg value="${protobuf.source.dir}/google/protobuf/unittest_enormous_descriptor.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_no_generic_services.proto"/>
<arg value="${protobuf.source.dir}/google/protobuf/unittest_well_known_types.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/deprecated_file.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/lazy_fields_lite.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/lite_equals_and_hash.proto"/>
<arg value="${test.proto.dir}/com/google/protobuf/multiple_files_test.proto"/>
diff --git a/src/google/protobuf/compiler/java/java_file.cc b/src/google/protobuf/compiler/java/java_file.cc
index 2d5465ba..21133a15 100644
--- a/src/google/protobuf/compiler/java/java_file.cc
+++ b/src/google/protobuf/compiler/java/java_file.cc
@@ -248,9 +248,12 @@ void FileGenerator::Generate(io::Printer* printer) {
PrintGeneratedAnnotation(
printer, '$', options_.annotate_code ? classname_ + ".java.pb.meta" : "");
printer->Print(
- "public final class $classname$ {\n"
+ "$deprecation$public final class $classname$ {\n"
" private $ctor$() {}\n",
- "classname", classname_, "ctor", classname_);
+ "deprecation", file_->options().deprecated() ?
+ "@java.lang.Deprecated " : "",
+ "classname", classname_,
+ "ctor", classname_);
printer->Annotate("classname", file_->name());
printer->Indent();