aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJisi Liu <liujisi@google.com>2017-10-26 12:20:56 -0700
committerGitHub <noreply@github.com>2017-10-26 12:20:56 -0700
commit9aaa8e1e55012771acc46703a5c7538bb43060c1 (patch)
tree48523046c038db06559a9f15c96c5f0d8b94d4aa
parent2fc7aea3602eac3c3eb8d82e274851621e7443de (diff)
parentcdc0d9536a5c68510fde1e4c7d37fff18ecd0d6b (diff)
downloadprotobuf-9aaa8e1e55012771acc46703a5c7538bb43060c1.tar.gz
protobuf-9aaa8e1e55012771acc46703a5c7538bb43060c1.tar.bz2
protobuf-9aaa8e1e55012771acc46703a5c7538bb43060c1.zip
Merge pull request #3804 from pherl/merge
Merge 3.4.x into master before cutting 3.5.x
-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();